Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: test/browser/runtime_tests.js

Issue 1601353002: partial fix for #414, nSM message for dcall should show correct target (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_operations.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var core = dart_library.import('dart/core'); 6 var core = dart_library.import('dart/core');
7 var collection = dart_library.import('dart/collection'); 7 var collection = dart_library.import('dart/collection');
8 var dart = dart_library.import('dart/_runtime'); 8 var dart = dart_library.import('dart/_runtime');
9 var dartx = dart.dartx; 9 var dartx = dart.dartx;
10 10
11 // TODO(leafp): These are here to test some things not 11 // TODO(leafp): These are here to test some things not
12 // currently exposed through the main dart entry point. 12 // currently exposed through the main dart entry point.
13 // If we decide to expose them, this can go away. 13 // If we decide to expose them, this can go away.
14 var classes = dart_library.import('dart/_classes'); 14 var classes = dart_library.import('dart/_classes');
15 var types = dart_library.import('dart/_types'); 15 var types = dart_library.import('dart/_types');
16 var dart_utils = dart_library.import('dart/_utils'); 16 var dart_utils = dart_library.import('dart/_utils');
17 17
18 suite('generic', () => { 18 suite('generic', () => {
19 "use strict"; 19 "use strict";
20 20
21 let generic = dart.generic; 21 let generic = dart.generic;
22 22
23 test('zero arguments is not allowed', () => { 23 test('zero arguments is not allowed', () => {
24 assert.throws(() => { generic(function(){}); }); 24 assert.throws(() => { generic(function(){}); });
25 }); 25 });
26 26
27 test('dcall noSuchMethod has correct error target', () => {
28 assert.throws(() => dart.dcall(42),
29 new RegExp('NoSuchMethodError.*\nReceiver: 42', 'm'),
30 'Calls with non-function receiver should throw a NoSuchMethodError' +
31 ' with correct target');
32
33 // TODO(jmesserly): we should show the name "print" in there somewhere.
34 assert.throws(() => dart.dcall(core.print, 1, 2, 3),
35 new RegExp('NoSuchMethodError.*\n' +
36 "Receiver: Instance of '\\(Object\\) -> void'", 'm'),
37 'Calls with incorrect argument types should throw a NoSuchMethodError' +
38 ' with correct target');
39 });
40
27 test('can throw number', () => { 41 test('can throw number', () => {
28 try { 42 try {
29 dart.throw(42); 43 dart.throw(42);
30 } catch (e) { 44 } catch (e) {
31 assert.equal(e, 42); 45 assert.equal(e, 42);
32 } 46 }
33 }); 47 });
34 48
35 test('argument count cannot change', () => { 49 test('argument count cannot change', () => {
36 let SomeType = generic(function(x) { return {x: x}; }); 50 let SomeType = generic(function(x) { return {x: x}; });
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 791
778 suite('primitives', function() { 792 suite('primitives', function() {
779 'use strict'; 793 'use strict';
780 794
781 test('fixed length list', () => { 795 test('fixed length list', () => {
782 let list = new core.List(10); 796 let list = new core.List(10);
783 list[0] = 42; 797 list[0] = 42;
784 assert.throws(() => list.add(42)); 798 assert.throws(() => list.add(42));
785 }); 799 });
786 }); 800 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_operations.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698