Skip to content

Commit

Permalink
#2119. Run dart formatter on LibTest/async tests (#2417)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Dec 7, 2023
1 parent dc603a5 commit 579fed7
Show file tree
Hide file tree
Showing 354 changed files with 2,228 additions and 2,532 deletions.
4 changes: 3 additions & 1 deletion LibTest/async/Completer/Completer.sync_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ main() {
Completer completer = new Completer.sync();
Future f = completer.future;
var value;
f.then((v) {value = v;});
f.then((v) {
value = v;
});
completer.complete(cv);
Expect.identical(cv, value);
}
4 changes: 2 additions & 2 deletions LibTest/async/Completer/Completer_class_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import "dart:async";
Object create() => new Completer();

List<Object> createEqual(int number) =>
new List.filled(number, new Completer(), growable:false);
new List.filled(number, new Completer(), growable: false);

List<Object> createNonEqual(int number) =>
new List.generate(number, (_) => new Completer(), growable:false);
new List.generate(number, (_) => new Completer(), growable: false);

main() {
object.test(create, createEqual, createNonEqual);
Expand Down
16 changes: 7 additions & 9 deletions LibTest/async/Completer/completeError_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "../../../Utils/expect.dart";
import "dart:async";

List<Future<dynamic>> futures = [];
int count=0;
int count = 0;

check(value) {
var completer = new Completer();
Expand All @@ -23,14 +23,12 @@ check(value) {
completer.completeError(value);

asyncStart();
futures.add(future.then(
(fValue) => Expect.fail('should not get here'),
onError: (Object asyncError) {
Expect.equals(value, asyncError);
count++;
asyncEnd();
}
));
futures.add(future.then((fValue) => Expect.fail('should not get here'),
onError: (Object asyncError) {
Expect.equals(value, asyncError);
count++;
asyncEnd();
}));
}

main() {
Expand Down
5 changes: 2 additions & 3 deletions LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ import 'DeferredLibrary_A01_t01.lib.dart' deferred as lazy;
void main() {
try {
lazy.method(); // foo is not loaded yet.
} on NoSuchMethodError catch(_) {
}
} on NoSuchMethodError catch (_) {}
asyncStart();
lazy.loadLibrary().then(onFooLoaded);
}

void onFooLoaded(_) {
String name=lazy.method();
String name = lazy.method();
Expect.equals('DeferredLibrary_A01_t01.lib', name);
asyncEnd();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
/// @description Checks that DeferredLibrary loads in lazy way.
/// @author kaigorodov

library DeferredLibrary_A01_t01.lib;

String method() {
return "DeferredLibrary_A01_t01.lib";
return "DeferredLibrary_A01_t01.lib";
}
2 changes: 1 addition & 1 deletion LibTest/async/EventSink/EventSink_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/// @author ngl@unipro.ru
library EventSink_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -16,4 +17,3 @@ test(EventSink create()) {
Expect.isTrue(es is EventSink);
Expect.runtimeIsType<EventSink>(es);
}

8 changes: 3 additions & 5 deletions LibTest/async/EventSink/addError_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/// @author ngl@unipro.ru
library addError_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -21,11 +22,9 @@ test(EventSink create()) {

sc.stream.listen((value) {
Expect.fail("Should not be here: $value");
},
onError: (error, StackTrace st) {
}, onError: (error, StackTrace st) {
Expect.equals(values[i++], error);
},
onDone: () {
}, onDone: () {
asyncEnd();
});

Expand All @@ -36,4 +35,3 @@ test(EventSink create()) {
sc.close();
}
}

8 changes: 3 additions & 5 deletions LibTest/async/EventSink/add_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/// @author ngl@unipro.ru
library add_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -21,11 +22,9 @@ test(EventSink create()) {

sc.stream.listen((value) {
Expect.equals(values[i++], value);
},
onError: (error) {
}, onError: (error) {
Expect.fail("Should not be here: $error");
},
onDone: () {
}, onDone: () {
asyncEnd();
});

Expand All @@ -36,4 +35,3 @@ test(EventSink create()) {
sc.close();
}
}

1 change: 1 addition & 0 deletions LibTest/async/EventSink/all_tests.lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/// @author ngl@unipro.ru
library all_tests_eventsink;

import "dart:async";

import "../../../Utils/expect.dart";
Expand Down
8 changes: 3 additions & 5 deletions LibTest/async/EventSink/close_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/// @author ngl@unipro.ru
library close_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -22,11 +23,9 @@ test(EventSink create()) {

sc.stream.listen((value) {
Expect.equals(values[i++], value);
},
onError: (error, StackTrace st) {
}, onError: (error, StackTrace st) {
Expect.equals(values[i++], error);
},
onDone: () {
}, onDone: () {
asyncEnd();
});

Expand All @@ -47,4 +46,3 @@ test(EventSink create()) {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/// @author ngl@unipro.ru
library equality_operator_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -21,4 +22,3 @@ test(EventSink create()) {
Expect.isFalse(es1 == es2);
Expect.isTrue(es1 == es3);
}

2 changes: 1 addition & 1 deletion LibTest/async/EventSink/hashCode_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/// @author ngl@unipro.ru
library hashCode_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -33,4 +34,3 @@ test(EventSink create()) {
Expect.isFalse(es1.hashCode == es3.hashCode);
}
}

10 changes: 7 additions & 3 deletions LibTest/async/EventSink/noSuchMethodError_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@
/// @author ngl@unipro.ru
library noSuchMethodError_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

test(EventSink create()) {
dynamic es1 = create();

try {
es1.listen((_) {}); /// static type warning
es1.listen((_) {});

/// static type warning
} catch (e) {
Expect.isTrue(e is NoSuchMethodError);
}
try {
es1.abc((_) {}); /// static type warning
es1.abc((_) {});

/// static type warning
} catch (e) {
Expect.isTrue(e is NoSuchMethodError);
}
}

2 changes: 1 addition & 1 deletion LibTest/async/EventSink/runtimeType_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/// @author ngl@unipro.ru
library runtimeType_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -24,4 +25,3 @@ test(EventSink create()) {
Expect.equals(es1.runtimeType, es2.runtimeType);
Expect.notEquals(es1.runtimeType, o.runtimeType);
}

2 changes: 1 addition & 1 deletion LibTest/async/EventSink/toString_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/// @author ngl@unipro.ru
library toString_A01_t01;

import "dart:async";
import "../../../Utils/expect.dart";

Expand All @@ -24,4 +25,3 @@ test(EventSink create()) {
Expect.notEquals(es1, es2);
Expect.equals(es1.toString(), es2.toString());
}

9 changes: 4 additions & 5 deletions LibTest/async/Future/Future.delayed_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ import "../../../Utils/expect.dart";

void check(delay, value) {
asyncStart();
new Future.delayed(durationInMilliseconds(delay), () => value)
.then((v) {
Expect.equals(value, v);
asyncEnd();
});
new Future.delayed(durationInMilliseconds(delay), () => value).then((v) {
Expect.equals(value, v);
asyncEnd();
});
}

main() {
Expand Down
11 changes: 6 additions & 5 deletions LibTest/async/Future/Future.delayed_A01_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ import "../../../Utils/expect.dart";
main() {
bool computationStarted = false;
asyncStart();
new Future.delayed(Duration.zero, () {computationStarted = true;})
.then((v) {
Expect.isTrue(computationStarted);
asyncEnd();
});
new Future.delayed(Duration.zero, () {
computationStarted = true;
}).then((v) {
Expect.isTrue(computationStarted);
asyncEnd();
});
Expect.isFalse(computationStarted);
}
18 changes: 8 additions & 10 deletions LibTest/async/Future/Future.delayed_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ import "../../../Utils/expect.dart";

main() {
asyncStart();
new Future.delayed(Duration.zero)
.then((value) {
Expect.equals(null, value);
asyncEnd();
});
new Future.delayed(Duration.zero).then((value) {
Expect.equals(null, value);
asyncEnd();
});

asyncStart();
new Future.delayed(Duration.zero, null)
.then((value) {
Expect.equals(null, value);
asyncEnd();
});
new Future.delayed(Duration.zero, null).then((value) {
Expect.equals(null, value);
asyncEnd();
});
}
18 changes: 8 additions & 10 deletions LibTest/async/Future/Future.delayed_A03_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ import "../../../Utils/expect.dart";

check(delay, value) {
asyncStart();
new Future.delayed(durationInMilliseconds(delay), () {throw value;})
.then(
(v) {
Expect.fail("Created future should complete with error");
},
onError: (error) {
Expect.equals(value, error);
asyncEnd();
}
);
new Future.delayed(durationInMilliseconds(delay), () {
throw value;
}).then((v) {
Expect.fail("Created future should complete with error");
}, onError: (error) {
Expect.equals(value, error);
asyncEnd();
});
}

main() {
Expand Down
17 changes: 8 additions & 9 deletions LibTest/async/Future/Future.error_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import "../../../Utils/expect.dart";

check(value) {
asyncStart();
new Future.error(value)
.catchError((error) {
if (value == null) {
Expect.isTrue(error is TypeError);
} else {
Expect.identical(value, error);
}
asyncEnd();
});
new Future.error(value).catchError((error) {
if (value == null) {
Expect.isTrue(error is TypeError);
} else {
Expect.identical(value, error);
}
asyncEnd();
});
}

main() {
Expand Down
2 changes: 1 addition & 1 deletion LibTest/async/Future/Future.error_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ main() {

try {
throw error;
} catch(e, st) {
} catch (e, st) {
stackTrace = st;
future = new Future.error(e, st);
}
Expand Down
9 changes: 4 additions & 5 deletions LibTest/async/Future/Future.error_A01_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import "../../../Utils/expect.dart";
main() {
bool inMain = true;
asyncStart();
new Future.error("@")
.catchError((_) {
Expect.isFalse(inMain);
asyncEnd();
});
new Future.error("@").catchError((_) {
Expect.isFalse(inMain);
asyncEnd();
});
inMain = false;
}

0 comments on commit 579fed7

Please sign in to comment.