 Chromium Code Reviews
 Chromium Code Reviews Issue 582753002:
  dart2js: add --preserve-uris flag.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 582753002:
  dart2js: add --preserve-uris flag.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart| Index: tests/compiler/dart2js/hide_uri_test.dart | 
| diff --git a/tests/compiler/dart2js/hide_uri_test.dart b/tests/compiler/dart2js/hide_uri_test.dart | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..f6027ce3b7b9f96c11d1c038f830f516ebd31562 | 
| --- /dev/null | 
| +++ b/tests/compiler/dart2js/hide_uri_test.dart | 
| @@ -0,0 +1,62 @@ | 
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 
| +// for details. All rights reserved. Use of this source code is governed by a | 
| +// BSD-style license that can be found in the LICENSE file. | 
| + | 
| +import 'dart:async'; | 
| + | 
| +import 'package:expect/expect.dart'; | 
| +import 'package:async_helper/async_helper.dart'; | 
| +import 'memory_compiler.dart' show compilerFor, OutputCollector; | 
| + | 
| +const MEMORY_SOURCE_FILES = const <String, String> { | 
| + 'main.dart': """ | 
| +library main; | 
| + | 
| +@MirrorsUsed(targets: const ['main', 'lib']) | 
| +import 'dart:mirrors'; | 
| +import 'lib.dart'; | 
| + | 
| + | 
| +class Subclass extends Super { | 
| + int _private; | 
| + | 
| + int magic() => _private++; | 
| +} | 
| + | 
| +main() { | 
| + var objects = [new Super(), new Subclass()]; | 
| + print(currentMirrorSystem().findLibrary(#main).uri); | 
| +} | 
| +""", | 
| + 'lib.dart': """ | 
| +library lib; | 
| + | 
| +class Super { | 
| + int _private; | 
| + | 
| + int magic() => _private++; | 
| +} | 
| +""" | 
| +}; | 
| + | 
| +runTest(bool hideUris) { | 
| + OutputCollector collector = new OutputCollector(); | 
| + var options = ["--minify"]; | 
| + if (hideUris) options.add("--hide-uris"); | 
| + var compiler = compilerFor(MEMORY_SOURCE_FILES, | 
| + outputProvider: collector, | 
| + options: options); | 
| + return compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { | 
| + String jsOutput = collector.getOutput('', 'js'); | 
| + Expect.equals(!hideUris, jsOutput.contains("main.dart")); | 
| + 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
 | 
| + }); | 
| +} | 
| + | 
| +void main() { | 
| + asyncStart(); | 
| + new Future.value() | 
| + .then((_) => runTest(false)) | 
| + .then((_) => runTest(true)) | 
| + .whenComplete(asyncEnd); | 
| +} |