Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'package:expect/expect.dart'; | |
| 6 import "package:async_helper/async_helper.dart"; | |
| 7 import 'compiler_helper.dart'; | |
| 8 | |
| 9 dummyImplTest() { | |
| 10 String source = """ | |
| 11 class A { | |
| 12 foo() => 3; | |
| 13 noSuchMethod(x) => super.noSuchMethod(x); | |
| 14 } | |
| 15 main() { | |
| 16 print(new A().foo()); | |
| 17 } | |
| 18 """; | |
| 19 Uri uri = new Uri(scheme: 'source'); | |
| 20 var compiler = compilerFor(source, uri); | |
| 21 asyncTest(() => | |
| 22 compiler.runCompiler(uri).then((_) => | |
| 23 Expect.isFalse(compiler.backend.enabledNoSuchMethod))); | |
| 24 } | |
| 25 | |
| 26 dummyImplTest2() { | |
| 27 String source = """ | |
| 28 class A extends B { | |
| 29 foo() => 3; | |
| 30 noSuchMethod(x) => super.noSuchMethod(x); | |
| 31 } | |
| 32 class B {} | |
| 33 main() { | |
| 34 print(new A().foo()); | |
| 35 } | |
| 36 """; | |
| 37 Uri uri = new Uri(scheme: 'source'); | |
| 38 var compiler = compilerFor(source, uri); | |
| 39 asyncTest(() => | |
| 40 compiler.runCompiler(uri).then((_) => | |
| 41 Expect.isFalse(compiler.backend.enabledNoSuchMethod))); | |
| 42 } | |
| 43 | |
| 44 dummyImplTest3() { | |
| 45 String source = """ | |
| 46 class A extends B { | |
| 47 foo() => 3; | |
| 48 noSuchMethod(x) { | |
| 49 return super.noSuchMethod(x); | |
| 50 } | |
| 51 } | |
| 52 class B {} | |
| 53 main() { | |
| 54 print(new A().foo()); | |
| 55 } | |
| 56 """; | |
| 57 Uri uri = new Uri(scheme: 'source'); | |
| 58 var compiler = compilerFor(source, uri); | |
| 59 asyncTest(() => | |
| 60 compiler.runCompiler(uri).then((_) => | |
| 61 Expect.isFalse(compiler.backend.enabledNoSuchMethod))); | |
| 62 } | |
| 63 | |
| 64 dummyImplTest4() { | |
| 65 String source = """ | |
| 66 class A extends B { | |
| 67 foo() => 3; | |
| 68 noSuchMethod(x) => super.noSuchMethod(x); | |
| 69 } | |
| 70 class B { | |
| 71 noSuchMethod(x) => super.noSuchMethod(x); | |
| 72 } | |
| 73 main() { | |
| 74 print(new A().foo()); | |
| 75 } | |
| 76 """; | |
| 77 Uri uri = new Uri(scheme: 'source'); | |
| 78 var compiler = compilerFor(source, uri); | |
| 79 asyncTest(() => | |
| 80 compiler.runCompiler(uri).then((_) => | |
| 81 Expect.isFalse(compiler.backend.enabledNoSuchMethod))); | |
| 82 } | |
| 83 | |
| 84 dummyImplTest5() { | |
| 85 String source = """ | |
| 86 class A extends B { | |
| 87 foo() => 3; | |
| 88 noSuchMethod(x) => super.noSuchMethod(x); | |
| 89 } | |
| 90 class B { | |
| 91 noSuchMethod(x) => throw 'foo'; | |
| 92 } | |
| 93 main() { | |
| 94 print(new A().foo()); | |
| 95 } | |
| 96 """; | |
| 97 Uri uri = new Uri(scheme: 'source'); | |
| 98 var compiler = compilerFor(source, uri); | |
| 99 asyncTest(() => | |
| 100 compiler.runCompiler(uri).then((_) => | |
| 101 Expect.isTrue(compiler.backend.enabledNoSuchMethod))); | |
|
Johnni Winther
2015/03/18 10:47:16
Maybe test that [B.noSuchMethod] is in the [throwi
Harry Terkelsen
2015/03/18 20:54:50
Done.
| |
| 102 } | |
| 103 | |
| 104 dummyImplTest6() { | |
| 105 String source = """ | |
| 106 class A { | |
| 107 noSuchMethod(x) => 3; | |
| 108 } | |
| 109 main() { | |
| 110 print(new A().foo()); | |
| 111 } | |
| 112 """; | |
| 113 Uri uri = new Uri(scheme: 'source'); | |
| 114 var compiler = compilerFor(source, uri); | |
| 115 asyncTest(() => | |
| 116 compiler.runCompiler(uri).then((_) => | |
| 117 Expect.isTrue(compiler.backend.enabledNoSuchMethod))); | |
|
Johnni Winther
2015/03/18 10:47:16
Maybe test that [A.noSuchMethod] is in the [otherI
Harry Terkelsen
2015/03/18 20:54:50
Done.
| |
| 118 } | |
| 119 | |
| 120 main() { | |
| 121 dummyImplTest(); | |
| 122 dummyImplTest2(); | |
| 123 dummyImplTest3(); | |
| 124 dummyImplTest4(); | |
| 125 dummyImplTest5(); | |
| 126 dummyImplTest6(); | |
| 127 } | |
| OLD | NEW |