Chromium Code Reviews| Index: tests/compiler/dart2js/resolver_test.dart |
| diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart |
| index 5f3a47215758034c85154d294eafbc5416ae0303..17339eb23ddd796331057612e243b55034a9ee7b 100644 |
| --- a/tests/compiler/dart2js/resolver_test.dart |
| +++ b/tests/compiler/dart2js/resolver_test.dart |
| @@ -1145,15 +1145,13 @@ testConstConstructorAndNonFinalFields() { |
| } |
| testCantAssignMethods() { |
| - checkWarningOn(String script, List<String> errorLocations) { |
| + checkWarningOn(String script, List<MessageKind> warnings) { |
| + Expect.isTrue(warnings.length >= 0 && warnings.length <= 2); |
| asyncTest(() => compileScript(script).then((compiler) { |
| Expect.equals(0, compiler.errors.length); |
| - Expect.equals(errorLocations.length, compiler.warnings.length); |
| - for (var i = 0; i < errorLocations.length; i++) { |
| - Expect.equals(MessageKind.ASSIGNING_METHOD, |
| - compiler.warnings[i].message.kind); |
| - Expect.equals(script.indexOf(errorLocations[i]), |
| - compiler.warnings[i].node.getBeginToken().charOffset); |
| + Expect.equals(warnings.length, compiler.warnings.length); |
| + for (int i = 0; i < warnings.length; i++) { |
| + Expect.equals(warnings[i], compiler.warnings[i].message.kind); |
| } |
| })); |
| } |
| @@ -1164,20 +1162,20 @@ testCantAssignMethods() { |
| mname() { mname = 2; }; |
| mname(); |
| } |
| - ''', ['mname = 2']); |
| + ''', [MessageKind.ASSIGNING_METHOD]); |
| checkWarningOn(''' |
| main() { |
| mname() { }; |
| mname = 3; |
| } |
| - ''', ['mname = 3']); |
| + ''', [MessageKind.ASSIGNING_METHOD]); |
| // Can't override top-level functions |
| checkWarningOn(''' |
| m() {} |
| main() { m = 4; } |
| - ''', ['m = 4']); |
| + ''', [MessageKind.ASSIGNING_METHOD]); |
| // Can't override instance methods |
| checkWarningOn(''' |
| @@ -1188,7 +1186,7 @@ testCantAssignMethods() { |
| mname = () => null; |
| } |
| } |
| - ''', ['mname = () => null']); |
| + ''', [MessageKind.ASSIGNING_METHOD, MessageKind.SETTER_NOT_FOUND]); |
|
Siggi Cherem (dart-lang)
2015/04/15 01:38:04
I'm not happy with the second error (which is curr
Johnni Winther
2015/04/15 08:58:03
Actually should not resolve [target] to an instanc
Siggi Cherem (dart-lang)
2015/04/15 22:39:46
Good point - I changed it so that the checker repo
|
| // Can't override super methods |
| checkWarningOn(''' |
| @@ -1201,7 +1199,7 @@ testCantAssignMethods() { |
| super.mname = () => 6; |
| } |
| } |
| - ''', ['mname = () => 6']); |
| + ''', [MessageKind.ASSIGNING_METHOD, MessageKind.SETTER_NOT_FOUND]); |
| // But fields are OK: |
| checkWarningOn(''' |