Skip to content

Commit f142ec6

Browse files
authored
update test to reflect removed NoSuchMethodError default cons (dart-archive/linter#3903)
1 parent c9677f5 commit f142ec6

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

test/integration/only_throw_errors.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void main() {
3636
"throw 'hello world!'; // LINT",
3737
'throw null; // LINT',
3838
'throw 7; // LINT',
39-
'throw new Object(); // LINT',
39+
'throw Object(); // LINT',
4040
'throw returnString(); // LINT',
4141
'throw error; // LINT',
4242
'1 file analyzed, 6 issues found, in'

test_data/integration/only_throw_errors/only_throw_errors.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ void throwNumber() {
1919
}
2020

2121
void throwObject() {
22-
throw new Object(); // LINT
22+
throw Object(); // LINT
2323
}
2424

2525
void throwError() {
26-
throw new Error(); // OK
26+
throw Error(); // OK
2727
}
2828

2929
void throwDynamicPrebuiltError() {
@@ -32,17 +32,17 @@ void throwDynamicPrebuiltError() {
3232
}
3333

3434
void throwStaticPrebuiltError() {
35-
Error error = new Error();
35+
Error error = Error();
3636
throw error; // OK
3737
}
3838

3939
void throwArgumentError() {
40-
Error error = new ArgumentError('oh!');
40+
Error error = ArgumentError('oh!');
4141
throw error; // OK
4242
}
4343

4444
void throwException() {
45-
Exception exception = new Exception('oh!');
45+
Exception exception = Exception('oh!');
4646
throw exception; // OK
4747
}
4848

@@ -56,18 +56,17 @@ void throwExceptionFromFunction() {
5656
throw returnException();
5757
}
5858

59-
Exception returnException() => new Exception('oh!');
59+
Exception returnException() => Exception('oh!');
6060

6161
// TODO: Even though in the test this does not get linted, it does while
6262
// analyzing the SDK code. Find out why.
6363
dynamic noSuchMethod(Invocation invocation) {
64-
throw new NoSuchMethodError(new Object(), invocation.memberName,
65-
invocation.positionalArguments, invocation.namedArguments);
64+
throw NoSuchMethodError.withInvocation(Object(), invocation);
6665
}
6766

6867
class Err extends Object with Exception {
6968
static throws() {
70-
throw new Err(); // OK
69+
throw Err(); // OK
7170
}
7271
}
7372

0 commit comments

Comments
 (0)