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 8de20aa63d6c0ea4ad0a8bd9479f5e0af020b3c6..a0e9b6fee3decf6d924e7730e10c71ff1856e491 100644 |
| --- a/tests/compiler/dart2js/resolver_test.dart |
| +++ b/tests/compiler/dart2js/resolver_test.dart |
| @@ -73,6 +73,7 @@ main() { |
| testSuperCalls(); |
| testTypeVariables(); |
| testToString(); |
| + testIndexedOperator(); |
| } |
| testTypeVariables() { |
| @@ -726,17 +727,43 @@ List<String> asSortedStrings(Link link) { |
| return result; |
| } |
| -testToString() { |
| +compileScript(String source, f(compiler)) { |
|
kasperl
2012/08/14 07:13:13
Could this just return the compiler instead?
Anton Muhin
2012/08/14 11:34:44
Done.
|
| Uri uri = new Uri.fromComponents(scheme: 'source'); |
| - MockCompiler compiler = compilerFor( |
| - @"class C { toString() => 'C'; } main() { '${new C()}'; }", |
| - uri); |
| + MockCompiler compiler = compilerFor(source, uri); |
| compiler.runCompiler(uri); |
| + f(compiler); |
| +} |
| - Element toStringMethod = findElement(compiler, 'C') |
| - .lookupLocalMember(buildSourceString('toString')); |
| - Expect.isNotNull(toStringMethod); |
| +testToString() { |
| + compileScript(@"class C { toString() => 'C'; } main() { '${new C()}'; }", |
|
kasperl
2012/08/14 07:13:13
Maybe stuff the script code in a string variable t
Anton Muhin
2012/08/14 11:34:44
Hopefully obsolete after addressing your previous
|
| + (compiler) { |
| + Element toStringMethod = findElement(compiler, 'C') |
| + .lookupLocalMember(buildSourceString('toString')); |
| + Expect.isNotNull(toStringMethod); |
| + |
| + Expect.isNotNull( |
| + compiler.enqueuer.resolution.getCachedElements(toStringMethod)); |
| + }); |
| +} |
| - Expect.isNotNull( |
| - compiler.enqueuer.resolution.getCachedElements(toStringMethod)); |
| +testIndexedOperator() { |
| + compileScript(@""" |
|
kasperl
2012/08/14 07:13:13
Separate string variable for the script code.
Anton Muhin
2012/08/14 11:34:44
Done.
|
| + class C { |
| + operator[](ix) => ix; |
| + operator[]=(ix, v) {} |
| + } |
| + main() { var c = new C(); c[0]++ ; }""", |
| + (compiler) { |
| + Element indexedOperator = findElement(compiler, 'C') |
| + .lookupLocalMember(buildSourceString(@'operator$index')); |
|
kasperl
2012/08/14 07:13:13
It would be nice if you didn't have to hardcode th
Anton Muhin
2012/08/14 11:34:44
Done.
|
| + Expect.isNotNull(indexedOperator); |
| + Expect.isNotNull( |
| + compiler.enqueuer.resolution.getCachedElements(indexedOperator)); |
| + |
| + Element indexedSetOperator = findElement(compiler, 'C') |
| + .lookupLocalMember(buildSourceString(@'operator$indexSet')); |
| + Expect.isNotNull(indexedOperator); |
| + Expect.isNotNull( |
| + compiler.enqueuer.resolution.getCachedElements(indexedSetOperator)); |
| + }); |
| } |