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 define(['dart_sdk'], function(dart_sdk) { | 5 define(['dart_sdk'], function(dart_sdk) { |
6 const assert = chai.assert; | 6 const assert = chai.assert; |
7 const async = dart_sdk.async; | 7 const async = dart_sdk.async; |
8 const core = dart_sdk.core; | 8 const core = dart_sdk.core; |
9 const collection = dart_sdk.collection; | 9 const collection = dart_sdk.collection; |
10 const dart = dart_sdk.dart; | 10 const dart = dart_sdk.dart; |
11 const dartx = dart.dartx; | 11 const dartx = dart.dartx; |
12 | 12 |
| 13 dart.trapRuntimeErrors(false); |
| 14 |
| 15 suite('ignore', () => { |
| 16 "use strict"; |
| 17 |
| 18 let FutureOr = async.FutureOr$; |
| 19 let Future = async.Future$; |
| 20 let List = core.List$; |
| 21 |
| 22 setup(() => { |
| 23 dart_sdk.dart.ignoreWhitelistedErrors(false); |
| 24 }); |
| 25 |
| 26 teardown(() => { |
| 27 dart_sdk.dart.ignoreWhitelistedErrors(false); |
| 28 }); |
| 29 |
| 30 test('FutureOr', () => { |
| 31 let f = Future(dart.dynamic).value(42); |
| 32 let l = [1, 2, 3]; |
| 33 |
| 34 assert.throws(() => { dart.as(f, FutureOr(core.int)); }); |
| 35 assert.throws(() => { dart.as(l, FutureOr(List(core.int)))}); |
| 36 |
| 37 dart_sdk.dart.ignoreWhitelistedErrors(true); |
| 38 assert.equal(f, dart.as(f, FutureOr(core.int))); |
| 39 assert.equal(l, dart.as(l, FutureOr(List(core.int)))); |
| 40 }); |
| 41 }); |
13 | 42 |
14 suite('generic', () => { | 43 suite('generic', () => { |
15 "use strict"; | 44 "use strict"; |
16 | 45 |
17 let generic = dart.generic; | 46 let generic = dart.generic; |
18 | 47 |
19 test('zero arguments is not allowed', () => { | 48 test('zero arguments is not allowed', () => { |
20 assert.throws(() => { generic(function(){}); }); | 49 assert.throws(() => { generic(function(){}); }); |
21 }); | 50 }); |
22 | 51 |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 list[0] = 42; | 1270 list[0] = 42; |
1242 assert.throws(() => list.add(42)); | 1271 assert.throws(() => list.add(42)); |
1243 }); | 1272 }); |
1244 | 1273 |
1245 test('toString on ES Symbol', () => { | 1274 test('toString on ES Symbol', () => { |
1246 let sym = Symbol('_foobar'); | 1275 let sym = Symbol('_foobar'); |
1247 assert.equal(dart.toString(sym), 'Symbol(_foobar)'); | 1276 assert.equal(dart.toString(sym), 'Symbol(_foobar)'); |
1248 }); | 1277 }); |
1249 }); | 1278 }); |
1250 }); | 1279 }); |
OLD | NEW |