| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 75 |
| 76 test('proper type constructor is called', () => { | 76 test('proper type constructor is called', () => { |
| 77 // This tests https://github.com/dart-lang/dev_compiler/issues/178 | 77 // This tests https://github.com/dart-lang/dev_compiler/issues/178 |
| 78 let l = dart.setType([1, 2, 3], core.List$(core.int)); | 78 let l = dart.list([1, 2, 3], core.int); |
| 79 let s = l[core.$join](); | 79 let s = l[dartx.join](); |
| 80 assert.equal(s, '123'); | 80 assert.equal(s, '123'); |
| 81 }); | 81 }); |
| 82 }); | 82 }); |
| 83 | 83 |
| 84 | 84 |
| 85 suite('instanceOf', () => { | 85 suite('instanceOf', () => { |
| 86 "use strict"; | 86 "use strict"; |
| 87 | 87 |
| 88 let expect = assert.equal; | 88 let expect = assert.equal; |
| 89 let isGroundType = dart.isGroundType; | 89 let isGroundType = dart.isGroundType; |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 checkType(dart.bind(mapB, 'forEach'), | 593 checkType(dart.bind(mapB, 'forEach'), |
| 594 dart.functionType(dart.void, [ | 594 dart.functionType(dart.void, [ |
| 595 dart.functionType(dart.void, [core.int, core.int])])); | 595 dart.functionType(dart.void, [core.int, core.int])])); |
| 596 checkType(dart.bind(mapB, 'forEach'), | 596 checkType(dart.bind(mapB, 'forEach'), |
| 597 dart.functionType(dart.void, [ | 597 dart.functionType(dart.void, [ |
| 598 dart.functionType(dart.void, [core.int, core.String])]), | 598 dart.functionType(dart.void, [core.int, core.String])]), |
| 599 false); | 599 false); |
| 600 | 600 |
| 601 // Tear off of a method with a symbol name | 601 // Tear off of a method with a symbol name |
| 602 let listB = new (c.ListBase$(core.int))(); | 602 let listB = new (c.ListBase$(core.int))(); |
| 603 checkType(dart.bind(listB, core.$add), | 603 checkType(dart.bind(listB, dartx.add), |
| 604 dart.functionType(dart.void, [core.int])); | 604 dart.functionType(dart.void, [core.int])); |
| 605 checkType(dart.bind(listB, core.$add), | 605 checkType(dart.bind(listB, dartx.add), |
| 606 dart.functionType(dart.void, [core.String]), false); | 606 dart.functionType(dart.void, [core.String]), false); |
| 607 | 607 |
| 608 // Tear off of a static method | 608 // Tear off of a static method |
| 609 checkType(c.ListBase.listToString, | 609 checkType(c.ListBase.listToString, |
| 610 dart.functionType(core.String, [core.List])); | 610 dart.functionType(core.String, [core.List])); |
| 611 checkType(c.ListBase.listToString, | 611 checkType(c.ListBase.listToString, |
| 612 dart.functionType(core.String, [core.String]), false); | 612 dart.functionType(core.String, [core.String]), false); |
| 613 | 613 |
| 614 // Tear off a mixin method | 614 // Tear off a mixin method |
| 615 class Base { | 615 class Base { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 | 702 |
| 703 suite('primitives', function() { | 703 suite('primitives', function() { |
| 704 'use strict'; | 704 'use strict'; |
| 705 | 705 |
| 706 test('fixed length list', () => { | 706 test('fixed length list', () => { |
| 707 let list = new core.List(10); | 707 let list = new core.List(10); |
| 708 list[0] = 42; | 708 list[0] = 42; |
| 709 assert.throws(() => list.add(42)); | 709 assert.throws(() => list.add(42)); |
| 710 }); | 710 }); |
| 711 }); | 711 }); |
| OLD | NEW |