Skip to content

Commit 74a9c10

Browse files
committed
Fix test failure on ios_strings_file_validation_helper_spec
1 parent daba04d commit 74a9c10

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

spec/ios_strings_file_validation_helper_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# behaves correctly
4343
expect(
4444
described_class.find_duplicated_keys(
45-
file: File.join(test_data_dir, 'ios_l10n_helper', 'expected-merged.strings')
45+
file: File.join(test_data_dir, 'ios_l10n_helper', 'expected-merged-prefixed.strings')
4646
)
4747
).to be_empty
4848
expect(
@@ -52,4 +52,15 @@
5252
).to be_empty
5353
end
5454
end
55+
56+
context 'when there are unquoted keys' do
57+
it 'returns an error' do
58+
# Unquoted strings are currently not supported by our validation helper in its current state, despite being a valid syntax, because we considered
59+
# that it was not worth adding complexity to our state machine logic for this use case — we expect all the `.strings` files we plan to validate will
60+
# come from GlotPress exports, and will thus always have their keys quoted.
61+
# If support for unquoted strings is added to our validation helper in the future, feel free to update this test example accordingly.
62+
expect { described_class.find_duplicated_keys(file: File.join(test_data_dir, 'ios_l10n_helper', 'expected-merged.strings')) }
63+
.to raise_error(RuntimeError, 'Invalid character `I` found on line 21, col 1')
64+
end
65+
end
5566
end

0 commit comments

Comments
 (0)