| 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 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 main() { | 54 main() { |
| 55 test("Test round trip message extraction, translation, code generation, " | 55 test("Test round trip message extraction, translation, code generation, " |
| 56 "and printing", () { | 56 "and printing", () { |
| 57 deleteGeneratedFiles(); | 57 deleteGeneratedFiles(); |
| 58 return extractMessages(null).then((result) { | 58 return extractMessages(null).then((result) { |
| 59 return generateTranslationFiles(result); | 59 return generateTranslationFiles(result); |
| 60 }).then((result) { | 60 }).then((result) { |
| 61 return generateCodeFromTranslation(result); | 61 return generateCodeFromTranslation(result); |
| 62 }).then((result) { | 62 }).then((result) { |
| 63 return runGeneratedCode(result); | 63 return runGeneratedCode(result); |
| 64 }).then(verifyResult); | 64 }).then(verifyResult) |
| 65 .whenComplete(deleteGeneratedFiles); |
| 65 }); | 66 }); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void deleteGeneratedFiles() { | 69 void deleteGeneratedFiles() { |
| 69 var files = [dir('intl_messages.json'), dir('translation_fr.json'), | 70 var files = [dir('intl_messages.json'), dir('translation_fr.json'), |
| 70 dir('messages_fr.dart'), dir('message_de_DE.dart'), | 71 dir('messages_fr.dart'), dir('messages_de_DE.dart'), |
| 71 dir('messages_all.dart')]; | 72 dir('translation_de_DE.json'), dir('messages_all.dart')]; |
| 72 files.map((name) => new File(name)).forEach((x) { | 73 files.map((name) => new File(name)).forEach((x) { |
| 73 if (x.existsSync()) x.deleteSync();}); | 74 if (x.existsSync()) x.deleteSync();}); |
| 74 } | 75 } |
| 75 | 76 |
| 76 /** | 77 /** |
| 77 * Run the process with the given list of filenames, which we assume | 78 * Run the process with the given list of filenames, which we assume |
| 78 * are in dir() and need to be qualified in case that's not our working | 79 * are in dir() and need to be qualified in case that's not our working |
| 79 * directory. | 80 * directory. |
| 80 */ | 81 */ |
| 81 Future<ProcessResult> run(ProcessResult previousResult, List<String> filenames) | 82 Future<ProcessResult> run(ProcessResult previousResult, List<String> filenames) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 verify("Diese Methode ist nicht eine Lambda"); | 214 verify("Diese Methode ist nicht eine Lambda"); |
| 214 verify("Dies ergibt sich aus einer statischen Methode"); | 215 verify("Dies ergibt sich aus einer statischen Methode"); |
| 215 verify("This is missing some translations"); | 216 verify("This is missing some translations"); |
| 216 verify("Antike griechische Galgenmännchen Zeichen: 𐅆𐅇"); | 217 verify("Antike griechische Galgenmännchen Zeichen: 𐅆𐅇"); |
| 217 // verify("Die Sache ist, well"); | 218 // verify("Die Sache ist, well"); |
| 218 // expect("Einer der knifflige Dinge ist der Plural"); | 219 // expect("Einer der knifflige Dinge ist der Plural"); |
| 219 // expect("Zu den kniffligen Dinge Pluralformen"); | 220 // expect("Zu den kniffligen Dinge Pluralformen"); |
| 220 verify("Escapes: "); | 221 verify("Escapes: "); |
| 221 verify("\r\f\b\t\v."); | 222 verify("\r\f\b\t\v."); |
| 222 } | 223 } |
| OLD | NEW |