Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: tests/corelib_2/error_stack_trace_test.dart

Issue 2987793002: Migrate test block 7 to Dart 2.0. (Closed)
Patch Set: Test modifications Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/corelib_2/error_stack_trace_test.dart
diff --git a/tests/corelib/error_stack_trace_test.dart b/tests/corelib_2/error_stack_trace_test.dart
similarity index 65%
rename from tests/corelib/error_stack_trace_test.dart
rename to tests/corelib_2/error_stack_trace_test.dart
index 6851f7b904ca3b4bef8f4cde944e65d733289029..11a86ee16b118f1747c8b5e4693fcf7502a4ee41 100644
--- a/tests/corelib/error_stack_trace_test.dart
+++ b/tests/corelib_2/error_stack_trace_test.dart
@@ -9,7 +9,7 @@ void argument() {
}
Bob Nystrom 2017/07/25 22:05:43 Oof, this test is complicated. I believe the inten
jcollins 2017/08/02 21:03:26 Acknowledged.
void noSuchMethod() {
- (499).doesNotExist();
+ (499).doesNotExist(); //# static: compile-time error
Bob Nystrom 2017/07/25 22:05:43 This is still a valid runtime error, but we need t
jcollins 2017/08/02 21:03:26 So, in other words, in Dart 2.0 the only time a ru
Bob Nystrom 2017/08/02 21:12:36 Exactly right.
}
void nullThrown() {
@@ -24,8 +24,8 @@ void fallThrough() {
nested() {}
switch (5) {
- case 5:
- nested();
+ case 5://# static: compile-time error
+ nested();//# static: compile-time error
jcollins 2017/08/02 21:03:26 This case has become more interesting once we've p
Bob Nystrom 2017/08/02 21:12:36 In strong mode, that static warning should get pro
default:
Expect.fail("Should not reach");
}
@@ -36,7 +36,7 @@ abstract class A {
}
Bob Nystrom 2017/07/25 22:05:43 Likewise, there is no AbstractClassInstantiationEr
jcollins 2017/08/02 21:03:26 done
void abstractClassInstantiation() {
- new A();
+ new A();//# static: compile-time error
}
void unsupported() {
@@ -48,35 +48,35 @@ void unimplemented() {
}
void state() {
- return [1, 2].single;
+ return [1, 2].single;//# static: compile-time error
Bob Nystrom 2017/07/25 22:05:43 As far as I can tell, this shouldn't have a static
jcollins 2017/08/02 21:03:26 This has a static error because the code returns a
Bob Nystrom 2017/08/02 21:12:36 Ha, oh, right.
jcollins 2017/08/03 15:54:18 Making this more minimal makes sense, done.
}
void type() {
- return 1 + "string";
+ return 1 + "string";//# static: compile-time error
Bob Nystrom 2017/07/25 22:05:43 I don't believe Dart 2.0 has TypeError. But it *do
jcollins 2017/08/02 21:03:25 Done.
}
main() {
List<Function> errorFunctions = [
argument,
- noSuchMethod,
+ noSuchMethod, //# static: ok
nullThrown,
range,
- fallThrough,
- abstractClassInstantiation,
+ fallThrough, //# static: ok
+ abstractClassInstantiation, //# static: ok
unsupported,
unimplemented,
- state,
- type
+ state, //# static: ok
+ type //# static: ok
];
for (var f in errorFunctions) {
bool hasThrown = false;
try {
f();
- } catch (e) {
+ } catch (e, stackTrace) {
hasThrown = true;
Expect.isTrue(
- e.stackTrace is StackTrace, "$e doesn't have a non-null stack trace");
+ stackTrace is StackTrace, "$e doesn't have a non-null stack trace");
Bob Nystrom 2017/07/25 22:05:43 I don't think this change is right. My reading is
jcollins 2017/08/02 21:03:26 I had asked around about this and the understandin
Bob Nystrom 2017/08/02 21:12:36 Oh, interesting. I didn't realize there were any A
jcollins 2017/08/03 15:54:18 Since I've already done the work of figuring out w
}
Expect.isTrue(hasThrown);
}

Powered by Google App Engine
This is Rietveld 408576698