Skip to content

Commit 034a309

Browse files
Purge byte order marks
1 parent 3988ee3 commit 034a309

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

Rakefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,22 @@ task :notes do
192192
end
193193

194194
File.open('release_notes.md', 'w') { |f| f.write notes.to_s.strip }
195+
end
196+
197+
# Used to purge byte order marks that mess up YARD
198+
def remove_non_ascii
199+
Dir.glob('./**/*.rb') do |path|
200+
path = File.expand_path path
201+
next if File.directory? path
202+
203+
data = File.read path
204+
data = data.encode('US-ASCII', invalid: :replace, undef: :replace, replace: '')
205+
data = data.encode('UTF-8')
206+
File.open(path, 'w') { |f| f.write data }
207+
end
208+
end
209+
210+
desc 'Remove non-ascii bytes'
211+
task :byte do
212+
remove_non_ascii
195213
end

ios_tests/lib/ios/specs/ios/helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def before_first
99
end
1010

1111
t 'ios_password' do
12-
ios_password.must_equal '•'
13-
ios_password(2).must_equal '•' * 2
12+
ios_password.must_equal 8226.chr('UTF-8')
13+
ios_password(2).must_equal 8226.chr('UTF-8') * 2
1414
end
1515

1616
# todo: t 'get_page' do

lib/appium_lib/ios/helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
module Appium
1+
module Appium
22
module Ios
33
# iOS only. On Android uiautomator always returns an empty string for EditText password.
44
#
55
# Password character returned from value of UIASecureTextField
66
# @param length [Integer] the length of the password to generate
77
# @return [String] the returned string is of size length
88
def ios_password length=1
9-
'•' * length
9+
8226.chr('UTF-8') * length
1010
end
1111

1212
# Returns a string of interesting elements. iOS only.

0 commit comments

Comments
 (0)