Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: tests/compiler/dart2js/hide_uri_test.dart

Issue 582753002: dart2js: add --preserve-uris flag. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments in test. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698