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

Side by Side Diff: test/codegen/expect/unittest.js

Issue 1484263002: Use destructuring assignments for named parameters (#180) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years 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 | « test/codegen/expect/temps.js ('k') | test/codegen/expect/unittest/unittest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('unittest', null, /* Imports */[ 1 dart_library.library('unittest', null, /* Imports */[
2 "dart/_runtime", 2 "dart/_runtime",
3 'matcher/matcher', 3 'matcher/matcher',
4 'dom/dom', 4 'dom/dom',
5 'dart/core', 5 'dart/core',
6 'dart/async', 6 'dart/async',
7 'matcher/src/interfaces', 7 'matcher/src/interfaces',
8 'matcher/src/util', 8 'matcher/src/util',
9 'matcher/src/description' 9 'matcher/src/description'
10 ], /* Lazy imports */[ 10 ], /* Lazy imports */[
11 ], function(exports, dart, matcher, dom, core, async, interfaces, util, descript ion$) { 11 ], function(exports, dart, matcher, dom, core, async, interfaces, util, descript ion$) {
12 'use strict'; 12 'use strict';
13 let dartx = dart.dartx; 13 let dartx = dart.dartx;
14 dart.export_(exports, matcher); 14 dart.export_(exports, matcher);
15 function group(name, body) { 15 function group(name, body) {
16 return dart.dsend(dom.window, 'suite', name, body); 16 return dart.dsend(dom.window, 'suite', name, body);
17 } 17 }
18 dart.fn(group, dart.void, [core.String, dart.functionType(dart.void, [])]); 18 dart.fn(group, dart.void, [core.String, dart.functionType(dart.void, [])]);
19 function test(name, body, opts) { 19 function test(name, body, {skip = null} = {}) {
20 let skip = opts && 'skip' in opts ? opts.skip : null;
21 if (skip != null) { 20 if (skip != null) {
22 core.print(`SKIP ${name}: ${skip}`); 21 core.print(`SKIP ${name}: ${skip}`);
23 return; 22 return;
24 } 23 }
25 dart.dsend(dom.window, 'test', name, dart.fn(done => { 24 dart.dsend(dom.window, 'test', name, dart.fn(done => {
26 function _finishTest(f) { 25 function _finishTest(f) {
27 if (dart.is(f, async.Future)) { 26 if (dart.is(f, async.Future)) {
28 dart.dsend(f, 'then', _finishTest); 27 dart.dsend(f, 'then', _finishTest);
29 } else { 28 } else {
30 dart.dcall(done); 29 dart.dcall(done);
31 } 30 }
32 } 31 }
33 dart.fn(_finishTest); 32 dart.fn(_finishTest);
34 _finishTest(body()); 33 _finishTest(body());
35 })); 34 }));
36 } 35 }
37 dart.fn(test, dart.void, [core.String, dart.functionType(dart.dynamic, [])], { skip: core.String}); 36 dart.fn(test, dart.void, [core.String, dart.functionType(dart.dynamic, [])], { skip: core.String});
38 class TestFailure extends core.Object { 37 class TestFailure extends core.Object {
39 TestFailure(message) { 38 TestFailure(message) {
40 this.message = message; 39 this.message = message;
41 } 40 }
42 toString() { 41 toString() {
43 return this.message; 42 return this.message;
44 } 43 }
45 } 44 }
46 dart.setSignature(TestFailure, { 45 dart.setSignature(TestFailure, {
47 constructors: () => ({TestFailure: [TestFailure, [core.String]]}) 46 constructors: () => ({TestFailure: [TestFailure, [core.String]]})
48 }); 47 });
49 const ErrorFormatter = dart.typedef('ErrorFormatter', () => dart.functionType( core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool ])); 48 const ErrorFormatter = dart.typedef('ErrorFormatter', () => dart.functionType( core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool ]));
50 function expect(actual, matcher, opts) { 49 function expect(actual, matcher, {reason = null, verbose = false, formatter = null} = {}) {
51 let reason = opts && 'reason' in opts ? opts.reason : null;
52 let verbose = opts && 'verbose' in opts ? opts.verbose : false;
53 let formatter = opts && 'formatter' in opts ? opts.formatter : null;
54 matcher = util.wrapMatcher(matcher); 50 matcher = util.wrapMatcher(matcher);
55 let matchState = dart.map(); 51 let matchState = dart.map();
56 try { 52 try {
57 if (dart.notNull(dart.as(dart.dsend(matcher, 'matches', actual, matchState ), core.bool))) 53 if (dart.notNull(dart.as(dart.dsend(matcher, 'matches', actual, matchState ), core.bool)))
58 return; 54 return;
59 } catch (e) { 55 } catch (e) {
60 let trace = dart.stackTrace(e); 56 let trace = dart.stackTrace(e);
61 if (reason == null) { 57 if (reason == null) {
62 reason = `${typeof e == 'string' ? e : dart.toString(e)} at ${trace}`; 58 reason = `${typeof e == 'string' ? e : dart.toString(e)} at ${trace}`;
63 } 59 }
(...skipping 23 matching lines...) Expand all
87 } 83 }
88 dart.fn(_defaultFailFormatter, core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool]); 84 dart.fn(_defaultFailFormatter, core.String, [dart.dynamic, interfaces.Matcher, core.String, core.Map, core.bool]);
89 // Exports: 85 // Exports:
90 exports.group = group; 86 exports.group = group;
91 exports.test = test; 87 exports.test = test;
92 exports.TestFailure = TestFailure; 88 exports.TestFailure = TestFailure;
93 exports.ErrorFormatter = ErrorFormatter; 89 exports.ErrorFormatter = ErrorFormatter;
94 exports.expect = expect; 90 exports.expect = expect;
95 exports.fail = fail; 91 exports.fail = fail;
96 }); 92 });
OLDNEW
« no previous file with comments | « test/codegen/expect/temps.js ('k') | test/codegen/expect/unittest/unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698