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

Unified Diff: test/dart2js/source_maps_are_self_contained_test.dart

Issue 2653753010: Fix URI for packages: make them self contained within the domain served by pub-serve (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/barback/dart2js_transformer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/dart2js/source_maps_are_self_contained_test.dart
diff --git a/test/dart2js/source_maps_are_self_contained_test.dart b/test/dart2js/source_maps_are_self_contained_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..018432e0e35a5fdfc2ef821962eeb92026a81687
--- /dev/null
+++ b/test/dart2js/source_maps_are_self_contained_test.dart
@@ -0,0 +1,78 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.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 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+main() {
+ // This test is a bit shaky. Since dart2js is free to inline things, it's
+ // not precise as to which source libraries will actually be referenced in
+ // the source map. But this tries to use a type from a package and validate
+ // that its source ends up in the source map with a valid URI.
+ integration("Source maps URIs for files in packages are self-contained", () {
+ d.dir("foo", [
+ d.libPubspec("foo", "0.0.1"),
+ d.dir("lib", [
+ d.file("foo.dart",
+ """
+ library foo;
+ foo() {
+ // As of today dart2js will not inline this code.
+ if ('\${new DateTime.now()}' == 'abc') return 1;
+ return 2;
+ }
+ """)
+ ])
+ ]).create();
+
+ d.dir(appPath, [
+ d.appPubspec({
+ "foo": {"path": "../foo"}
+ }),
+ d.dir("web", [
+ d.file("main.dart",
+ """
+ import 'package:foo/foo.dart';
+ main() => foo();
+ """),
+ d.dir("sub", [
+ d.file("main2.dart",
+ """
+ import 'package:foo/foo.dart';
+ main() => foo();
+ """),
+ ])
+ ])
+ ]).create();
+
+
+ pubGet();
+ schedulePub(args: ["build", "--mode", "debug"],
+ output: new RegExp(r'Built \d+ files to "build".'),
+ exitCode: 0);
+
+ d.dir(appPath, [
+ d.dir("build", [
+ d.dir("web", [
+ d.matcherFile("main.dart.js.map",
+ // Note: we include the quotes to ensure this is the full URL path
+ // in the source map
+ contains(r'"packages/foo/foo.dart"')),
+ d.dir("sub", [
+ d.matcherFile("main2.dart.js.map",
+ contains(r'"../packages/foo/foo.dart"'))
+ ]),
+ d.dir("packages", [
+ d.dir(r"foo", [
+ d.matcherFile("foo.dart",
+ contains("foo() {"))
+ ])
+ ])
+ ])
+ ])
+ ]).validate();
+ });
+}
« no previous file with comments | « lib/src/barback/dart2js_transformer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698