| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // SharedOptions=--trust-type-annotations | 5 // SharedOptions=--trust-type-annotations |
| 6 @JS() | 6 @JS() |
| 7 library js_function_getter_trust_types_test; | 7 library js_function_getter_trust_types_test; |
| 8 | 8 |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 return a + b; | 27 return a + b; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 var foo = { 'bar' : bar }; | 30 var foo = { 'bar' : bar }; |
| 31 """); | 31 """); |
| 32 } | 32 } |
| 33 | 33 |
| 34 typedef int AddFn(int x, int y); | 34 typedef int AddFn(int x, int y); |
| 35 | 35 |
| 36 @JS() | 36 @JS() |
| 37 class NotAFn { } | 37 class NotAFn {} |
| 38 | 38 |
| 39 @JS() | 39 @JS() |
| 40 abstract class Bar { | 40 abstract class Bar { |
| 41 external AddFn get add; | 41 external AddFn get add; |
| 42 external NotAFn get nonFunctionStatic; | 42 external NotAFn get nonFunctionStatic; |
| 43 } | 43 } |
| 44 | 44 |
| 45 @JS() | 45 @JS() |
| 46 abstract class Foo { | 46 abstract class Foo { |
| 47 external Bar get bar; | 47 external Bar get bar; |
| 48 } | 48 } |
| 49 | 49 |
| 50 @JS() | 50 @JS() |
| 51 external Foo get foo; | 51 external Foo get foo; |
| 52 | 52 |
| 53 main() { | 53 main() { |
| 54 _injectJs(); | 54 _injectJs(); |
| 55 | 55 |
| 56 useHtmlIndividualConfiguration(); | 56 useHtmlIndividualConfiguration(); |
| 57 | 57 |
| 58 group('trust types', () { | 58 group('trust types', () { |
| 59 test('static nonFunctionStatic', () { | 59 test('static nonFunctionStatic', () { |
| 60 expect(() => foo.bar.nonFunctionStatic(), throws); | 60 expect(() => foo.bar.nonFunctionStatic(), throws); |
| 61 expect(() => foo.bar.nonFunctionStatic(0), throws); | 61 expect(() => foo.bar.nonFunctionStatic(0), throws); |
| 62 expect(() => foo.bar.nonFunctionStatic(0,0), throws); | 62 expect(() => foo.bar.nonFunctionStatic(0, 0), throws); |
| 63 expect(() => foo.bar.nonFunctionStatic(0,0,0,0,0,0), throws); | 63 expect(() => foo.bar.nonFunctionStatic(0, 0, 0, 0, 0, 0), throws); |
| 64 }); | 64 }); |
| 65 | 65 |
| 66 test('typedef function', () { | 66 test('typedef function', () { |
| 67 expect(() => foo.bar.add(4), throws); | 67 expect(() => foo.bar.add(4), throws); |
| 68 expect(() => foo.bar.add(4,5,10), throws); | 68 expect(() => foo.bar.add(4, 5, 10), throws); |
| 69 expect(foo.bar.add(4,5), equals(9)); | 69 expect(foo.bar.add(4, 5), equals(9)); |
| 70 }); | 70 }); |
| 71 }); | 71 }); |
| 72 } | 72 } |
| OLD | NEW |