| 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 'dart:convert'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 }).then((_) => sample.main()) | 41 }).then((_) => sample.main()) |
| 42 .then(verifyResult) | 42 .then(verifyResult) |
| 43 .whenComplete(deleteGeneratedFiles); | 43 .whenComplete(deleteGeneratedFiles); |
| 44 }); | 44 }); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void deleteGeneratedFiles() { | 47 void deleteGeneratedFiles() { |
| 48 var files = [dir('intl_messages.json'), dir('translation_fr.json'), | 48 var files = [dir('intl_messages.json'), dir('translation_fr.json'), |
| 49 dir('translation_de_DE.json')]; | 49 dir('translation_de_DE.json')]; |
| 50 files.map((name) => new File(name)).forEach((x) { | 50 files.map((name) => new File(name)).forEach((x) { |
| 51 if (x.existsSync()) x.deleteSync();}); | 51 if (x.existsSync()) x.deleteSync(); |
| 52 }); |
| 52 } | 53 } |
| 53 | 54 |
| 54 /** | 55 /** |
| 55 * Run the process with the given list of filenames, which we assume | 56 * Run the process with the given list of filenames, which we assume |
| 56 * are in dir() and need to be qualified in case that's not our working | 57 * are in dir() and need to be qualified in case that's not our working |
| 57 * directory. | 58 * directory. |
| 58 */ | 59 */ |
| 59 Future<ProcessResult> run(ProcessResult previousResult, List<String> filenames) | 60 Future<ProcessResult> run(ProcessResult previousResult, List<String> filenames) |
| 60 { | 61 { |
| 61 // If there's a failure in one of the sub-programs, print its output. | 62 // If there's a failure in one of the sub-programs, print its output. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 91 ['make_hardcoded_translation.dart', 'intl_messages.json']); | 92 ['make_hardcoded_translation.dart', 'intl_messages.json']); |
| 92 | 93 |
| 93 Future<ProcessResult> generateCodeFromTranslation(ProcessResult previousResult) | 94 Future<ProcessResult> generateCodeFromTranslation(ProcessResult previousResult) |
| 94 => run( | 95 => run( |
| 95 previousResult, | 96 previousResult, |
| 96 ['generate_from_json.dart', '--generated-file-prefix=foo_', | 97 ['generate_from_json.dart', '--generated-file-prefix=foo_', |
| 97 'sample_with_messages.dart', | 98 'sample_with_messages.dart', |
| 98 'part_of_sample_with_messages.dart', 'translation_fr.json', | 99 'part_of_sample_with_messages.dart', 'translation_fr.json', |
| 99 'translation_de_DE.json' ]); | 100 'translation_de_DE.json' ]); |
| 100 | 101 |
| OLD | NEW |