Skip to content

Commit bf2b545

Browse files
committed
Revert "Update all tests"
This reverts commit ce76e9c30beaf9a193d3677b88c20a1ebb3fae8c.
1 parent f486a21 commit bf2b545

File tree

978 files changed

+9392
-9402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

978 files changed

+9392
-9402
lines changed

pkg/dev_compiler/test/multitest.dart

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ final validMultitestOutcomes = new Set<String>.from([
1515
'checked mode compile-time error'
1616
]);
1717

18-
// Require at least one non-space character before '//#'
19-
// Handle both //# and the legacy /// multitest regexp patterns.
20-
final _multiTestRegExp = new RegExp(r"\S *//[#/] \w+:(.*)");
21-
22-
final _multiTestRegExpSeperator = new RegExp(r"//[#/]");
18+
// Require at least one non-space character before '///'
19+
final _multiTestRegExp = new RegExp(r"\S */// \w+:(.*)");
2320

2421
bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
2522

@@ -40,10 +37,10 @@ bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
4037
//
4138
// For example: file I_am_a_multitest.dart
4239
// aaa
43-
// bbb //# 02: runtime error
44-
// ccc //# 02: continued
45-
// ddd //# 07: static type warning
46-
// eee //# 10: ok
40+
// bbb /// 02: runtime error
41+
// ccc /// 02: continued
42+
// ddd /// 07: static type warning
43+
// eee /// 10: ok
4744
// fff
4845
//
4946
// should create four tests:
@@ -53,24 +50,24 @@ bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
5350
//
5451
// I_am_a_multitest_02.dart
5552
// aaa
56-
// bbb //# 02: runtime error
57-
// ccc //# 02: continued
53+
// bbb /// 02: runtime error
54+
// ccc /// 02: continued
5855
// fff
5956
//
6057
// I_am_a_multitest_07.dart
6158
// aaa
62-
// ddd //# 07: static type warning
59+
// ddd /// 07: static type warning
6360
// fff
6461
//
6562
// and I_am_a_multitest_10.dart
6663
// aaa
67-
// eee //# 10: ok
64+
// eee /// 10: ok
6865
// fff
6966
//
7067
// Note that it is possible to indicate more than one acceptable outcome
7168
// in the case of dynamic and static type warnings
7269
// aaa
73-
// ddd //# 07: static type warning, dynamic type error
70+
// ddd /// 07: static type warning, dynamic type error
7471
// fff
7572

7673
void extractTestsFromMultitest(String filePath, String contents,
@@ -145,7 +142,7 @@ void extractTestsFromMultitest(String filePath, String contents,
145142
}
146143
}
147144

148-
// Represents a mutlitest annotation in the special //# comment.
145+
// Represents a mutlitest annotation in the special /// comment.
149146
class _Annotation {
150147
String key;
151148
String rest;
@@ -154,11 +151,11 @@ class _Annotation {
154151
factory _Annotation.from(String line) {
155152
// Do an early return with "null" if this is not a valid multitest
156153
// annotation.
157-
if (!line.contains(_multiTestRegExpSeperator)) {
154+
if (!line.contains('///')) {
158155
return null;
159156
}
160157
var parts = line
161-
.split(_multiTestRegExpSeperator)[1]
158+
.split('///')[1]
162159
.split(':')
163160
.map((s) => s.trim())
164161
.where((s) => s.length > 0)

pkg/testing/lib/src/multitest.dart

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44

55
library testing.multitest;
66

7-
import 'dart:async' show Stream, StreamTransformer;
7+
import 'dart:async' show
8+
Stream,
9+
StreamTransformer;
810

9-
import 'dart:io' show Directory, File;
11+
import 'dart:io' show
12+
Directory,
13+
File;
1014

11-
import 'log.dart' show splitLines;
15+
import 'log.dart' show
16+
splitLines;
1217

13-
import 'test_description.dart' show TestDescription;
18+
import 'test_description.dart' show
19+
TestDescription;
1420

1521
bool isError(Set<String> expectations) {
1622
if (expectations.contains("compile-time error")) return true;
@@ -26,17 +32,16 @@ bool isCheckedModeError(Set<String> expectations) {
2632

2733
class MultitestTransformer
2834
implements StreamTransformer<TestDescription, TestDescription> {
29-
static RegExp multitestMarker = new RegExp(r"//[#/]");
30-
static int _multitestMarkerLength = 3;
35+
static const String multitestMarker = "///";
3136

3237
static const List<String> validOutcomesList = const <String>[
33-
"ok",
34-
"compile-time error",
35-
"runtime error",
36-
"static type warning",
37-
"dynamic type error",
38-
"checked mode compile-time error",
39-
];
38+
"ok",
39+
"compile-time error",
40+
"runtime error",
41+
"static type warning",
42+
"dynamic type error",
43+
"checked mode compile-time error",
44+
];
4045

4146
static final Set<String> validOutcomes =
4247
new Set<String>.from(validOutcomesList);
@@ -47,9 +52,7 @@ class MultitestTransformer
4752
errors.add(error);
4853
print(error);
4954
}
50-
51-
nextTest:
52-
await for (TestDescription test in stream) {
55+
nextTest: await for (TestDescription test in stream) {
5356
String contents = await test.file.readAsString();
5457
if (!contents.contains(multitestMarker)) {
5558
yield test;
@@ -71,23 +74,20 @@ class MultitestTransformer
7174
List<String> subtestOutcomesList;
7275
if (index != -1) {
7376
String annotationText =
74-
line.substring(index + _multitestMarkerLength).trim();
77+
line.substring(index + multitestMarker.length).trim();
7578
index = annotationText.indexOf(":");
7679
if (index != -1) {
7780
subtestName = annotationText.substring(0, index).trim();
78-
subtestOutcomesList = annotationText
79-
.substring(index + 1)
80-
.split(",")
81-
.map((s) => s.trim())
82-
.toList();
81+
subtestOutcomesList = annotationText.substring(index + 1).split(",")
82+
.map((s) => s.trim()).toList();
8383
if (subtestName == "none") {
8484
reportError(test.formatError(
85-
"$lineNumber: $subtestName can't be used as test name."));
85+
"$lineNumber: $subtestName can't be used as test name."));
8686
continue nextTest;
8787
}
8888
if (subtestOutcomesList.isEmpty) {
89-
reportError(test
90-
.formatError("$lineNumber: Expected <testname>:<outcomes>"));
89+
reportError(test.formatError(
90+
"$lineNumber: Expected <testname>:<outcomes>"));
9191
continue nextTest;
9292
}
9393
}
@@ -96,16 +96,16 @@ class MultitestTransformer
9696
List<String> lines = testsAsLines.putIfAbsent(subtestName,
9797
() => new List<String>.from(linesWithoutAnnotations));
9898
lines.add(line);
99-
Set<String> subtestOutcomes =
100-
outcomes.putIfAbsent(subtestName, () => new Set<String>());
99+
Set<String> subtestOutcomes = outcomes.putIfAbsent(subtestName,
100+
() => new Set<String>());
101101
if (subtestOutcomesList.length != 1 ||
102102
subtestOutcomesList.single != "continued") {
103103
for (String outcome in subtestOutcomesList) {
104104
if (validOutcomes.contains(outcome)) {
105105
subtestOutcomes.add(outcome);
106106
} else {
107107
reportError(test.formatError(
108-
"$lineNumber: '$outcome' isn't a recognized outcome."));
108+
"$lineNumber: '$outcome' isn't a recognized outcome."));
109109
continue nextTest;
110110
}
111111
}

tests/compiler/dart2js_extra/23486_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class B {
1616

1717
class A extends B {
1818
m() {
19-
(super).field = 1; //# 01: compile-time error
19+
(super).field = 1; /// 01: compile-time error
2020
}
2121
}
2222

@@ -27,12 +27,12 @@ class C {
2727

2828
class D extends C {
2929
D() : super();
30-
D.name() : (super).name(); //# 02: compile-time error
30+
D.name() : (super).name(); /// 02: compile-time error
3131
}
3232

3333
main() {
34-
Expect.throws(new A().m); // //# 01: continued
35-
Expect.throws(() => new D.name()); //# 02: continued
36-
Expect.throws(() => (p).x); // //# 03: compile-time error
34+
Expect.throws(new A().m); // /// 01: continued
35+
Expect.throws(() => new D.name()); /// 02: continued
36+
Expect.throws(() => (p).x); // /// 03: compile-time error
3737
}
3838

tests/compiler/dart2js_extra/LayoutTests_fast_mediastream_getusermedia_t01_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ foo() {}
1010

1111
gotStream1(stream) {
1212
foo()
13-
. //# 01: compile-time error
13+
. /// 01: compile-time error
1414
.then();
1515
}
1616

tests/compiler/dart2js_extra/basic_class_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ void main() {
1717
B b;
1818
a = a;
1919
a = subA;
20-
a = b; //# 01: static type warning
20+
a = b; /// 01: static type warning
2121
subA = a;
2222
subA = subA;
23-
subA = b; //# 02: static type warning
24-
b = a; //# 03: static type warning
25-
b = subA; //# 04: static type warning
23+
subA = b; /// 02: static type warning
24+
b = a; /// 03: static type warning
25+
b = subA; /// 04: static type warning
2626
b = b;
2727
}

tests/compiler/dart2js_extra/bounds_check_test.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
main() {
66
var a = [0, 1];
7-
a[-1]; // //# 01: runtime error
8-
a[-1] = 4; // //# 02: runtime error
9-
a[2]; // //# 03: runtime error
10-
a[2] = 4; // //# 04: runtime error
11-
checkIndex(a, -1); // //# 05: runtime error
12-
checkIndexedAssignment(a, -1); // //# 06: runtime error
13-
checkIndex(a, 2); // //# 07: runtime error
14-
checkIndexedAssignment(a, 2); // //# 08: runtime error
7+
a[-1]; // /// 01: runtime error
8+
a[-1] = 4; // /// 02: runtime error
9+
a[2]; // /// 03: runtime error
10+
a[2] = 4; // /// 04: runtime error
11+
checkIndex(a, -1); // /// 05: runtime error
12+
checkIndexedAssignment(a, -1); // /// 06: runtime error
13+
checkIndex(a, 2); // /// 07: runtime error
14+
checkIndexedAssignment(a, 2); // /// 08: runtime error
1515
checkIndex(a, 0);
1616
checkIndexedAssignment(a, 0);
1717
}

tests/compiler/dart2js_extra/compile_time_constant4_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ const g1 = x
1010
+ "bar"
1111
;
1212
const g2 = x
13-
+ null // //# 01: compile-time error
13+
+ null // /// 01: compile-time error
1414
;
1515
const g3 = x
16-
+ 499 // //# 02: compile-time error
16+
+ 499 // /// 02: compile-time error
1717
;
1818
const g4 = x
19-
+ 3.3 // //# 03: compile-time error
19+
+ 3.3 // /// 03: compile-time error
2020
;
2121
const g5 = x
22-
+ true // //# 04: compile-time error
22+
+ true // /// 04: compile-time error
2323
;
2424
const g6 = x
25-
+ false // //# 05: compile-time error
25+
+ false // /// 05: compile-time error
2626
;
2727
const g7 = "foo"
28-
+ x[0] // //# 06: compile-time error
28+
+ x[0] // /// 06: compile-time error
2929
;
3030
const g8 = 1
3131
+ x.length

tests/compiler/dart2js_extra/constant_javascript_semantics_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const y = 12345678901234567890;
1111
const z = x - y;
1212

1313
const a = 1.0;
14-
const b = a << 3; // //# 01: compile-time error
14+
const b = a << 3; // /// 01: compile-time error
1515

1616
const c = -0.0;
17-
const d = c << 1; // //# 02: compile-time error
17+
const d = c << 1; // /// 02: compile-time error
1818

1919
foo() => 12345678901234567891 - 12345678901234567890;
2020

@@ -24,11 +24,11 @@ main() {
2424
Expect.equals(0, foo());
2525
Expect.isTrue(x is double);
2626
Expect.isTrue(x is int);
27-
Expect.equals(8, b); // //# 01: continued
28-
Expect.equals(8, 1.0 << 3); // //# 03: static type warning
27+
Expect.equals(8, b); // /// 01: continued
28+
Expect.equals(8, 1.0 << 3); // /// 03: static type warning
2929
Expect.isTrue(1 == 1.0);
30-
Expect.equals(0, d); // //# 02: continued
31-
Expect.equals(0, -0.0 << 1); // //# 04: static type warning
30+
Expect.equals(0, d); // /// 02: continued
31+
Expect.equals(0, -0.0 << 1); // /// 04: static type warning
3232
// Make sure the 1 is not shifted into the 32 bit range.
3333
Expect.equals(0, 0x100000000 >> 3);
3434
// The dynamic int-check also allows -0.0.

tests/compiler/dart2js_extra/int_index_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
main() {
66
var a = [0, 1];
7-
a[1.2]; // //# 01: runtime error
8-
a[1.2] = 4; // //# 02: runtime error
9-
checkIndex(a, 1.4); //# 03: runtime error
10-
checkIndexedAssignment(a, 1.4); //# 04: runtime error
7+
a[1.2]; // /// 01: runtime error
8+
a[1.2] = 4; // /// 02: runtime error
9+
checkIndex(a, 1.4); /// 03: runtime error
10+
checkIndexedAssignment(a, 1.4); /// 04: runtime error
1111
checkIndex(a, 0);
1212
checkIndexedAssignment(a, 0);
1313
}

tests/compiler/dart2js_extra/invalid_annotation2_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import 'dart:mirrors';
1515

1616
@Deprecated("m"
17-
,, // //# 01: compile-time error
17+
,, // /// 01: compile-time error
1818
)
1919
class A {
2020
}

0 commit comments

Comments
 (0)