OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library test.kernel.closures.suite; | 5 library test.kernel.closures.suite; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'dart:io' show File; | 9 import 'dart:io' show File; |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 if (await expectedFile.exists()) { | 75 if (await expectedFile.exists()) { |
76 String expected = await expectedFile.readAsString(); | 76 String expected = await expectedFile.readAsString(); |
77 if (expected.trim() != result.log.trim()) { | 77 if (expected.trim() != result.log.trim()) { |
78 String diff = await runDiff(expectedFile.uri, result.log); | 78 String diff = await runDiff(expectedFile.uri, result.log); |
79 return fail(null, "$uri doesn't match ${expectedFile.uri}\n$diff"); | 79 return fail(null, "$uri doesn't match ${expectedFile.uri}\n$diff"); |
80 } else { | 80 } else { |
81 return pass(0); | 81 return pass(0); |
82 } | 82 } |
83 } | 83 } |
84 return fail( | 84 return fail( |
85 null, | 85 null, """Please create file ${expectedFile.path} with this content: |
86 """Please create file ${expectedFile.path} with this content: | |
87 ${result.log}"""); | 86 ${result.log}"""); |
88 } | 87 } |
89 } | 88 } |
90 | 89 |
91 class EvaluationLog { | 90 class EvaluationLog { |
92 /// Evaluated program uri. | 91 /// Evaluated program uri. |
93 final Uri uri; | 92 final Uri uri; |
94 | 93 |
95 /// Evaluated program log. | 94 /// Evaluated program log. |
96 final String log; | 95 final String log; |
97 | 96 |
98 EvaluationLog(this.uri, this.log); | 97 EvaluationLog(this.uri, this.log); |
99 } | 98 } |
100 | 99 |
101 main(List<String> arguments) => | 100 main(List<String> arguments) => |
102 runMe(arguments, InterpreterContext.create, "testing.json"); | 101 runMe(arguments, InterpreterContext.create, "testing.json"); |
OLD | NEW |