-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: fixing android escaping #133
Conversation
def escape_android_characters(value) | ||
value.gsub!(/'/, "'" => "\\'") | ||
value.gsub!(/&/, "&" => '&') | ||
value.gsub!(/</, "<" => '<') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
assert_equal expected_output, output | ||
|
||
assert_true FileUtils.identical?("values-en/escaped_strings.xml", | ||
"test/data/test_data_with_characters_that_need_escaping.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [98/80]
assert exist, "the ouptut file does not exist" | ||
|
||
output = File.read("values-en/escaped_strings.xml") | ||
expected_output = File.read("test/data/test_data_with_characters_that_need_escaping.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [93/80]
def test_android_character_escaping | ||
converter = Babelish::CSV2Android.new("test/data/test_data_with_characters_that_need_escaping.csv", | ||
{ "English" => "en" }, | ||
{ output_basename: "escaped_strings" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/BracesAroundHashParameters: Redundant curly braces around a hash parameter.
Metrics/LineLength: Line is too long. [81/80]
@@ -69,4 +69,25 @@ def test_converting_with_basename | |||
# clean up | |||
system("rm -rf ./values-en") | |||
end | |||
|
|||
def test_android_character_escaping | |||
converter = Babelish::CSV2Android.new("test/data/test_data_with_characters_that_need_escaping.csv", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [103/80]
There is some problems regarding already escaped charaters from the original data |
Inspired by PR from Falko Richter: netbe#133
Inspired by PR from Falko Richter: netbe#133
Inspired by PR from Falko Richter: netbe#133
Inspired by PR from Falko Richter: netbe#133
Inspired by PR from Falko Richter: netbe#133
should fix #130
<b>
for instance)