| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 }); | 612 }); |
| 613 | 613 |
| 614 class O extends dart.mixin(Base, M1, M2) { | 614 class O extends dart.mixin(Base, M1, M2) { |
| 615 O() {}; | 615 O() {}; |
| 616 }; | 616 }; |
| 617 dart.setSignature(O, {}); | 617 dart.setSignature(O, {}); |
| 618 var obj = new O(); | 618 var obj = new O(); |
| 619 var m = dart.bind(obj, 'm'); | 619 var m = dart.bind(obj, 'm'); |
| 620 checkType(m, dart.functionType(core.Object, [core.int])); | 620 checkType(m, dart.functionType(core.Object, [core.int])); |
| 621 checkType(m, dart.functionType(core.int, [core.int]), false); | 621 checkType(m, dart.functionType(core.int, [core.int]), false); |
| 622 |
| 623 // Test inherited signatures |
| 624 class P extends O { |
| 625 P() {}; |
| 626 m(x) {return x;}; |
| 627 }; |
| 628 dart.setSignature(P, {}); |
| 629 var obj = new P(); |
| 630 var m = dart.bind(obj, 'm'); |
| 631 checkType(m, dart.functionType(core.Object, [core.int])); |
| 632 checkType(m, dart.functionType(core.int, [core.int]), false); |
| 622 }); | 633 }); |
| 623 | 634 |
| 624 test('Object members', () => { | 635 test('Object members', () => { |
| 625 let nullHash = dart.hashCode(null); | 636 let nullHash = dart.hashCode(null); |
| 626 assert.equal(nullHash, 0); | 637 assert.equal(nullHash, 0); |
| 627 let nullString = dart.toString(null); | 638 let nullString = dart.toString(null); |
| 628 assert.equal(nullString, 'null'); | 639 assert.equal(nullString, 'null'); |
| 629 let nullType = dart.runtimeType(null); | 640 let nullType = dart.runtimeType(null); |
| 630 assert.equal(nullType, core.Null); | 641 assert.equal(nullType, core.Null); |
| 631 | 642 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 674 |
| 664 suite('primitives', function() { | 675 suite('primitives', function() { |
| 665 'use strict'; | 676 'use strict'; |
| 666 | 677 |
| 667 test('fixed length list', () => { | 678 test('fixed length list', () => { |
| 668 let list = new core.List(10); | 679 let list = new core.List(10); |
| 669 list[0] = 42; | 680 list[0] = 42; |
| 670 assert.throws(() => list.add(42)); | 681 assert.throws(() => list.add(42)); |
| 671 }); | 682 }); |
| 672 }); | 683 }); |
| OLD | NEW |