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 | |
5 // Helper class for writing compiler tests. | |
6 library fletchc.test.compiler_test_case; | |
7 | |
8 import 'dart:async' show | |
9 Future; | |
10 | |
11 export 'dart:async' show | |
12 Future; | |
13 | |
14 export 'package:expect/expect.dart' show | |
15 Expect; | |
16 | |
17 import 'package:compiler/src/elements/elements.dart' show | |
18 LibraryElement; | |
19 | |
20 export 'package:compiler/src/elements/elements.dart' show | |
21 LibraryElement; | |
22 | |
23 import 'package:fletchc/fletch_compiler.dart' show | |
24 StringOrUri; | |
25 | |
26 export 'package:fletchc/fletch_compiler.dart' show | |
27 StringOrUri; | |
28 | |
29 const String SCHEME = 'org.trydart.compiler-test-case'; | |
30 | |
31 Uri customUri(String path) => Uri.parse('$SCHEME:/$path'); | |
32 | |
33 abstract class CompilerTestCase { | |
34 final Uri scriptUri; | |
35 | |
36 CompilerTestCase([@StringOrUri scriptUri]) | |
37 : this.scriptUri = makeScriptUri(scriptUri); | |
38 | |
39 static Uri makeScriptUri(@StringOrUri scriptUri) { | |
40 if (scriptUri == null) return customUri('main.dart'); | |
41 if (scriptUri is Uri) return scriptUri; | |
42 return customUri(scriptUri as String); | |
43 } | |
44 | |
45 Future run(); | |
46 | |
47 String toString() => 'CompilerTestCase($scriptUri)'; | |
48 } | |
OLD | NEW |