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 import 'dart:async'; | |
6 | |
7 import 'package:expect/expect.dart'; | |
8 import 'package:async_helper/async_helper.dart'; | |
9 import 'memory_compiler.dart' show compilerFor, OutputCollector; | |
10 | |
11 const MEMORY_SOURCE_FILES = const <String, String> { | |
12 'main.dart': """ | |
13 library main; | |
14 | |
15 @MirrorsUsed(targets: const ['main', 'lib']) | |
16 import 'dart:mirrors'; | |
17 import 'lib.dart'; | |
18 | |
19 | |
20 class Subclass extends Super { | |
21 int _private; | |
22 | |
23 int magic() => _private++; | |
24 } | |
25 | |
26 main() { | |
27 var objects = [new Super(), new Subclass()]; | |
28 print(currentMirrorSystem().findLibrary(#main).uri); | |
29 } | |
30 """, | |
31 'lib.dart': """ | |
32 library lib; | |
33 | |
34 class Super { | |
35 int _private; | |
36 | |
37 int magic() => _private++; | |
38 } | |
39 """ | |
40 }; | |
41 | |
42 runTest(bool hideUris) { | |
43 OutputCollector collector = new OutputCollector(); | |
44 var options = ["--minify"]; | |
45 if (hideUris) options.add("--hide-uris"); | |
46 var compiler = compilerFor(MEMORY_SOURCE_FILES, | |
47 outputProvider: collector, | |
48 options: options); | |
49 return compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { | |
50 String jsOutput = collector.getOutput('', 'js'); | |
51 Expect.equals(!hideUris, jsOutput.contains("main.dart")); | |
52 Expect.equals(!hideUris, jsOutput.contains("lib.dart")); | |
blois
2014/09/22 21:26:09
I'm curious what the output is from an import such
floitsch
2014/09/22 21:28:10
I'm pretty sure it's absolute.
Fwiw the VM has sim
| |
53 }); | |
54 } | |
55 | |
56 void main() { | |
57 asyncStart(); | |
58 new Future.value() | |
59 .then((_) => runTest(false)) | |
60 .then((_) => runTest(true)) | |
61 .whenComplete(asyncEnd); | |
62 } | |
OLD | NEW |