| OLD | NEW | 
 | (Empty) | 
|   1 // Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file |  | 
|   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. |  | 
|   4 library failed_extraction_test; |  | 
|   5  |  | 
|   6 import "message_extraction_test.dart"; |  | 
|   7 import "dart:io"; |  | 
|   8 import "package:unittest/unittest.dart"; |  | 
|   9  |  | 
|  10 main() { |  | 
|  11   test("Expect warnings but successful extraction", () { |  | 
|  12     runTestWithWarnings(warningsAreErrors: false, expectedExitCode: 0); |  | 
|  13   }); |  | 
|  14 } |  | 
|  15  |  | 
|  16 const defaultFiles = |  | 
|  17     const ["sample_with_messages.dart", "part_of_sample_with_messages.dart"]; |  | 
|  18  |  | 
|  19 void runTestWithWarnings({bool warningsAreErrors, int expectedExitCode, |  | 
|  20   bool embeddedPlurals: true, List<String> sourceFiles: defaultFiles}) { |  | 
|  21  |  | 
|  22   void verify(ProcessResult result) { |  | 
|  23     try { |  | 
|  24       expect(result.exitCode, expectedExitCode); |  | 
|  25     } finally { |  | 
|  26       deleteGeneratedFiles(); |  | 
|  27     } |  | 
|  28   } |  | 
|  29  |  | 
|  30   copyFilesToTempDirectory(); |  | 
|  31   var program = asTestDirPath("../../bin/extract_to_arb.dart"); |  | 
|  32   var args = ["--output-dir=$tempDir"]; |  | 
|  33   if (warningsAreErrors) { |  | 
|  34     args.add('--warnings-are-errors'); |  | 
|  35   } |  | 
|  36   if (!embeddedPlurals) { |  | 
|  37     args.add('--no-embedded-plurals'); |  | 
|  38   } |  | 
|  39   var files = sourceFiles.map(asTempDirPath).toList(); |  | 
|  40   var allArgs = [program] |  | 
|  41       ..addAll(args) |  | 
|  42       ..addAll(files); |  | 
|  43   var callback = expectAsync(verify); |  | 
|  44   run(null, allArgs).then(callback); |  | 
|  45 } |  | 
| OLD | NEW |