Skip to content

Commit

Permalink
Fixes #1595. Expect TypeError in place of NullThrownError in co19_2 t…
Browse files Browse the repository at this point in the history
…ests (#1597)

Authored by @sgrekhov.
  • Loading branch information
sgrekhov authored Dec 15, 2022
1 parent fa1aa99 commit f691647
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Language/Expressions/Throw/evaluation_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// @assertion Evaluation of a throw expression of the form throw e; proceeds as
/// follows:
/// The expression e is evaluated yielding a value v.
/// If v evaluates to null, then a NullThrownError is thrown. Otherwise, control
/// If v evaluates to null, then a TypeError is thrown. Otherwise, control
/// is transferred to the nearest dynamically enclosing exception handler, with
/// the current exception set to v and the current return value becomes
/// undefined.
Expand Down
2 changes: 1 addition & 1 deletion Language/Expressions/Throw/evaluation_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// @assertion Evaluation of a throw expression of the form throw e; proceeds as
/// follows:
/// The expression e is evaluated yielding a value v.
/// If v evaluates to null, then a NullThrownError is thrown. Otherwise, control
/// If v evaluates to null, then a TypeError is thrown. Otherwise, control
/// is transferred to the nearest dynamically enclosing exception handler, with
/// the current exception set to v and the current return value becomes
/// undefined.
Expand Down
2 changes: 1 addition & 1 deletion Language/Expressions/Throw/evaluation_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// @assertion Evaluation of a throw expression of the form throw e; proceeds as
/// follows:
/// The expression e is evaluated yielding a value v.
/// If v evaluates to null, then a NullThrownError is thrown. Otherwise, control
/// If v evaluates to null, then a TypeError is thrown. Otherwise, control
/// is transferred to the nearest dynamically enclosing exception handler, with
/// the current exception set to v and the current return value becomes
/// undefined.
Expand Down
20 changes: 10 additions & 10 deletions Language/Expressions/Throw/evaluation_t04.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
/// @assertion Evaluation of a throw expression of the form throw e; proceeds as
/// follows:
/// The expression e is evaluated yielding a value v.
/// If v evaluates to null, then a NullThrownError is thrown. Otherwise, control
/// If v evaluates to null, then a TypeError is thrown. Otherwise, control
/// is transferred to the nearest dynamically enclosing exception handler, with
/// the current exception set to v and the current return value becomes
/// undefined.
/// @description Checks that attempting to throw null in any manner results in
/// NullThrownError being thrown instead.
/// TypeError being thrown instead.
/// @author rodionov
/// @reviewer kaigorodov
Expand All @@ -27,21 +27,21 @@ n2() {}
main() {
try {
throw null;
Expect.fail("NullThrownError expected.");
} on NullThrownError catch (ok) {}
Expect.fail("TypeError expected.");
} on TypeError catch (ok) {}

try {
throw n();
Expect.fail("NullThrownError expected.");
} on NullThrownError catch (ok) {}
Expect.fail("TypeError expected.");
} on TypeError catch (ok) {}

try {
throw n2();
Expect.fail("NullThrownError expected.");
} on NullThrownError catch (ok) {}
Expect.fail("TypeError expected.");
} on TypeError catch (ok) {}

try {
throw (true ? null : null);
Expect.fail("NullThrownError expected.");
} on NullThrownError catch (ok) {}
Expect.fail("TypeError expected.");
} on TypeError catch (ok) {}
}
2 changes: 1 addition & 1 deletion Language/Expressions/Throw/evaluation_t05.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// @assertion Evaluation of a throw expression of the form throw e; proceeds as
/// follows:
/// The expression e is evaluated yielding a value v.
/// If v evaluates to null, then a NullThrownError is thrown. Otherwise, control
/// If v evaluates to null, then a TypeError is thrown. Otherwise, control
/// is transferred to the nearest dynamically enclosing exception handler, with
/// the current exception set to v and the current return value becomes
/// undefined.
Expand Down
2 changes: 1 addition & 1 deletion LibTest/async/Future/Future.error_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ check(value) {
new Future.error(value)
.catchError((error) {
if (value == null) {
Expect.isTrue(error is NullThrownError);
Expect.isTrue(error is TypeError);
} else {
Expect.identical(value, error);
}
Expand Down
4 changes: 2 additions & 2 deletions LibTest/async/Future/Future.sync_A01_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ check(value) {
Expect.fail("Created future should complete with error");
},
onError: (e) {
if (value==null){
Expect.isTrue(e is NullThrownError);
if (value == null){
Expect.isTrue(e is TypeError);
} else {
Expect.identical(value, e);
}
Expand Down
2 changes: 1 addition & 1 deletion Utils/tests/Expect/throws_A01_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ main() {
check(badboy2, (e) => false);

Expect.throws(badboy3);
Expect.throws(badboy3, (e) => e is NullThrownError, "");
Expect.throws(badboy3, (e) => e is TypeError, "");
check(badboy3, (e) => false, "not empty");
}

Expand Down

0 comments on commit f691647

Please sign in to comment.