| 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 var assert = chai.assert; | 5 var assert = chai.assert; |
| 6 | 6 |
| 7 suite('generic', () => { | 7 suite('generic', () => { |
| 8 "use strict"; | 8 "use strict"; |
| 9 | 9 |
| 10 let generic = dart.generic; | 10 let generic = dart.generic; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 assert.strictEqual(Object.keys(t1).length, 0); | 65 assert.strictEqual(Object.keys(t1).length, 0); |
| 66 assert.strictEqual(Object.keys(t2).length, 0); | 66 assert.strictEqual(Object.keys(t2).length, 0); |
| 67 }); | 67 }); |
| 68 | 68 |
| 69 test('type constructor is reflectable', () => { | 69 test('type constructor is reflectable', () => { |
| 70 let SomeType = generic(function(x, y) { return Object.create(null); }); | 70 let SomeType = generic(function(x, y) { return Object.create(null); }); |
| 71 let someValue = SomeType('hi', 123); | 71 let someValue = SomeType('hi', 123); |
| 72 assert.equal(someValue[dart.originalDeclaration], SomeType); | 72 assert.equal(someValue[dart.originalDeclaration], SomeType); |
| 73 assert.deepEqual(someValue[dart.typeArguments], ['hi', 123]); | 73 assert.deepEqual(someValue[dart.typeArguments], ['hi', 123]); |
| 74 }); | 74 }); |
| 75 |
| 76 test('proper type constructor is called', () => { |
| 77 // This tests https://github.com/dart-lang/dev_compiler/issues/178 |
| 78 let l = dart.setType([1, 2, 3], core.List$(core.int)); |
| 79 let s = l[core.$join](); |
| 80 assert.equal(s, '123'); |
| 81 }); |
| 75 }); | 82 }); |
| 76 | 83 |
| 77 | 84 |
| 78 suite('instanceOf', () => { | 85 suite('instanceOf', () => { |
| 79 "use strict"; | 86 "use strict"; |
| 80 | 87 |
| 81 let expect = assert.equal; | 88 let expect = assert.equal; |
| 82 let isGroundType = dart.isGroundType; | 89 let isGroundType = dart.isGroundType; |
| 83 let generic = dart.generic; | 90 let generic = dart.generic; |
| 84 let intIsNonNullable = false; | 91 let intIsNonNullable = false; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 401 |
| 395 suite('primitives', function() { | 402 suite('primitives', function() { |
| 396 'use strict'; | 403 'use strict'; |
| 397 | 404 |
| 398 test('fixed length list', () => { | 405 test('fixed length list', () => { |
| 399 let list = new core.List(10); | 406 let list = new core.List(10); |
| 400 list[0] = 42; | 407 list[0] = 42; |
| 401 assert.throws(() => list.add(42)); | 408 assert.throws(() => list.add(42)); |
| 402 }); | 409 }); |
| 403 }); | 410 }); |
| OLD | NEW |