| 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 /** | 5 /** |
| 6 * This is a helper for run.sh. We try to run all of the Dart code in one | 6 * This is a helper for run.sh. We try to run all of the Dart code in one |
| 7 * instance of the Dart VM to reduce warm-up time. | 7 * instance of the Dart VM to reduce warm-up time. |
| 8 */ | 8 */ |
| 9 library web_ui.testing.render_test; | 9 library web_ui.testing.render_test; |
| 10 | 10 |
| 11 import 'dart:io'; | 11 import 'dart:io'; |
| 12 import 'dart:math' show min; | 12 import 'package:path/path.dart' as path; |
| 13 import 'package:pathos/path.dart' as path; | |
| 14 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 15 import 'package:web_ui/dwc.dart' as dwc; | 14 import 'package:web_ui/dwc.dart' as dwc; |
| 16 | 15 |
| 17 void renderTests(String baseDir, String inputDir, String expectedDir, | 16 void renderTests(String baseDir, String inputDir, String expectedDir, |
| 18 String outDir, {List<String> arguments, String script, String pattern, | 17 String outDir, {List<String> arguments, String script, String pattern, |
| 19 bool deleteDir: true}) { | 18 bool deleteDir: true}) { |
| 20 if (arguments == null) arguments = new Options().arguments; | 19 if (arguments == null) arguments = []; |
| 21 if (script == null) script = new Options().script; | 20 if (script == null) script = Platform.script.toString(); |
| 22 | 21 |
| 23 var filePattern = new RegExp(pattern != null ? pattern | 22 var filePattern = new RegExp(pattern != null ? pattern |
| 24 : (arguments.length > 0 ? arguments.removeAt(0) : '.')); | 23 : (arguments.length > 0 ? arguments.removeAt(0) : '.')); |
| 25 | 24 |
| 26 var scriptDir = path.absolute(path.dirname(script)); | 25 var scriptDir = path.absolute(path.dirname(script)); |
| 27 baseDir = path.join(scriptDir, baseDir); | 26 baseDir = path.join(scriptDir, baseDir); |
| 28 inputDir = path.join(scriptDir, inputDir); | 27 inputDir = path.join(scriptDir, inputDir); |
| 29 expectedDir = path.join(scriptDir, expectedDir); | 28 expectedDir = path.join(scriptDir, expectedDir); |
| 30 outDir = path.join(scriptDir, outDir); | 29 outDir = path.join(scriptDir, outDir); |
| 31 | 30 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 var outPath = path.join(outDir, '$filename.txt'); | 86 var outPath = path.join(outDir, '$filename.txt'); |
| 88 var expectedPath = path.join(expectedDir, '$filename.txt'); | 87 var expectedPath = path.join(expectedDir, '$filename.txt'); |
| 89 new File(outPath).writeAsStringSync(output); | 88 new File(outPath).writeAsStringSync(output); |
| 90 var expected = new File(expectedPath).readAsStringSync(); | 89 var expected = new File(expectedPath).readAsStringSync(); |
| 91 expect(output, expected, | 90 expect(output, expected, |
| 92 reason: 'unexpected output for <$filename>'); | 91 reason: 'unexpected output for <$filename>'); |
| 93 }); | 92 }); |
| 94 } | 93 } |
| 95 } | 94 } |
| 96 } | 95 } |
| OLD | NEW |