-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsdependency: dartDart team may need to help usDart team may need to help us
Description
Try to "flutter test" the following file:
class Foo { Foo({ int arg }); }
void main() {
new Foo(bogus: 1);
}You get:
Running "flutter packages get" in scratch...
compiler message: test/a_test.dart:4:11: Error: Constructor has no named parameter with the name 'bogus'.
compiler message: new Foo(bogus: 1);
compiler message: ^^^^^
compiler message: test/a_test.dart:1:13: Context: Found this candidate, but the arguments don't match.
compiler message: class Foo { Foo({ int arg }); }
compiler message: ^
00:00 +0 -1: loading /Users/ianh/dev/scratch/test/a_test.dart [E]
Failed to load "/Users/ianh/dev/scratch/test/a_test.dart":
No top-level method '' declared.
Receiver: top-level
Tried calling: (bogus: 1)
package:test serializeSuite
/var/folders/1b/7c22t3zx7h7_400fl83x5pxr000f_t/T/dart_test_listeneruFfxCR/listener.dart 18:27 main
00:00 +0 -1: Some tests failed.
If the test fails to compile, we should definitely not then run it. If we do run it, we should not have a bogus error message that refers to undeclared methods; instead we should get something more like what we used to get in Dart1:
Unhandled exception:
NoSuchMethodError: No constructor 'Foo' declared in class 'Foo'.
Receiver: Foo
Tried calling: new Foo(bogus: 1)
#0 NoSuchMethodError._throwNew (dart:core-patch/dart:core/errors_patch.dart:196)
#1 main (file:///Users/ianh/dev/scratch/test/a_test.dart:4:10)
#2 _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:279)
#3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
Metadata
Metadata
Assignees
Labels
a: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsdependency: dartDart team may need to help usDart team may need to help us