Skip to content

Commit e79a142

Browse files
munificentCommit Queue
authored andcommitted
Reformat tests/corelib with the 3.8 style.
There is another batch of style changes coming out in 3.8, so I'm going through and reformatting the SDK again. (Well, I didn't finish the reformat the first time, so not fully "again", I guess.) Change-Id: I83d9809fc0da71010c0ef567c208981df68c351c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425201 Commit-Queue: Lasse Nielsen <[email protected]> Reviewed-by: Lasse Nielsen <[email protected]> Auto-Submit: Bob Nystrom <[email protected]>
1 parent b0d2e1d commit e79a142

23 files changed

+182
-196
lines changed

tests/corelib/bitops_unsigned_js_test.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,14 +1753,14 @@ void main() {
17531753
Expect.equals(0x0, 0x100000000 >>> 0xffffffff);
17541754
Expect.equals(0x0, 0x100000000 >>> 0x100000000);
17551755

1756-
Expect.equals(0xffffffff, ~ -0x100000000);
1757-
Expect.equals(0xfffffffe, ~ -0xffffffff);
1758-
Expect.equals(0xfffffffd, ~ -0xfffffffe);
1759-
Expect.equals(0xfedcba97, ~ -0xfedcba98);
1760-
Expect.equals(0xbd217c, ~ -0xbd217d);
1761-
Expect.equals(0x9, ~ -0xa);
1762-
Expect.equals(0x1, ~ -0x2);
1763-
Expect.equals(0x0, ~ -0x1);
1756+
Expect.equals(0xffffffff, ~-0x100000000);
1757+
Expect.equals(0xfffffffe, ~-0xffffffff);
1758+
Expect.equals(0xfffffffd, ~-0xfffffffe);
1759+
Expect.equals(0xfedcba97, ~-0xfedcba98);
1760+
Expect.equals(0xbd217c, ~-0xbd217d);
1761+
Expect.equals(0x9, ~-0xa);
1762+
Expect.equals(0x1, ~-0x2);
1763+
Expect.equals(0x0, ~-0x1);
17641764
Expect.equals(0xffffffff, ~0x0);
17651765
Expect.equals(0xfffffffe, ~0x1);
17661766
Expect.equals(0xfffffffd, ~0x2);

tests/corelib/bool_operator_test.dart

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,27 @@ main() {
88
void test(bool b1, bool b2) {
99
var and1 = b1 && b2;
1010
var and2 = b1 & b2;
11-
var and3 =
12-
b1
13-
? b2
14-
? true
15-
: false
16-
: false;
11+
var and3 = b1
12+
? b2
13+
? true
14+
: false
15+
: false;
1716
var or1 = b1 || b2;
1817
var or2 = b1 | b2;
19-
var or3 =
20-
b1
21-
? true
22-
: b2
23-
? true
24-
: false;
18+
var or3 = b1
19+
? true
20+
: b2
21+
? true
22+
: false;
2523
var xor1 = b1 != b2;
2624
var xor2 = b1 ^ b2;
27-
var xor3 =
28-
b1
29-
? b2
30-
? false
31-
: true
32-
: b2
33-
? true
34-
: false;
25+
var xor3 = b1
26+
? b2
27+
? false
28+
: true
29+
: b2
30+
? true
31+
: false;
3532
var nb1 = !b1;
3633
var nb2 = !b2;
3734
Expect.equals(and3, and1);

tests/corelib/collection_to_string_test.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ void smokeTest() {
103103
void exactTest() {
104104
for (int i = 0; i < NUM_TESTS; i++) {
105105
// Choose a size from 0 to MAX_COLLECTION_SIZE, favoring larger sizes
106-
int size =
107-
Math.sqrt(random(MAX_COLLECTION_SIZE * MAX_COLLECTION_SIZE)).toInt();
106+
int size = Math.sqrt(
107+
random(MAX_COLLECTION_SIZE * MAX_COLLECTION_SIZE),
108+
).toInt();
108109

109110
StringBuffer stringRep = new StringBuffer();
110111
Object o = randomCollection(size, stringRep, exact: true);
@@ -128,8 +129,9 @@ void exactTest() {
128129
void inexactTest() {
129130
for (int i = 0; i < NUM_TESTS; i++) {
130131
// Choose a size from 0 to MAX_COLLECTION_SIZE, favoring larger sizes
131-
int size =
132-
Math.sqrt(random(MAX_COLLECTION_SIZE * MAX_COLLECTION_SIZE)).toInt();
132+
int size = Math.sqrt(
133+
random(MAX_COLLECTION_SIZE * MAX_COLLECTION_SIZE),
134+
).toInt();
133135

134136
StringBuffer stringRep = new StringBuffer();
135137
Object o = randomCollection(size, stringRep, exact: false);

tests/corelib/data_uri_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void testMediaType() {
7171
);
7272
expectedMimeType =
7373
(mimeType.isEmpty || mimeType.toLowerCase() == "text/plain")
74-
? "text/plain"
75-
: mimeType;
74+
? "text/plain"
75+
: mimeType;
7676
expectedEncoding = encoding;
7777
expectedCharset = expectedEncoding?.name ?? "US-ASCII";
7878
var expectedText =

tests/corelib/hash_map2_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ testMap(Map newMap(), Map newMapFrom(Map map)) {
7272

7373
{
7474
// Check concurrent modification
75-
Map map =
76-
newMap()
77-
..[0] = 0
78-
..[1] = 1;
75+
Map map = newMap()
76+
..[0] = 0
77+
..[1] = 1;
7978

8079
{
8180
// Test adding before a moveNext.

tests/corelib/hash_set_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ testSet(Set newSet(), Set newSetFrom(Iterable from)) {
6666

6767
{
6868
// Check concurrent modification
69-
Set set =
70-
newSet()
71-
..add(0)
72-
..add(1);
69+
Set set = newSet()
70+
..add(0)
71+
..add(1);
7372

7473
{
7574
// Test adding before a moveNext.

tests/corelib/integer_parsed_arith_vm_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ library integer_arithmetic_test;
1010

1111
import "package:expect/expect.dart";
1212

13-
String toHexString(int value) =>
14-
value >= 0
15-
? "0x${value.toRadixString(16)}"
16-
: "-0x${value.toRadixString(16).substring(1)}";
13+
String toHexString(int value) => value >= 0
14+
? "0x${value.toRadixString(16)}"
15+
: "-0x${value.toRadixString(16).substring(1)}";
1716

1817
addSubParsed(String a, String b, String sum) {
1918
int int_a = int.parse(a);

tests/corelib/integer_parsed_mul_div_vm_test.dart

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,25 @@ mulDivParsed(
2222
int int_product = int.parse(product);
2323
int computed_product = int_a * int_b;
2424
Expect.equals(int_product, computed_product);
25-
String str_product =
26-
computed_product >= 0
27-
? "0x${computed_product.toRadixString(16)}"
28-
: "-0x${(-computed_product).toRadixString(16)}";
25+
String str_product = computed_product >= 0
26+
? "0x${computed_product.toRadixString(16)}"
27+
: "-0x${(-computed_product).toRadixString(16)}";
2928
Expect.equals(product.toLowerCase(), str_product);
3029
int computed_product2 = int_b * int_a;
3130
Expect.equals(int_product, computed_product2);
32-
String str_product2 =
33-
computed_product2 >= 0
34-
? "0x${computed_product2.toRadixString(16)}"
35-
: "-0x${(-computed_product2).toRadixString(16)}";
31+
String str_product2 = computed_product2 >= 0
32+
? "0x${computed_product2.toRadixString(16)}"
33+
: "-0x${(-computed_product2).toRadixString(16)}";
3634
Expect.equals(product.toLowerCase(), str_product2);
3735

3836
if (int_a != 0) {
3937
expected_quotient1 ??= b;
4038
int int_expected_quotient1 = int.parse(expected_quotient1);
4139
int computed_quotient1 = int_product ~/ int_a;
4240
Expect.equals(int_expected_quotient1, computed_quotient1);
43-
String str_quotient1 =
44-
computed_quotient1 >= 0
45-
? "0x${computed_quotient1.toRadixString(16)}"
46-
: "-0x${(-computed_quotient1).toRadixString(16)}";
41+
String str_quotient1 = computed_quotient1 >= 0
42+
? "0x${computed_quotient1.toRadixString(16)}"
43+
: "-0x${(-computed_quotient1).toRadixString(16)}";
4744
Expect.equals(expected_quotient1.toLowerCase(), str_quotient1);
4845
}
4946

@@ -52,10 +49,9 @@ mulDivParsed(
5249
int int_expected_quotient2 = int.parse(expected_quotient2);
5350
int computed_quotient2 = int_product ~/ int_b;
5451
Expect.equals(int_expected_quotient2, computed_quotient2);
55-
String str_quotient2 =
56-
computed_quotient2 >= 0
57-
? "0x${computed_quotient2.toRadixString(16)}"
58-
: "-0x${(-computed_quotient2).toRadixString(16)}";
52+
String str_quotient2 = computed_quotient2 >= 0
53+
? "0x${computed_quotient2.toRadixString(16)}"
54+
: "-0x${(-computed_quotient2).toRadixString(16)}";
5955
Expect.equals(expected_quotient2.toLowerCase(), str_quotient2);
6056
}
6157
}

tests/corelib/iterable_extension_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,4 +415,5 @@ class CurrentThrowIterator<T> implements Iterator<T> {
415415
bool none(_) => false;
416416
bool all(_) => true;
417417
bool even(int n) => n.isEven;
418-
bool Function(int) only(int n1) => (int n2) => n1 == n2;
418+
bool Function(int) only(int n1) =>
419+
(int n2) => n1 == n2;

tests/corelib/iterable_fold_test.dart

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -217,28 +217,24 @@ main() {
217217
testModification([3, 2, 1], add4, (x) => x.reversed);
218218
testModification({1: 1, 2: 2, 3: 3}, put4, (x) => x.keys);
219219
testModification({1: 1, 2: 2, 3: 3}, put4, (x) => x.values);
220-
var hashMap =
221-
new HashMap()
222-
..[1] = 1
223-
..[2] = 2
224-
..[3] = 3;
220+
var hashMap = new HashMap()
221+
..[1] = 1
222+
..[2] = 2
223+
..[3] = 3;
225224
testModification(hashMap, put4, (x) => x.keys);
226-
hashMap =
227-
new HashMap()
228-
..[1] = 1
229-
..[2] = 2
230-
..[3] = 3;
225+
hashMap = new HashMap()
226+
..[1] = 1
227+
..[2] = 2
228+
..[3] = 3;
231229
testModification(hashMap, put4, (x) => x.values);
232-
var splayMap =
233-
new SplayTreeMap()
234-
..[1] = 1
235-
..[2] = 2
236-
..[3] = 3;
230+
var splayMap = new SplayTreeMap()
231+
..[1] = 1
232+
..[2] = 2
233+
..[3] = 3;
237234
testModification(splayMap, put4, (x) => x.keys);
238-
splayMap =
239-
new SplayTreeMap()
240-
..[1] = 1
241-
..[2] = 2
242-
..[3] = 3;
235+
splayMap = new SplayTreeMap()
236+
..[1] = 1
237+
..[2] = 2
238+
..[3] = 3;
243239
testModification(splayMap, put4, (x) => x.values);
244240
}

0 commit comments

Comments
 (0)