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

Unified Diff: test/browser/runtime_tests.js

Issue 1530563003: Generate all runtime files from dart. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged master 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/runtime_utils.dart ('k') | test/codegen/expect/8invalid-chars.in+file_name.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browser/runtime_tests.js
diff --git a/test/browser/runtime_tests.js b/test/browser/runtime_tests.js
index 030be22ac847fd6c3fb4f1d582bd22cd29b16f13..8e7bd4157578edebfcc8993b8c9c405252afbc86 100644
--- a/test/browser/runtime_tests.js
+++ b/test/browser/runtime_tests.js
@@ -8,13 +8,6 @@ var collection = dart_library.import('dart/collection');
var dart = dart_library.import('dart/_runtime');
var dartx = dart.dartx;
-// TODO(leafp): These are here to test some things not
-// currently exposed through the main dart entry point.
-// If we decide to expose them, this can go away.
-var classes = dart_library.import('dart/_classes');
-var types = dart_library.import('dart/_types');
-var dart_utils = dart_library.import('dart/_utils');
-
suite('generic', () => {
"use strict";
@@ -24,6 +17,20 @@ suite('generic', () => {
assert.throws(() => { generic(function(){}); });
});
+ test('dcall noSuchMethod has correct error target', () => {
+ assert.throws(() => dart.dcall(42),
+ new RegExp('NoSuchMethodError.*\nReceiver: 42', 'm'),
+ 'Calls with non-function receiver should throw a NoSuchMethodError' +
+ ' with correct target');
+
+ // TODO(jmesserly): we should show the name "print" in there somewhere.
+ assert.throws(() => dart.dcall(core.print, 1, 2, 3),
+ new RegExp('NoSuchMethodError.*\n' +
+ "Receiver: Instance of '\\(Object\\) -> void'", 'm'),
+ 'Calls with incorrect argument types should throw a NoSuchMethodError' +
+ ' with correct target');
+ });
+
test('can throw number', () => {
try {
dart.throw(42);
@@ -88,8 +95,8 @@ suite('generic', () => {
test('type constructor is reflectable', () => {
let SomeType = generic(function(x, y) { return Object.create(null); });
let someValue = SomeType('hi', 123);
- assert.equal(classes.getGenericClass(someValue), SomeType);
- assert.deepEqual(classes.getGenericArgs(someValue), ['hi', 123]);
+ assert.equal(dart.getGenericClass(someValue), SomeType);
+ assert.deepEqual(dart.getGenericArgs(someValue), ['hi', 123]);
});
test('proper type constructor is called', () => {
@@ -105,7 +112,7 @@ suite('instanceOf', () => {
"use strict";
let expect = assert.equal;
- let isGroundType = types.isGroundType;
+ let isGroundType = dart.isGroundType;
let generic = dart.generic;
let intIsNonNullable = false;
let cast = dart.as;
@@ -114,7 +121,7 @@ suite('instanceOf', () => {
let runtimeType = dart.realRuntimeType;
let functionType = dart.functionType;
let typedef = dart.typedef;
- let isSubtype = types.isSubtype;
+ let isSubtype = dart.isSubtype;
let Object = core.Object;
let String = core.String;
@@ -198,7 +205,7 @@ suite('instanceOf', () => {
if (!strongOnly) {
expect(instanceOf(x, type), expectedTrue);
} else {
- assert.throws(() => instanceOf(x, type), dart_utils.StrongModeError);
+ assert.throws(() => instanceOf(x, type), dart.StrongModeError);
expect(strongInstanceOf(x, type), expectedTrue);
}
}
@@ -307,23 +314,23 @@ suite('instanceOf', () => {
// Is checks
assert.throws(() => dart.is(m3, Map$(String, String)),
- dart_utils.StrongModeError);
+ dart.StrongModeError);
assert.throws(() => dart.is(m6, Map$(String, String)),
- dart_utils.StrongModeError);
+ dart.StrongModeError);
assert.isTrue(dart.is(m1, Map$(String, String)));
assert.throws(() => dart.is(m2, Map$(String, String)),
- dart_utils.StrongModeError);
+ dart.StrongModeError);
// As checks
// TODO(vsm): Enable these. We're currently only logging warnings on
// StrongModeErrors.
// assert.throws(() => dart.as(m3, Map$(String, String)),
- // dart_utils.StrongModeError);
+ // dart.StrongModeError);
// assert.throws(() => dart.as(m6, Map$(String, String)),
- // dart_utils.StrongModeError);
+ // dart.StrongModeError);
assert.equal(dart.as(m1, Map$(String, String)), m1);
// assert.throws(() => dart.as(m2, Map$(String, String)),
- // dart_utils.StrongModeError);
+ // dart.StrongModeError);
});
test('constructors', () => {
« no previous file with comments | « lib/src/runner/runtime_utils.dart ('k') | test/codegen/expect/8invalid-chars.in+file_name.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698