| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; |
| 90 let generic = dart.generic; | 90 let generic = dart.generic; |
| 91 let intIsNonNullable = false; | 91 let intIsNonNullable = false; |
| 92 let cast = dart.as; | 92 let cast = dart.as; |
| 93 let instanceOf = dart.is; | 93 let instanceOf = dart.is; |
| 94 let runtimeType = dart.realRuntimeType; | 94 let runtimeType = dart.realRuntimeType; |
| 95 let setRuntimeType = dart.setRuntimeType; | |
| 96 let functionType = dart.functionType; | 95 let functionType = dart.functionType; |
| 97 let typedef = dart.typedef; | 96 let typedef = dart.typedef; |
| 98 | 97 |
| 99 let Object = core.Object; | 98 let Object = core.Object; |
| 100 let String = core.String; | 99 let String = core.String; |
| 101 let dynamic = dart.dynamic; | 100 let dynamic = dart.dynamic; |
| 102 let List = core.List; | 101 let List = core.List; |
| 103 let Map = core.Map; | 102 let Map = core.Map; |
| 104 let Map$ = core.Map$; | 103 let Map$ = core.Map$; |
| 105 let int = core.int; | 104 let int = core.int; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 118 | 117 |
| 119 let Func2 = typedef('Func2', () => functionType(dynamic, [dynamic, dynamic])); | 118 let Func2 = typedef('Func2', () => functionType(dynamic, [dynamic, dynamic])); |
| 120 let Foo = typedef('Foo', () => functionType(B, [B, String])); | 119 let Foo = typedef('Foo', () => functionType(B, [B, String])); |
| 121 | 120 |
| 122 let FuncG$ = generic((T, U) => typedef('FuncG', () => functionType(T, [T, U]))
) | 121 let FuncG$ = generic((T, U) => typedef('FuncG', () => functionType(T, [T, U]))
) |
| 123 let FuncG = FuncG$(); | 122 let FuncG = FuncG$(); |
| 124 | 123 |
| 125 // TODO(vsm): Revisit when we encode types on functions properly. | 124 // TODO(vsm): Revisit when we encode types on functions properly. |
| 126 // A bar1(C c, String s) => null; | 125 // A bar1(C c, String s) => null; |
| 127 function bar1(c, s) { return null; } | 126 function bar1(c, s) { return null; } |
| 128 setRuntimeType(bar1, functionType(A, [C, String])); | 127 dart.fn(bar1, A, [C, String]); |
| 129 | 128 |
| 130 // bar2(B b, String s) => null; | 129 // bar2(B b, String s) => null; |
| 131 function bar2(b, s) { return null; } | 130 function bar2(b, s) { return null; } |
| 132 setRuntimeType(bar2, functionType(dynamic, [B, String])); | 131 dart.fn(bar2, dynamic, [B, String]); |
| 133 | 132 |
| 134 // B bar3(B b, Object o) => null; | 133 // B bar3(B b, Object o) => null; |
| 135 function bar3(b, o) { return null; } | 134 function bar3(b, o) { return null; } |
| 136 setRuntimeType(bar3, functionType(B, [B, Object])); | 135 dart.fn(bar3, B, [B, Object]); |
| 137 | 136 |
| 138 // B bar4(B b, o) => null; | 137 // B bar4(B b, o) => null; |
| 139 function bar4(b, o) { return null; } | 138 function bar4(b, o) { return null; } |
| 140 setRuntimeType(bar4, functionType(B, [B, dynamic])); | 139 dart.fn(bar4, B, [B, dynamic]); |
| 141 | 140 |
| 142 // C bar5(A a, Object o) => null; | 141 // C bar5(A a, Object o) => null; |
| 143 function bar5(a, o) { return null; } | 142 function bar5(a, o) { return null; } |
| 144 setRuntimeType(bar5, functionType(C, [A, Object])); | 143 dart.fn(bar5, C, [A, Object]); |
| 145 | 144 |
| 146 // B bar6(B b, String s, String o) => null; | 145 // B bar6(B b, String s, String o) => null; |
| 147 function bar6(b, s, o) { return null; } | 146 function bar6(b, s, o) { return null; } |
| 148 setRuntimeType(bar6, functionType(B, [B, String, String])); | 147 dart.fn(bar6, B, [B, String, String]); |
| 149 | 148 |
| 150 // B bar7(B b, String s, [Object o]) => null; | 149 // B bar7(B b, String s, [Object o]) => null; |
| 151 function bar7(b, s, o) { return null; } | 150 function bar7(b, s, o) { return null; } |
| 152 setRuntimeType(bar7, functionType(B, [B, String], [Object])); | 151 dart.fn(bar7, B, [B, String], [Object]); |
| 153 | 152 |
| 154 // B bar8(B b, String s, {Object p}) => null; | 153 // B bar8(B b, String s, {Object p}) => null; |
| 155 function bar8(b, s, o) { return null; } | 154 function bar8(b, s, o) { return null; } |
| 156 setRuntimeType(bar8, functionType(B, [B, String], {p: Object})); | 155 dart.fn(bar8, B, [B, String], {p: Object}); |
| 156 |
| 157 let cls1 = dart.fn((c, s) => { return null; }, A, [C, String]); |
| 158 |
| 159 let cls2 = dart.fn((b, s) => { return null; }, dynamic, [B, String]); |
| 160 |
| 161 let cls3 = dart.fn((b, o) => { return null; }, B, [B, Object]); |
| 162 |
| 163 let cls4 = dart.fn((b, o) => { return null; }, B, [B, dynamic]); |
| 164 |
| 165 let cls5 = dart.fn((a, o) => { return null; }, C, [A, Object]); |
| 166 |
| 167 let cls6 = dart.fn((b, s, o) => { return null; }, B, [B, String, String]); |
| 168 |
| 169 let cls7 = dart.fn((b, s, o) => { return null; }, B, [B, String], [Object]); |
| 170 |
| 171 let cls8 = |
| 172 dart.fn((b, s, o) => { return null; }, B, [B, String], {p: Object}); |
| 157 | 173 |
| 158 function checkType(x, type, expectedTrue) { | 174 function checkType(x, type, expectedTrue) { |
| 159 if (expectedTrue === undefined) expectedTrue = true; | 175 if (expectedTrue === undefined) expectedTrue = true; |
| 160 expect(instanceOf(x, type), expectedTrue); | 176 expect(instanceOf(x, type), expectedTrue); |
| 161 } | 177 } |
| 162 | 178 |
| 163 test('int', () => { | 179 test('int', () => { |
| 164 expect(isGroundType(int), true); | 180 expect(isGroundType(int), true); |
| 165 expect(isGroundType(runtimeType(5)), true); | 181 expect(isGroundType(runtimeType(5)), true); |
| 166 | 182 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 checkType(s1, c.SetMixin$(int), false); | 340 checkType(s1, c.SetMixin$(int), false); |
| 325 }); | 341 }); |
| 326 | 342 |
| 327 test('Functions', () => { | 343 test('Functions', () => { |
| 328 // - return type: Dart is bivariant. We're covariant. | 344 // - return type: Dart is bivariant. We're covariant. |
| 329 // - param types: Dart is bivariant. We're contravariant. | 345 // - param types: Dart is bivariant. We're contravariant. |
| 330 expect(isGroundType(Func2), true); | 346 expect(isGroundType(Func2), true); |
| 331 expect(isGroundType(Foo), false); | 347 expect(isGroundType(Foo), false); |
| 332 expect(isGroundType(functionType(B, [B, String])), false); | 348 expect(isGroundType(functionType(B, [B, String])), false); |
| 333 checkType(bar1, Foo, false); | 349 checkType(bar1, Foo, false); |
| 350 checkType(cls1, Foo, false); |
| 334 checkType(bar1, functionType(B, [B, String]), false); | 351 checkType(bar1, functionType(B, [B, String]), false); |
| 352 checkType(cls1, functionType(B, [B, String]), false); |
| 335 checkType(bar2, Foo, false); | 353 checkType(bar2, Foo, false); |
| 354 checkType(cls2, Foo, false); |
| 336 checkType(bar2, functionType(B, [B, String]), false); | 355 checkType(bar2, functionType(B, [B, String]), false); |
| 356 checkType(cls2, functionType(B, [B, String]), false); |
| 337 checkType(bar3, Foo); | 357 checkType(bar3, Foo); |
| 358 checkType(cls3, Foo); |
| 338 checkType(bar3, functionType(B, [B, String])); | 359 checkType(bar3, functionType(B, [B, String])); |
| 360 checkType(cls3, functionType(B, [B, String])); |
| 339 checkType(bar4, Foo, false); | 361 checkType(bar4, Foo, false); |
| 362 checkType(cls4, Foo, false); |
| 340 // TODO(vsm): Revisit. bar4 is (B, *) -> B. Perhaps it should be treated a
s top for a reified object. | 363 // TODO(vsm): Revisit. bar4 is (B, *) -> B. Perhaps it should be treated a
s top for a reified object. |
| 341 checkType(bar4, functionType(B, [B, String]), false); | 364 checkType(bar4, functionType(B, [B, String]), false); |
| 365 checkType(cls4, functionType(B, [B, String]), false); |
| 342 checkType(bar5, Foo); | 366 checkType(bar5, Foo); |
| 367 checkType(cls5, Foo); |
| 343 checkType(bar5, functionType(B, [B, String])); | 368 checkType(bar5, functionType(B, [B, String])); |
| 369 checkType(cls5, functionType(B, [B, String])); |
| 344 checkType(bar6, Foo, false); | 370 checkType(bar6, Foo, false); |
| 371 checkType(cls6, Foo, false); |
| 345 checkType(bar6, functionType(B, [B, String]), false); | 372 checkType(bar6, functionType(B, [B, String]), false); |
| 373 checkType(cls6, functionType(B, [B, String]), false); |
| 346 checkType(bar7, Foo); | 374 checkType(bar7, Foo); |
| 375 checkType(cls7, Foo); |
| 347 checkType(bar7, functionType(B, [B, String])); | 376 checkType(bar7, functionType(B, [B, String])); |
| 377 checkType(cls7, functionType(B, [B, String])); |
| 348 checkType(bar7, runtimeType(bar6)); | 378 checkType(bar7, runtimeType(bar6)); |
| 379 checkType(cls7, runtimeType(bar6)); |
| 349 checkType(bar8, Foo); | 380 checkType(bar8, Foo); |
| 381 checkType(cls8, Foo); |
| 350 checkType(bar8, functionType(B, [B, String])); | 382 checkType(bar8, functionType(B, [B, String])); |
| 383 checkType(cls8, functionType(B, [B, String])); |
| 351 checkType(bar8, runtimeType(bar6), false); | 384 checkType(bar8, runtimeType(bar6), false); |
| 385 checkType(cls8, runtimeType(bar6), false); |
| 352 checkType(bar7, runtimeType(bar8), false); | 386 checkType(bar7, runtimeType(bar8), false); |
| 387 checkType(cls7, runtimeType(bar8), false); |
| 353 checkType(bar8, runtimeType(bar7), false); | 388 checkType(bar8, runtimeType(bar7), false); |
| 389 checkType(cls8, runtimeType(bar7), false); |
| 354 | 390 |
| 355 // Parameterized typedefs | 391 // Parameterized typedefs |
| 356 expect(isGroundType(FuncG), true); | 392 expect(isGroundType(FuncG), true); |
| 357 expect(isGroundType(FuncG$(B, String)), false); | 393 expect(isGroundType(FuncG$(B, String)), false); |
| 358 checkType(bar1, FuncG$(B, String), false); | 394 checkType(bar1, FuncG$(B, String), false); |
| 395 checkType(cls1, FuncG$(B, String), false); |
| 359 checkType(bar3, FuncG$(B, String)); | 396 checkType(bar3, FuncG$(B, String)); |
| 397 checkType(cls3, FuncG$(B, String)); |
| 398 }); |
| 399 |
| 400 test('dcall', () => { |
| 401 function dd2d(x, y) {return x}; |
| 402 dart.fn(dd2d); |
| 403 function ii2i(x, y) {return x}; |
| 404 dart.fn(ii2i, core.int, [core.int, core.int]); |
| 405 function ii_2i(x, y) {return x}; |
| 406 dart.fn(ii_2i, core.int, [core.int], [core.int]); |
| 407 function i_i2i(x, opts) {return x}; |
| 408 dart.fn(i_i2i, core.int, [core.int], {extra: core.int}); |
| 409 |
| 410 assert.equal(dart.dcall(dd2d, 0, 1), 0); |
| 411 assert.equal(dart.dcall(dd2d, "hello", "world"), "hello"); |
| 412 assert.throws(() => dart.dcall(dd2d, 0)); |
| 413 assert.throws(() => dart.dcall(dd2d, 0, 1, 2)); |
| 414 assert.throws(() => dart.dcall(dd2d, 0, 1, {extra : 3})); |
| 415 // This should throw but currently doesn't. |
| 416 // assert.throws(() => dart.dcall(dd2d, 0, {extra:3})); |
| 417 |
| 418 assert.equal(dart.dcall(ii2i, 0, 1), 0); |
| 419 assert.throws(() => dart.dcall(ii2i, "hello", "world")); |
| 420 assert.throws(() => dart.dcall(ii2i, 0)); |
| 421 assert.throws(() => dart.dcall(ii2i, 0, 1, 2)); |
| 422 |
| 423 assert.equal(dart.dcall(ii_2i, 0, 1), 0); |
| 424 assert.throws(() => dart.dcall(ii_2i, "hello", "world")); |
| 425 assert.equal(dart.dcall(ii_2i, 0), 0); |
| 426 assert.throws(() => dart.dcall(ii_2i, 0, 1, 2)); |
| 427 |
| 428 assert.throws(() => dart.dcall(i_i2i, 0, 1)); |
| 429 assert.throws(() => dart.dcall(i_i2i, "hello", "world")); |
| 430 assert.equal(dart.dcall(i_i2i, 0), 0); |
| 431 assert.throws(() => dart.dcall(i_i2i, 0, 1, 2)); |
| 432 assert.equal(dart.dcall(i_i2i, 0, {extra: 3}), 0); |
| 433 }); |
| 434 |
| 435 test('dsend', () => { |
| 436 class Tester extends core.Object { |
| 437 Tester() { |
| 438 this.f = dart.fn(x => x, core.int, [core.int]); |
| 439 this.me = this; |
| 440 } |
| 441 m(x, y) {return x;} |
| 442 call(x) {return x;} |
| 443 static s(x, y) { return x;} |
| 444 } |
| 445 dart.setSignature(Tester, { |
| 446 methods: () => ({ |
| 447 m: dart.functionType(core.int, [core.int, core.int]), |
| 448 call: dart.functionType(core.int, [core.int]) |
| 449 }), |
| 450 statics: () => ({ |
| 451 s: dart.functionType(core.String, [core.String]) |
| 452 }), |
| 453 names: ['s'] |
| 454 }) |
| 455 let o = new Tester(); |
| 456 |
| 457 // Method send |
| 458 assert.equal(dart.dsend(o, 'm', 3, 4), 3); |
| 459 assert.throws(() => dart.dsend(o, 'm', 3)); |
| 460 assert.throws(() => dart.dsend(o, 'm', "hello", "world")); |
| 461 assert.throws(() => dart.dsend(o, 'q', 3)); |
| 462 |
| 463 // Method send through a field |
| 464 assert.equal(dart.dsend(o, 'f', 3), 3); |
| 465 assert.throws(() => dart.dsend(o, 'f', "hello")); |
| 466 assert.throws(() => dart.dsend(o, 'f', 3, 4)); |
| 467 |
| 468 // Static method call |
| 469 assert.equal(dart.dcall(Tester.s, "hello"), "hello"); |
| 470 assert.throws(() => dart.dcall(Tester.s, "hello", "world")); |
| 471 assert.throws(() => dart.dcall(Tester.s, 0, 1)); |
| 472 |
| 473 // Calling an object with a call method |
| 474 assert.equal(dart.dcall(o, 3), 3); |
| 475 assert.throws(() => dart.dcall(o, "hello")); |
| 476 assert.throws(() => dart.dcall(o, 3, 4)); |
| 477 |
| 478 // Calling through a field containing an object with a call method |
| 479 assert.equal(dart.dsend(o, 'me', 3), 3); |
| 480 assert.throws(() => dart.dsend(o, 'me', "hello")); |
| 481 assert.throws(() => dart.dsend(o, 'me', 3, 4)); |
| 482 }); |
| 483 |
| 484 test('Types on top level functions', () => { |
| 485 // Test some generated code |
| 486 // Test the lazy path |
| 487 checkType(core.identityHashCode, |
| 488 dart.functionType(core.int, [core.Object])); |
| 489 // Test the normal path |
| 490 checkType(core.identical, |
| 491 dart.functionType(core.bool, |
| 492 [core.Object, core.Object])); |
| 493 |
| 494 // Hand crafted tests |
| 495 // All dynamic |
| 496 function dd2d(x, y) {return x}; |
| 497 dart.fn(dd2d); |
| 498 checkType(dd2d, dart.functionType(dart.dynamic, |
| 499 [dart.dynamic, dart.dynamic])); |
| 500 |
| 501 // Set the type eagerly |
| 502 function ii2i(x, y) {return x}; |
| 503 dart.fn(ii2i, core.int, [core.int, core.int]); |
| 504 checkType(ii2i, dart.functionType(core.int, |
| 505 [core.int, core.int])); |
| 506 |
| 507 // Set the type lazily |
| 508 function ss2s(x, y) {return x}; |
| 509 var coreString; |
| 510 dart.fn(ss2s, () => dart.functionType(coreString, |
| 511 [coreString, coreString])); |
| 512 coreString = core.String; |
| 513 checkType(ss2s, dart.functionType(core.String, |
| 514 [core.String, core.String])); |
| 515 |
| 516 // Optional types |
| 517 function ii_2i(x, y) {return x}; |
| 518 dart.fn(ii_2i, core.int, [core.int], [core.int]); |
| 519 checkType(ii_2i, dart.functionType(core.int, [core.int], |
| 520 [core.int])); |
| 521 checkType(ii_2i, dart.functionType(core.int, [core.int, |
| 522 core.int])); |
| 523 checkType(ii_2i, dart.functionType(core.int, [], [core.int, |
| 524 core.int]), |
| 525 false); |
| 526 checkType(ii_2i, dart.functionType(core.int, [core.int], |
| 527 {extra: core.int}), false); |
| 528 |
| 529 // Named types |
| 530 function i_i2i(x, opts) {return x}; |
| 531 dart.fn(i_i2i, core.int, [core.int], {extra: core.int}); |
| 532 checkType(i_i2i, dart.functionType(core.int, [core.int], |
| 533 {extra: core.int})); |
| 534 checkType(i_i2i, dart.functionType(core.int, |
| 535 [core.int, core.int]), false); |
| 536 checkType(i_i2i, dart.functionType(core.int, [core.int], {})); |
| 537 checkType(i_i2i, |
| 538 dart.functionType(core.int, [], {extra: core.int, |
| 539 also: core.int}), false); |
| 540 checkType(i_i2i, |
| 541 dart.functionType(core.int, [core.int], [core.int]), false); |
| 542 }); |
| 543 |
| 544 test('Method tearoffs', () => { |
| 545 let c = collection; |
| 546 // Tear off of an inherited method |
| 547 let map = new (Map$(core.int, core.String))(); |
| 548 checkType(dart.tearoff(map, 'toString'), |
| 549 dart.functionType(String, [])); |
| 550 checkType(dart.tearoff(map, 'toString'), |
| 551 dart.functionType(int, []), false); |
| 552 |
| 553 // Tear off of a method directly on the object |
| 554 let smap = new (c.SplayTreeMap$(core.int, core.String))(); |
| 555 checkType(dart.tearoff(smap, 'forEach'), |
| 556 dart.functionType(dart.void, |
| 557 [dart.functionType(dart.void, [core.int, core.String])])); |
| 558 checkType(dart.tearoff(smap, 'forEach'), |
| 559 dart.functionType(dart.void, |
| 560 [dart.functionType(dart.void, |
| 561 [core.String, core.String])]), false); |
| 562 |
| 563 // Tear off of a mixed in method |
| 564 let mapB = new (c.MapBase$(core.int, core.int))(); |
| 565 checkType(dart.tearoff(mapB, 'forEach'), |
| 566 dart.functionType(dart.void, [ |
| 567 dart.functionType(dart.void, [core.int, core.int])])); |
| 568 checkType(dart.tearoff(mapB, 'forEach'), |
| 569 dart.functionType(dart.void, [ |
| 570 dart.functionType(dart.void, [core.int, core.String])]), |
| 571 false); |
| 572 |
| 573 // Tear off of a method with a symbol name |
| 574 let listB = new (c.ListBase$(core.int))(); |
| 575 checkType(dart.tearoff(listB, core.$add), |
| 576 dart.functionType(dart.void, [core.int])); |
| 577 checkType(dart.tearoff(listB, core.$add), |
| 578 dart.functionType(dart.void, [core.String]), false); |
| 579 |
| 580 // Tear off of a static method |
| 581 checkType(c.ListBase.listToString, |
| 582 dart.functionType(core.String, [core.List])); |
| 583 checkType(c.ListBase.listToString, |
| 584 dart.functionType(core.String, [core.String]), false); |
| 585 |
| 586 // Tear off a mixin method |
| 587 class Base { |
| 588 m(x) {return x;} |
| 589 }; |
| 590 dart.setSignature(Base, { |
| 591 methods: () => ({ |
| 592 m: dart.functionType(core.int, [core.int]), |
| 593 }) |
| 594 }); |
| 595 |
| 596 class M1 { |
| 597 m(x) {return x;} |
| 598 }; |
| 599 dart.setSignature(M1, { |
| 600 methods: () => ({ |
| 601 m: dart.functionType(core.num, [core.int]), |
| 602 }) |
| 603 }); |
| 604 |
| 605 class M2 { |
| 606 m(x) {return x;} |
| 607 }; |
| 608 dart.setSignature(M2, { |
| 609 methods: () => ({ |
| 610 m: dart.functionType(core.Object, [core.int]), |
| 611 }) |
| 612 }); |
| 613 |
| 614 class O extends dart.mixin(Base, M1, M2) { |
| 615 O() {}; |
| 616 }; |
| 617 dart.setSignature(O, {}); |
| 618 var obj = new O(); |
| 619 var m = dart.tearoff(obj, 'm'); |
| 620 checkType(m, dart.functionType(core.Object, [core.int])); |
| 621 checkType(m, dart.functionType(core.int, [core.int]), false); |
| 360 }); | 622 }); |
| 361 | 623 |
| 362 test('Object members', () => { | 624 test('Object members', () => { |
| 363 let nullHash = dart.hashCode(null); | 625 let nullHash = dart.hashCode(null); |
| 364 assert.equal(nullHash, 0); | 626 assert.equal(nullHash, 0); |
| 365 let nullString = dart.toString(null); | 627 let nullString = dart.toString(null); |
| 366 assert.equal(nullString, 'null'); | 628 assert.equal(nullString, 'null'); |
| 367 let nullType = dart.runtimeType(null); | 629 let nullType = dart.runtimeType(null); |
| 368 assert.equal(nullType, core.Null); | 630 assert.equal(nullType, core.Null); |
| 369 | 631 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 663 |
| 402 suite('primitives', function() { | 664 suite('primitives', function() { |
| 403 'use strict'; | 665 'use strict'; |
| 404 | 666 |
| 405 test('fixed length list', () => { | 667 test('fixed length list', () => { |
| 406 let list = new core.List(10); | 668 let list = new core.List(10); |
| 407 list[0] = 42; | 669 list[0] = 42; |
| 408 assert.throws(() => list.add(42)); | 670 assert.throws(() => list.add(42)); |
| 409 }); | 671 }); |
| 410 }); | 672 }); |
| OLD | NEW |