@@ -187,4 +187,67 @@ class ExecutableTests: XCTestCase {
187
187
188
188
""" )
189
189
}
190
+
191
+ func testExampleOutput_android( ) throws {
192
+ let binary = productsDirectory. appendingPathComponent ( " locheck " )
193
+
194
+ let process = Process ( )
195
+ process. executableURL = binary
196
+ process. arguments = [ " androidstrings " , " Examples/strings-base.xml " , " Examples/strings-translation.xml " ]
197
+
198
+ let stdoutPipe = Pipe ( )
199
+ let stderrPipe = Pipe ( )
200
+ process. standardOutput = stdoutPipe
201
+ process. standardError = stderrPipe
202
+
203
+ try process. run ( )
204
+ process. waitUntilExit ( )
205
+
206
+ let stdout = String ( data: stdoutPipe. fileHandleForReading. readDataToEndOfFile ( ) , encoding: . utf8)
207
+ let stderr = String ( data: stderrPipe. fileHandleForReading. readDataToEndOfFile ( ) , encoding: . utf8)
208
+
209
+ XCTAssertEqual ( stdout!, """
210
+
211
+ Summary:
212
+ Examples/strings-base.xml
213
+ missing_from_translation:
214
+ WARNING: 'missing_from_translation' is missing from Examples (key_missing_from_translation)
215
+ translation_missing_string_array:
216
+ WARNING: 'translation_missing_string_array' is missing from Examples (key_missing_from_translation)
217
+ Examples/strings-translation.xml
218
+ base_missing_string_array:
219
+ WARNING: 'base_missing_string_array' is missing from the base translation (key_missing_from_base)
220
+ missing_from_base:
221
+ WARNING: 'missing_from_base' is missing from the base translation (key_missing_from_base)
222
+ string_array_wrong_item_count:
223
+ WARNING: 'string_array_wrong_item_count' item count mismatch in Examples: 2 (should be 1) (string_array_item_count_mismatch)
224
+ translation_has_invalid_specifier:
225
+ ERROR: Specifier for argument 2 does not match (should be d, is lu) (string_has_invalid_argument)
226
+ Base: %s %d
227
+ Translation: %s %lu
228
+ translation_has_missing_arg:
229
+ WARNING: 'translation_has_missing_arg' does not include argument(s) at 2 (string_has_missing_arguments)
230
+ Base: %s %d
231
+ Translation: %s
232
+ translation_has_missing_phrase:
233
+ ERROR: 'translation_has_missing_phrase' does not include argument(s): object_name (phrase_has_missing_arguments)
234
+ Base: Could not add {user_name} to \\ " {object_name} \\ "
235
+ Translation: Could not add {user_name}
236
+ 6 warnings, 2 errors
237
+ Errors found
238
+
239
+ """ )
240
+
241
+ XCTAssertEqual ( stderr!, """
242
+ Examples/strings-base.xml:28: warning: 'missing_from_translation' is missing from Examples (key_missing_from_translation)
243
+ Examples/strings-translation.xml:25: warning: 'missing_from_base' is missing from the base translation (key_missing_from_base)
244
+ Examples/strings-base.xml:36: warning: 'translation_missing_string_array' is missing from Examples (key_missing_from_translation)
245
+ Examples/strings-translation.xml:33: warning: 'base_missing_string_array' is missing from the base translation (key_missing_from_base)
246
+ Examples/strings-translation.xml:17: error: 'translation_has_missing_phrase' does not include argument(s): object_name (phrase_has_missing_arguments)
247
+ Examples/strings-translation.xml:21: error: Specifier for argument 2 does not match (should be d, is lu) (string_has_invalid_argument)
248
+ Examples/strings-translation.xml:22: warning: 'translation_has_missing_arg' does not include argument(s) at 2 (string_has_missing_arguments)
249
+ Examples/strings-translation.xml:38: warning: 'string_array_wrong_item_count' item count mismatch in Examples: 2 (should be 1) (string_array_item_count_mismatch)
250
+
251
+ """ )
252
+ }
190
253
}
0 commit comments