Index: tests/language/type_cast_vm_test.dart |
=================================================================== |
--- tests/language/type_cast_vm_test.dart (revision 25753) |
+++ tests/language/type_cast_vm_test.dart (working copy) |
@@ -22,12 +22,12 @@ |
int result = 0; |
try { |
var i = "hello" as int; // Throws a CastError |
- } on TypeError catch (error, stacktrace) { |
+ } catch (error, stacktrace) { |
result = 1; |
Expect.isTrue(error is CastError); |
- Expect.equals("int", error.dstType); |
- Expect.equals("String", error.srcType); |
- Expect.equals("type cast", error.dstName); |
+ var msg = error.toString(); |
+ Expect.isTrue(msg.contains("int")); // dstType |
+ Expect.isTrue(msg.contains("String")); // srcType |
checkTopFunction("type_cast_vm_test.dart:24:23", stacktrace); |
} |
return result; |
@@ -44,7 +44,7 @@ |
a[0] = 0; |
a[index()]++; // Type check succeeds, but does not create side effects. |
Expect.equals(1, a[0]); |
- } on TypeError catch (error) { |
+ } catch (error) { |
result = 100; |
} |
return result; |
@@ -57,12 +57,12 @@ |
} |
try { |
int i = f("hello" as int); // Throws a CastError |
- } on TypeError catch (error, stacktrace) { |
+ } catch (error, stacktrace) { |
result = 1; |
Expect.isTrue(error is CastError); |
- Expect.equals("int", error.dstType); |
- Expect.equals("String", error.srcType); |
- Expect.equals("type cast", error.dstName); |
+ var msg = error.toString(); |
+ Expect.isTrue(msg.contains("int")); // dstType |
+ Expect.isTrue(msg.contains("String")); // srcType |
checkTopFunction("type_cast_vm_test.dart:59:25", stacktrace); |
} |
return result; |
@@ -75,12 +75,12 @@ |
} |
try { |
int i = f("hello"); |
- } on TypeError catch (error, stacktrace) { |
+ } catch (error, stacktrace) { |
result = 1; |
Expect.isTrue(error is CastError); |
- Expect.equals("int", error.dstType); |
- Expect.equals("String", error.srcType); |
- Expect.equals("type cast", error.dstName); |
+ var msg = error.toString(); |
+ Expect.isTrue(msg.contains("int")); // dstType |
+ Expect.isTrue(msg.contains("String")); // srcType |
checkTopFunction("type_cast_vm_test.dart:74:16", stacktrace); |
} |
return result; |
@@ -93,11 +93,11 @@ |
Expect.equals(5, (field as String).length); |
try { |
field as int; // Throws a CastError |
- } on TypeError catch (error, stacktrace) { |
+ } catch (error, stacktrace) { |
result = 1; |
- Expect.equals("int", error.dstType); |
- Expect.equals("String", error.srcType); |
- Expect.equals("type cast", error.dstName); |
+ var msg = error.toString(); |
+ Expect.isTrue(msg.contains("int")); // dstType |
+ Expect.isTrue(msg.contains("String")); // srcType |
checkTopFunction("type_cast_vm_test.dart:95:13", stacktrace); |
} |
return result; |
@@ -111,11 +111,11 @@ |
anyFunction = null as Function; // No error. |
try { |
var i = f as int; // Throws a TypeError if type checks are enabled. |
- } on TypeError catch (error, stacktrace) { |
+ } catch (error, stacktrace) { |
result = 1; |
- Expect.equals("int", error.dstType); |
- Expect.equals("() => dynamic", error.srcType); |
- Expect.equals("type cast", error.dstName); |
+ var msg = error.toString(); |
+ Expect.isTrue(msg.contains("int")); // dstType |
+ Expect.isTrue(msg.contains("() => dynamic")); // srcType |
checkTopFunction("type_cast_vm_test.dart:113:17", stacktrace); |
} |
return result; |