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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 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
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 'package:compiler/src/util/uri_extras.dart'; 7 import 'package:compiler/src/util/uri_extras.dart';
8 8
9
10 void testRelativize() { 9 void testRelativize() {
11 void c(String expected, String base, String path, bool isWindows) { 10 void c(String expected, String base, String path, bool isWindows) {
12 if (isWindows == null) { 11 if (isWindows == null) {
13 c(expected, base, path, true); 12 c(expected, base, path, true);
14 c(expected, base, path, false); 13 c(expected, base, path, false);
15 return; 14 return;
16 } 15 }
17 16
18 test(Uri base, Uri uri) { 17 test(Uri base, Uri uri) {
19 String r = relativize(base, uri, isWindows); 18 String r = relativize(base, uri, isWindows);
20 Uri resolved = base.resolve(r); 19 Uri resolved = base.resolve(r);
21 Expect.equals(uri.scheme.toLowerCase(), resolved.scheme.toLowerCase()); 20 Expect.equals(uri.scheme.toLowerCase(), resolved.scheme.toLowerCase());
22 if (isWindows) { 21 if (isWindows) {
23 Expect.equals(uri.path.toLowerCase(), resolved.path.toLowerCase()); 22 Expect.equals(uri.path.toLowerCase(), resolved.path.toLowerCase());
24 } else { 23 } else {
25 Expect.equals(uri.path, resolved.path); 24 Expect.equals(uri.path, resolved.path);
26 } 25 }
27 Expect.stringEquals(expected, r); 26 Expect.stringEquals(expected, r);
28 } 27 }
29 28
30 test(Uri.parse('file:$base'), 29 test(Uri.parse('file:$base'), Uri.parse('file:$path'));
31 Uri.parse('file:$path'));
32 30
33 test(Uri.parse('FILE:$base'), 31 test(Uri.parse('FILE:$base'), Uri.parse('FILE:$path'));
34 Uri.parse('FILE:$path'));
35 32
36 test(Uri.parse('file:$base'), 33 test(Uri.parse('file:$base'), Uri.parse('FILE:$path'));
37 Uri.parse('FILE:$path'));
38 34
39 test(Uri.parse('FILE:$base'), 35 test(Uri.parse('FILE:$base'), Uri.parse('file:$path'));
40 Uri.parse('file:$path'));
41 } 36 }
37
42 c('bar', '/', '/bar', null); 38 c('bar', '/', '/bar', null);
43 c('bar', '/foo', '/bar', null); 39 c('bar', '/foo', '/bar', null);
44 c('/bar', '/foo/', '/bar', null); 40 c('/bar', '/foo/', '/bar', null);
45 41
46 c('bar', '///c:/', '///c:/bar', true); 42 c('bar', '///c:/', '///c:/bar', true);
47 c('bar', '///c:/foo', '///c:/bar', true); 43 c('bar', '///c:/foo', '///c:/bar', true);
48 c('/c:/bar', '///c:/foo/', '///c:/bar', true); 44 c('/c:/bar', '///c:/foo/', '///c:/bar', true);
49 45
50 c('BAR', '///c:/', '///c:/BAR', true); 46 c('BAR', '///c:/', '///c:/BAR', true);
51 c('BAR', '///c:/foo', '///c:/BAR', true); 47 c('BAR', '///c:/foo', '///c:/BAR', true);
52 c('/c:/BAR', '///c:/foo/', '///c:/BAR', true); 48 c('/c:/BAR', '///c:/foo/', '///c:/BAR', true);
53 49
54 c('../sdk/lib/_internal/compiler/implementation/dart2js.dart', 50 c(
55 '///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe', 51 '../sdk/lib/_internal/compiler/implementation/dart2js.dart',
56 '///c:/Users/person/dart_checkout_for_stuff/dart/sdk/lib/_internal/compiler/ ' 52 '///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe',
57 'implementation/dart2js.dart', 53 '///c:/Users/person/dart_checkout_for_stuff/dart/sdk/lib/_internal/compile r/'
58 true); 54 'implementation/dart2js.dart',
55 true);
59 56
60 c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart', 57 c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart',
61 false); 58 false);
62 59
63 c('file.dart', '/Users/person/', '/Users/person/file.dart', null); 60 c('file.dart', '/Users/person/', '/Users/person/file.dart', null);
64 61
65 c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false); 62 c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false);
66 63
67 c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart', 64 c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart',
68 true); 65 true);
69 66
70 c('out.js.map', '/Users/person/out.js', '/Users/person/out.js.map', null); 67 c('out.js.map', '/Users/person/out.js', '/Users/person/out.js.map', null);
71 68
72 c('../person/out.js.map', 69 c('../person/out.js.map', '/Users/other/out.js', '/Users/person/out.js.map',
73 '/Users/other/out.js', 70 false);
74 '/Users/person/out.js.map', false);
75 71
76 c('/Users/person/out.js.map', 72 c('/Users/person/out.js.map', '/Users/other/out.js',
77 '/Users/other/out.js', 73 '/Users/person/out.js.map', true);
78 '/Users/person/out.js.map', true);
79 74
80 c('out.js', '/Users/person/out.js.map', '/Users/person/out.js', null); 75 c('out.js', '/Users/person/out.js.map', '/Users/person/out.js', null);
81 76
82 c('../person/out.js', 77 c('../person/out.js', '/Users/other/out.js.map', '/Users/person/out.js',
83 '/Users/other/out.js.map', 78 false);
84 '/Users/person/out.js', false);
85 79
86 c('/Users/person/out.js', 80 c('/Users/person/out.js', '/Users/other/out.js.map', '/Users/person/out.js',
87 '/Users/other/out.js.map', 81 true);
88 '/Users/person/out.js', true);
89 82
90 c('out.js', '/out.js.map', '/out.js', null); 83 c('out.js', '/out.js.map', '/out.js', null);
91
92 } 84 }
93 85
94 void main() { 86 void main() {
95 testRelativize(); 87 testRelativize();
96 } 88 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/unused_empty_map_test.dart ('k') | tests/compiler/dart2js/uri_retention_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698