OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library jsTest; | 5 library jsTest; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 | 8 |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'package:unittest/html_individual_config.dart'; | 10 import 'package:unittest/html_individual_config.dart'; |
11 import 'package:expect/expect.dart' show NoInline, AssumeDynamic; | 11 import 'package:expect/expect.dart' show NoInline, AssumeDynamic; |
12 | 12 |
13 import 'js_type_test_lib.dart'; | 13 import 'js_type_test_lib.dart'; |
14 | 14 |
15 class Bar {} | 15 class Bar {} |
16 | 16 |
17 @NoInline() @AssumeDynamic() | 17 @NoInline() |
| 18 @AssumeDynamic() |
18 confuse(x) => x; | 19 confuse(x) => x; |
19 | 20 |
20 class Is<T> { | 21 class Is<T> { |
21 const Is(); | 22 const Is(); |
22 check(o) => o is T; | 23 check(o) => o is T; |
23 } | 24 } |
24 | 25 |
25 main() { | 26 main() { |
26 useHtmlIndividualConfiguration(); | 27 useHtmlIndividualConfiguration(); |
27 | 28 |
28 new Is<Foo>().check(new Bar()); // Bar is instantiated by this code. | 29 new Is<Foo>().check(new Bar()); // Bar is instantiated by this code. |
29 new Is<Foo>().check([]); | 30 new Is<Foo>().check([]); |
30 new Is<List>().check([]); | 31 new Is<List>().check([]); |
31 | 32 |
32 group('static', () { | 33 group('static', () { |
33 test('not-String', () { | 34 test('not-String', () { |
34 Foo e = new Foo(); | 35 Foo e = new Foo(); |
35 expect(e is String, isFalse); | 36 expect(e is String, isFalse); |
36 }); | 37 }); |
37 | 38 |
38 test('not-int', () { | 39 test('not-int', () { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 expect(const Is<Foo>().check(e), isFalse); | 136 expect(const Is<Foo>().check(e), isFalse); |
136 }); | 137 }); |
137 }); | 138 }); |
138 | 139 |
139 group('dynamic-null-not-dynamic-Foo', () { | 140 group('dynamic-null-not-dynamic-Foo', () { |
140 test('test', () { | 141 test('test', () { |
141 var e = confuse(null); | 142 var e = confuse(null); |
142 expect(const Is<Foo>().check(e), isFalse); | 143 expect(const Is<Foo>().check(e), isFalse); |
143 }); | 144 }); |
144 }); | 145 }); |
145 | |
146 } | 146 } |
OLD | NEW |