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

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

Issue 189563004: Use '--source-map' and '--out' options to support source maps from non-commandline. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 import '../../../sdk/lib/_internal/compiler/implementation/util/uri_extras.dart' ; 7 import '../../../sdk/lib/_internal/compiler/implementation/util/uri_extras.dart' ;
8 8
9 9
10 void testRelativize() { 10 void testRelativize() {
11 void c(String expected, String base, String path, bool isWindows) { 11 void c(String expected, String base, String path, bool isWindows) {
12 if (isWindows == null) { 12 if (isWindows == null) {
13 c(expected, base, path, true); 13 c(expected, base, path, true);
14 c(expected, base, path, false); 14 c(expected, base, path, false);
15 return; 15 return;
16 } 16 }
17 String r;
18 17
19 r = relativize(Uri.parse('file:$base'), 18 test(Uri base, Uri uri) {
20 Uri.parse('file:$path'), 19 String r = relativize(base, uri, isWindows);
21 isWindows); 20 Uri resolved = base.resolve(r);
22 Expect.stringEquals(expected, r); 21 Expect.equals(uri.scheme.toLowerCase(), resolved.scheme.toLowerCase());
22 if (isWindows) {
23 Expect.equals(uri.path.toLowerCase(), resolved.path.toLowerCase());
24 } else {
25 Expect.equals(uri.path, resolved.path);
26 }
27 Expect.stringEquals(expected, r);
28 }
23 29
24 r = relativize(Uri.parse('FILE:$base'), 30 test(Uri.parse('file:$base'),
25 Uri.parse('FILE:$path'), 31 Uri.parse('file:$path'));
26 isWindows);
27 Expect.stringEquals(expected, r);
28 32
29 r = relativize(Uri.parse('file:$base'), 33 test(Uri.parse('FILE:$base'),
30 Uri.parse('FILE:$path'), 34 Uri.parse('FILE:$path'));
31 isWindows);
32 Expect.stringEquals(expected, r);
33 35
34 r = relativize(Uri.parse('FILE:$base'), 36 test(Uri.parse('file:$base'),
35 Uri.parse('file:$path'), 37 Uri.parse('FILE:$path'));
36 isWindows); 38
37 Expect.stringEquals(expected, r); 39 test(Uri.parse('FILE:$base'),
40 Uri.parse('file:$path'));
38 } 41 }
39 c('bar', '/', '/bar', null); 42 c('bar', '/', '/bar', null);
40 c('/bar', '/foo', '/bar', null); 43 c('bar', '/foo', '/bar', null);
41 c('/bar', '/foo/', '/bar', null); 44 c('/bar', '/foo/', '/bar', null);
42 45
43 c('bar', '///c:/', '///c:/bar', true); 46 c('bar', '///c:/', '///c:/bar', true);
44 c('/c:/bar', '///c:/foo', '///c:/bar', true); 47 c('bar', '///c:/foo', '///c:/bar', true);
45 c('/c:/bar', '///c:/foo/', '///c:/bar', true); 48 c('/c:/bar', '///c:/foo/', '///c:/bar', true);
46 49
47 c('BAR', '///c:/', '///c:/BAR', true); 50 c('BAR', '///c:/', '///c:/BAR', true);
48 c('/c:/BAR', '///c:/foo', '///c:/BAR', true); 51 c('BAR', '///c:/foo', '///c:/BAR', true);
49 c('/c:/BAR', '///c:/foo/', '///c:/BAR', true); 52 c('/c:/BAR', '///c:/foo/', '///c:/BAR', true);
50 53
51 c('../sdk/lib/_internal/compiler/implementation/dart2js.dart', 54 c('../sdk/lib/_internal/compiler/implementation/dart2js.dart',
52 '///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe', 55 '///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe',
53 '///c:/Users/person/dart_checkout_for_stuff/dart/sdk/lib/_internal/compiler/ ' 56 '///c:/Users/person/dart_checkout_for_stuff/dart/sdk/lib/_internal/compiler/ '
54 'implementation/dart2js.dart', 57 'implementation/dart2js.dart',
55 true); 58 true);
56 59
57 c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart', 60 c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart',
58 false); 61 false);
59 62
60 c('file.dart', '/Users/person/', '/Users/person/file.dart', null); 63 c('file.dart', '/Users/person/', '/Users/person/file.dart', null);
61 64
62 c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false); 65 c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false);
63 66
64 c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart', 67 c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart',
65 true); 68 true);
69
70 c('out.js.map', '/Users/person/out.js', '/Users/person/out.js.map', null);
71
72 c('../person/out.js.map',
73 '/Users/other/out.js',
74 '/Users/person/out.js.map', false);
75
76 c('/Users/person/out.js.map',
77 '/Users/other/out.js',
78 '/Users/person/out.js.map', true);
79
80 c('out.js', '/Users/person/out.js.map', '/Users/person/out.js', null);
81
82 c('../person/out.js',
83 '/Users/other/out.js.map',
84 '/Users/person/out.js', false);
85
86 c('/Users/person/out.js',
87 '/Users/other/out.js.map',
88 '/Users/person/out.js', true);
89
90 c('out.js', '/out.js.map', '/out.js', null);
91
66 } 92 }
67 93
68 void main() { 94 void main() {
69 testRelativize(); 95 testRelativize();
70 } 96 }
OLDNEW
« tests/compiler/dart2js/source_map_test.dart ('K') | « tests/compiler/dart2js/source_map_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698