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

Unified Diff: test/codegen/expect/unittest.js

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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 | « test/codegen/expect/try_catch.txt ('k') | test/codegen/expect/unittest.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/unittest.js
diff --git a/test/codegen/expect/unittest.js b/test/codegen/expect/unittest.js
index a319905ed91e9b4a003650707cdcbe0f90290868..5ad9ad4bc540c3fdb1ab2ab613fe018d814219c0 100644
--- a/test/codegen/expect/unittest.js
+++ b/test/codegen/expect/unittest.js
@@ -1,53 +1,61 @@
dart_library.library('unittest', null, /* Imports */[
- 'dart/_runtime',
- 'matcher/matcher',
- 'dom/dom',
- 'dart/core',
- 'dart/async',
- 'matcher/src/interfaces',
- 'matcher/src/util',
- 'matcher/src/description'
-], /* Lazy imports */[
-], function(exports, dart, matcher, dom, core, async, interfaces, util, description$) {
+ 'dart_sdk',
+ 'matcher'
+], function(exports, dart_sdk, matcher) {
'use strict';
- let dartx = dart.dartx;
- dart.export(exports, matcher);
- function group(name, body) {
- return dart.dsend(dom.window, 'suite', name, body);
- }
- dart.fn(group, dart.void, [core.String, dart.functionType(dart.void, [])]);
- function test(name, body, opts) {
+ const core = dart_sdk.core;
+ const js = dart_sdk.js;
+ const async = dart_sdk.async;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const interfaces = matcher.interfaces;
+ const util = matcher.util;
+ const description$ = matcher.description;
+ const numeric_matchers = matcher.numeric_matchers;
+ const error_matchers = matcher.error_matchers;
+ const core_matchers = matcher.core_matchers;
+ const iterable_matchers = matcher.iterable_matchers;
+ const string_matchers = matcher.string_matchers;
+ const operator_matchers = matcher.operator_matchers;
+ const map_matchers = matcher.map_matchers;
+ const unittest = Object.create(null);
+ unittest.group = function(name, body) {
+ return js.context.callMethod('suite', dart.list([name, body], core.Object));
+ };
+ dart.fn(unittest.group, dart.void, [core.String, dart.functionType(dart.void, [])]);
+ unittest.test = function(name, body, opts) {
let skip = opts && 'skip' in opts ? opts.skip : null;
if (skip != null) {
core.print(`SKIP ${name}: ${skip}`);
return;
}
- dart.dsend(dom.window, 'test', name, dart.fn(done => {
- function _finishTest(f) {
- if (dart.is(f, async.Future)) {
- f.then(_finishTest);
- } else {
- dart.dcall(done);
+ let result = dart.as(js.context.callMethod('test', dart.list([name, dart.fn(done => {
+ function _finishTest(f) {
+ if (dart.is(f, async.Future)) {
+ f.then(_finishTest);
+ } else {
+ done.apply([]);
+ }
}
- }
- dart.fn(_finishTest);
- _finishTest(body());
- }));
- }
- dart.fn(test, dart.void, [core.String, dart.functionType(dart.dynamic, [])], {skip: core.String});
- class TestFailure extends core.Object {
+ dart.fn(_finishTest);
+ _finishTest(body());
+ }, dart.dynamic, [js.JsFunction])], core.Object)), js.JsObject);
+ result.set('async', 1);
+ };
+ dart.fn(unittest.test, dart.void, [core.String, dart.functionType(dart.dynamic, [])], {skip: core.String});
+ unittest.TestFailure = class TestFailure extends core.Object {
TestFailure(message) {
this.message = message;
}
toString() {
return this.message;
}
- }
- dart.setSignature(TestFailure, {
- constructors: () => ({TestFailure: [TestFailure, [core.String]]})
+ };
+ dart.setSignature(unittest.TestFailure, {
+ constructors: () => ({TestFailure: [unittest.TestFailure, [core.String]]})
});
- const ErrorFormatter = dart.typedef('ErrorFormatter', () => dart.functionType(core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool]));
- function expect(actual, matcher, opts) {
+ unittest.ErrorFormatter = dart.typedef('ErrorFormatter', () => dart.functionType(core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool]));
+ unittest.expect = function(actual, matcher, opts) {
let reason = opts && 'reason' in opts ? opts.reason : null;
let verbose = opts && 'verbose' in opts ? opts.verbose : false;
let formatter = opts && 'formatter' in opts ? opts.formatter : null;
@@ -62,15 +70,15 @@ dart_library.library('unittest', null, /* Imports */[
}
}
- if (formatter == null) formatter = _defaultFailFormatter;
- fail(dart.dcall(formatter, actual, matcher, reason, matchState, verbose));
- }
- dart.fn(expect, dart.void, [dart.dynamic, dart.dynamic], {reason: core.String, verbose: core.bool, formatter: ErrorFormatter});
- function fail(message) {
- return dart.throw(new TestFailure(message));
- }
- dart.fn(fail, dart.void, [core.String]);
- function _defaultFailFormatter(actual, matcher, reason, matchState, verbose) {
+ if (formatter == null) formatter = unittest._defaultFailFormatter;
+ unittest.fail(dart.dcall(formatter, actual, matcher, reason, matchState, verbose));
+ };
+ dart.fn(unittest.expect, dart.void, [dart.dynamic, dart.dynamic], {reason: core.String, verbose: core.bool, formatter: unittest.ErrorFormatter});
+ unittest.fail = function(message) {
+ return dart.throw(new unittest.TestFailure(message));
+ };
+ dart.fn(unittest.fail, dart.void, [core.String]);
+ unittest._defaultFailFormatter = function(actual, matcher, reason, matchState, verbose) {
let description = new description$.StringDescription();
description.add('Expected: ').addDescriptionOf(matcher).add('\n');
description.add(' Actual: ').addDescriptionOf(actual).add('\n');
@@ -81,13 +89,80 @@ dart_library.library('unittest', null, /* Imports */[
}
if (reason != null) description.add(reason).add('\n');
return description.toString();
- }
- dart.fn(_defaultFailFormatter, core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool]);
+ };
+ dart.fn(unittest._defaultFailFormatter, core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool]);
+ unittest.isPositive = numeric_matchers.isPositive;
+ unittest.isRangeError = error_matchers.isRangeError;
+ unittest.isStateError = error_matchers.isStateError;
+ unittest.equals = core_matchers.equals;
+ unittest.CustomMatcher = core_matchers.CustomMatcher;
+ unittest.inOpenClosedRange = numeric_matchers.inOpenClosedRange;
+ unittest.pairwiseCompare = iterable_matchers.pairwiseCompare;
+ unittest.equalsIgnoringCase = string_matchers.equalsIgnoringCase;
+ unittest.isUnimplementedError = error_matchers.isUnimplementedError;
+ unittest.hasLength = core_matchers.hasLength;
+ unittest.StringDescription = description$.StringDescription;
+ unittest.allOf = operator_matchers.allOf;
+ unittest.isNegative = numeric_matchers.isNegative;
+ unittest.isInstanceOf$ = core_matchers.isInstanceOf$;
+ unittest.isInstanceOf = core_matchers.isInstanceOf;
+ unittest.isNaN = core_matchers.isNaN;
+ unittest.lessThan = numeric_matchers.lessThan;
+ unittest.isNotEmpty = core_matchers.isNotEmpty;
+ unittest.greaterThanOrEqualTo = numeric_matchers.greaterThanOrEqualTo;
+ unittest.endsWith = string_matchers.endsWith;
+ unittest.isConcurrentModificationError = error_matchers.isConcurrentModificationError;
+ unittest.containsValue = map_matchers.containsValue;
+ unittest.isFalse = core_matchers.isFalse;
+ unittest.isTrue = core_matchers.isTrue;
+ unittest.Matcher = interfaces.Matcher;
+ unittest.lessThanOrEqualTo = numeric_matchers.lessThanOrEqualTo;
+ unittest.matches = string_matchers.matches;
+ unittest.returnsNormally = core_matchers.returnsNormally;
+ unittest.TypeMatcher = core_matchers.TypeMatcher;
+ unittest.inExclusiveRange = numeric_matchers.inExclusiveRange;
+ unittest.equalsIgnoringWhitespace = string_matchers.equalsIgnoringWhitespace;
+ unittest.isIn = core_matchers.isIn;
+ unittest.isNotNaN = core_matchers.isNotNaN;
+ unittest.isNonZero = numeric_matchers.isNonZero;
+ unittest.startsWith = string_matchers.startsWith;
+ unittest.isNullThrownError = error_matchers.isNullThrownError;
+ unittest.isEmpty = core_matchers.isEmpty;
+ unittest.anyOf = operator_matchers.anyOf;
+ unittest.unorderedMatches = iterable_matchers.unorderedMatches;
+ unittest.isZero = numeric_matchers.isZero;
+ unittest.isList = core_matchers.isList;
+ unittest.escape = util.escape;
+ unittest.isCyclicInitializationError = error_matchers.isCyclicInitializationError;
+ unittest.anyElement = iterable_matchers.anyElement;
+ unittest.anything = core_matchers.anything;
+ unittest.contains = core_matchers.contains;
+ unittest.isUnsupportedError = error_matchers.isUnsupportedError;
+ unittest.isNonPositive = numeric_matchers.isNonPositive;
+ unittest.isNot = operator_matchers.isNot;
+ unittest.same = core_matchers.same;
+ unittest.inClosedOpenRange = numeric_matchers.inClosedOpenRange;
+ unittest.predicate = core_matchers.predicate;
+ unittest.isNotNull = core_matchers.isNotNull;
+ unittest.wrapMatcher = util.wrapMatcher;
+ unittest.isNoSuchMethodError = error_matchers.isNoSuchMethodError;
+ unittest.unorderedEquals = iterable_matchers.unorderedEquals;
+ unittest.everyElement = iterable_matchers.everyElement;
+ unittest.addStateInfo = util.addStateInfo;
+ unittest.isArgumentError = error_matchers.isArgumentError;
+ unittest.isException = error_matchers.isException;
+ unittest.inInclusiveRange = numeric_matchers.inInclusiveRange;
+ unittest.containsPair = map_matchers.containsPair;
+ unittest.isFormatException = error_matchers.isFormatException;
+ unittest.orderedEquals = iterable_matchers.orderedEquals;
+ unittest.collapseWhitespace = string_matchers.collapseWhitespace;
+ unittest.greaterThan = numeric_matchers.greaterThan;
+ unittest.isNonNegative = numeric_matchers.isNonNegative;
+ unittest.isNull = core_matchers.isNull;
+ unittest.isMap = core_matchers.isMap;
+ unittest.stringContainsInOrder = string_matchers.stringContainsInOrder;
+ unittest.closeTo = numeric_matchers.closeTo;
+ unittest.Description = interfaces.Description;
// Exports:
- exports.group = group;
- exports.test = test;
- exports.TestFailure = TestFailure;
- exports.ErrorFormatter = ErrorFormatter;
- exports.expect = expect;
- exports.fail = fail;
+ exports.unittest = unittest;
});
« no previous file with comments | « test/codegen/expect/try_catch.txt ('k') | test/codegen/expect/unittest.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698