OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library message_extraction_test; | 5 library message_extraction_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:convert'; |
10 import 'package:path/path.dart' as path; | 11 import 'package:path/path.dart' as path; |
11 import '../data_directory.dart'; | 12 import '../data_directory.dart'; |
12 | 13 |
13 final dart = Platform.executable; | 14 final dart = Platform.executable; |
14 | 15 |
15 /** The VM arguments we were given, most important package-root. */ | 16 /** The VM arguments we were given, most important package-root. */ |
16 final vmArgs = Platform.executableArguments; | 17 final vmArgs = Platform.executableArguments; |
17 | 18 |
18 /** | 19 /** |
19 * Translate a file path into this test directory, regardless of the | 20 * Translate a file path into this test directory, regardless of the |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 print("exitCode=${previousResult.exitCode}"); | 68 print("exitCode=${previousResult.exitCode}"); |
68 } | 69 } |
69 var filesInTheRightDirectory = filenames.map((x) => dir(x)).toList(); | 70 var filesInTheRightDirectory = filenames.map((x) => dir(x)).toList(); |
70 // Inject the script argument --output-dir in between the script and its | 71 // Inject the script argument --output-dir in between the script and its |
71 // arguments. | 72 // arguments. |
72 var args = [] | 73 var args = [] |
73 ..addAll(vmArgs) | 74 ..addAll(vmArgs) |
74 ..add(filesInTheRightDirectory.first) | 75 ..add(filesInTheRightDirectory.first) |
75 ..addAll(["--output-dir=${dir()}"]) | 76 ..addAll(["--output-dir=${dir()}"]) |
76 ..addAll(filesInTheRightDirectory.skip(1)); | 77 ..addAll(filesInTheRightDirectory.skip(1)); |
77 var result = Process.run(dart, args); | 78 var result = Process.run(dart, args, stdoutEncoding: UTF8, |
| 79 stderrEncoding: UTF8); |
78 return result; | 80 return result; |
79 } | 81 } |
80 | 82 |
81 Future<ProcessResult> extractMessages(ProcessResult previousResult) => run( | 83 Future<ProcessResult> extractMessages(ProcessResult previousResult) => run( |
82 previousResult, | 84 previousResult, |
83 ['extract_to_json.dart', '--suppress-warnings', 'sample_with_messages.dart', | 85 ['extract_to_json.dart', '--suppress-warnings', 'sample_with_messages.dart', |
84 'part_of_sample_with_messages.dart']); | 86 'part_of_sample_with_messages.dart']); |
85 | 87 |
86 Future<ProcessResult> generateTranslationFiles(ProcessResult previousResult) => | 88 Future<ProcessResult> generateTranslationFiles(ProcessResult previousResult) => |
87 run( | 89 run( |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 verify('Null'); | 242 verify('Null'); |
241 verify('ein'); | 243 verify('ein'); |
242 verify('Mann'); | 244 verify('Mann'); |
243 verify('Frau'); | 245 verify('Frau'); |
244 verify('7 Mann'); | 246 verify('7 Mann'); |
245 verify('7 Kanadischen dollar'); | 247 verify('7 Kanadischen dollar'); |
246 verify('5 einige Währung oder anderen.'); | 248 verify('5 einige Währung oder anderen.'); |
247 verify('1 Kanadischer dollar'); | 249 verify('1 Kanadischer dollar'); |
248 verify('2 Kanadischen dollar'); | 250 verify('2 Kanadischen dollar'); |
249 } | 251 } |
OLD | NEW |