Skip to content

Commit a7af48f

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
[cfe] Don't use package:expect in relativize_test
Closes #37777 Change-Id: I749c8e9ff69a65933a3804dd45f0d72ecd80f2fe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112253 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
1 parent 27783bd commit a7af48f

File tree

1 file changed

+57
-60
lines changed

1 file changed

+57
-60
lines changed

pkg/front_end/test/relativize_test.dart

Lines changed: 57 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,84 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import "package:expect/expect.dart";
6-
5+
import 'package:test/test.dart';
76
import 'package:front_end/src/fasta/util/relativize.dart';
87

9-
void testRelativize() {
10-
void c(String expected, String base, String path, bool isWindows) {
11-
if (isWindows == null) {
12-
c(expected, base, path, true);
13-
c(expected, base, path, false);
14-
return;
15-
}
16-
17-
test(Uri base, Uri uri) {
18-
String r = relativizeUri(base, uri, isWindows);
19-
Uri resolved = base.resolve(r);
20-
Expect.equals(uri.scheme.toLowerCase(), resolved.scheme.toLowerCase());
21-
if (isWindows) {
22-
Expect.equals(uri.path.toLowerCase(), resolved.path.toLowerCase());
23-
} else {
24-
Expect.equals(uri.path, resolved.path);
8+
void main() {
9+
test('test relativeUri', () {
10+
void c(String expected, String base, String path, bool isWindows) {
11+
if (isWindows == null) {
12+
c(expected, base, path, true);
13+
c(expected, base, path, false);
14+
return;
2515
}
26-
Expect.stringEquals(expected, r);
27-
}
2816

29-
test(Uri.parse('file:$base'), Uri.parse('file:$path'));
17+
test(Uri base, Uri uri) {
18+
String r = relativizeUri(base, uri, isWindows);
19+
Uri resolved = base.resolve(r);
20+
expect(resolved.scheme.toLowerCase(), uri.scheme.toLowerCase());
21+
if (isWindows) {
22+
expect(resolved.path.toLowerCase(), uri.path.toLowerCase());
23+
} else {
24+
expect(resolved.path, uri.path);
25+
}
26+
expect(r, expected);
27+
}
3028

31-
test(Uri.parse('FILE:$base'), Uri.parse('FILE:$path'));
29+
test(Uri.parse('file:$base'), Uri.parse('file:$path'));
3230

33-
test(Uri.parse('file:$base'), Uri.parse('FILE:$path'));
31+
test(Uri.parse('FILE:$base'), Uri.parse('FILE:$path'));
3432

35-
test(Uri.parse('FILE:$base'), Uri.parse('file:$path'));
36-
}
33+
test(Uri.parse('file:$base'), Uri.parse('FILE:$path'));
3734

38-
c('bar', '/', '/bar', null);
39-
c('bar', '/foo', '/bar', null);
40-
c('/bar', '/foo/', '/bar', null);
35+
test(Uri.parse('FILE:$base'), Uri.parse('file:$path'));
36+
}
4137

42-
c('bar', '///c:/', '///c:/bar', true);
43-
c('bar', '///c:/foo', '///c:/bar', true);
44-
c('/c:/bar', '///c:/foo/', '///c:/bar', true);
38+
c('bar', '/', '/bar', null);
39+
c('bar', '/foo', '/bar', null);
40+
c('/bar', '/foo/', '/bar', null);
4541

46-
c('BAR', '///c:/', '///c:/BAR', true);
47-
c('BAR', '///c:/foo', '///c:/BAR', true);
48-
c('/c:/BAR', '///c:/foo/', '///c:/BAR', true);
42+
c('bar', '///c:/', '///c:/bar', true);
43+
c('bar', '///c:/foo', '///c:/bar', true);
44+
c('/c:/bar', '///c:/foo/', '///c:/bar', true);
4945

50-
c(
51-
'../sdk/lib/_internal/compiler/implementation/dart2js.dart',
52-
'///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe',
53-
'///c:/Users/person/dart_checkout_for_stuff/dart/sdk/lib/_internal/compiler/'
54-
'implementation/dart2js.dart',
55-
true);
46+
c('BAR', '///c:/', '///c:/BAR', true);
47+
c('BAR', '///c:/foo', '///c:/BAR', true);
48+
c('/c:/BAR', '///c:/foo/', '///c:/BAR', true);
5649

57-
c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart',
58-
false);
50+
c(
51+
'../sdk/lib/_internal/compiler/implementation/dart2js.dart',
52+
'///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe',
53+
'///c:/Users/person/dart_checkout_for_stuff/dart/sdk/lib/_internal/compiler/'
54+
'implementation/dart2js.dart',
55+
true);
5956

60-
c('file.dart', '/Users/person/', '/Users/person/file.dart', null);
57+
c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart',
58+
false);
6159

62-
c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false);
60+
c('file.dart', '/Users/person/', '/Users/person/file.dart', null);
6361

64-
c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart',
65-
true);
62+
c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false);
6663

67-
c('out.js.map', '/Users/person/out.js', '/Users/person/out.js.map', null);
64+
c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart',
65+
true);
6866

69-
c('../person/out.js.map', '/Users/other/out.js', '/Users/person/out.js.map',
70-
false);
67+
c('out.js.map', '/Users/person/out.js', '/Users/person/out.js.map', null);
7168

72-
c('/Users/person/out.js.map', '/Users/other/out.js',
73-
'/Users/person/out.js.map', true);
69+
c('../person/out.js.map', '/Users/other/out.js', '/Users/person/out.js.map',
70+
false);
7471

75-
c('out.js', '/Users/person/out.js.map', '/Users/person/out.js', null);
72+
c('/Users/person/out.js.map', '/Users/other/out.js',
73+
'/Users/person/out.js.map', true);
7674

77-
c('../person/out.js', '/Users/other/out.js.map', '/Users/person/out.js',
78-
false);
75+
c('out.js', '/Users/person/out.js.map', '/Users/person/out.js', null);
7976

80-
c('/Users/person/out.js', '/Users/other/out.js.map', '/Users/person/out.js',
81-
true);
77+
c('../person/out.js', '/Users/other/out.js.map', '/Users/person/out.js',
78+
false);
8279

83-
c('out.js', '/out.js.map', '/out.js', null);
84-
}
80+
c('/Users/person/out.js', '/Users/other/out.js.map', '/Users/person/out.js',
81+
true);
8582

86-
void main() {
87-
testRelativize();
83+
c('out.js', '/out.js.map', '/out.js', null);
84+
});
8885
}

0 commit comments

Comments
 (0)