From 0aa5cbd12897edb985147088cd8c97241b41ab47 Mon Sep 17 00:00:00 2001 From: John Messerly Date: Thu, 11 Aug 2016 13:19:36 -0700 Subject: [PATCH] fix #620, infer the input files from sources also simplifies build of packages used by our tests this caused a bunch of tests that use parts to start passing R=nweiz@google.com Review URL: https://codereview.chromium.org/2234343003 . --- pkg/dev_compiler/karma.conf.js | 8 +- .../lib/src/compiler/code_generator.dart | 2 +- .../lib/src/compiler/compiler.dart | 64 +- pkg/dev_compiler/pubspec.lock | 3 +- .../test/browser/language_tests.js | 20 +- .../async_helper/async_helper.js | 76 - .../test/codegen_expected/destructuring.js | 15 + .../test/codegen_expected/expect/expect.js | 304 -- .../test/codegen_expected/js/js.js | 31 - .../language/application_test.js | 16 +- .../language/cyclic_import_test.js | 558 +-- .../language/export_double_same_main_test.js | 23 +- .../language/export_main_override_test.js | 22 +- .../language/export_main_test.js | 19 +- .../language/generic_instanceof_test.js | 165 +- .../language/hello_script_test.js | 39 +- .../language/inline_super_test.js | 44 +- .../language/lazy_static6_test.js | 28 +- .../language/library1_test.js | 43 +- .../language/library_juxtaposition_test.js | 23 +- .../language/library_prefixes_test.js | 351 +- .../language/many_generic_instanceof_test.js | 174 +- .../language/multi_pass2_test.js | 53 +- .../language/multi_pass_test.js | 53 +- .../codegen_expected/language/part_test.js | 18 +- .../language/private2_test.js | 50 +- .../language/regress_18535_test.js | 18 +- .../language/top_level_entry_test.js | 16 +- .../language/top_level_multiple_files_test.js | 25 +- .../top_level_non_prefixed_library_test.js | 27 +- .../test/codegen_expected/matcher/matcher.js | 2009 --------- .../test/codegen_expected/path/path.js | 1092 ----- .../stack_trace/stack_trace.js | 797 ---- .../codegen_expected/unittest/unittest.js | 3740 ----------------- .../test/codegen_expected/varargs.js | 15 + pkg/dev_compiler/test/codegen_test.dart | 124 +- pkg/dev_compiler/test/worker/worker_test.dart | 21 +- pkg/dev_compiler/tool/build_test_pkgs.sh | 34 + pkg/dev_compiler/tool/sdk_expected_errors.txt | 6 - pkg/dev_compiler/tool/test.sh | 2 + 40 files changed, 1301 insertions(+), 8827 deletions(-) delete mode 100644 pkg/dev_compiler/test/codegen_expected/async_helper/async_helper.js delete mode 100644 pkg/dev_compiler/test/codegen_expected/expect/expect.js delete mode 100644 pkg/dev_compiler/test/codegen_expected/js/js.js delete mode 100644 pkg/dev_compiler/test/codegen_expected/matcher/matcher.js delete mode 100644 pkg/dev_compiler/test/codegen_expected/path/path.js delete mode 100644 pkg/dev_compiler/test/codegen_expected/stack_trace/stack_trace.js delete mode 100644 pkg/dev_compiler/test/codegen_expected/unittest/unittest.js create mode 100755 pkg/dev_compiler/tool/build_test_pkgs.sh diff --git a/pkg/dev_compiler/karma.conf.js b/pkg/dev_compiler/karma.conf.js index ff8e12d567b9..49abf9d8e879 100644 --- a/pkg/dev_compiler/karma.conf.js +++ b/pkg/dev_compiler/karma.conf.js @@ -15,13 +15,7 @@ module.exports = function(config) { files: [ 'lib/runtime/dart_*.js', // {pattern: 'test/browser/*.js', included: false} - 'gen/codegen_output/async_helper/async_helper.js', - 'gen/codegen_output/expect/expect.js', - 'gen/codegen_output/path/path.js', - 'gen/codegen_output/stack_trace/stack_trace.js', - 'gen/codegen_output/js/js.js', - 'gen/codegen_output/matcher/matcher.js', - 'gen/codegen_output/unittest/unittest.js', + 'gen/codegen_output/pkg/*.js', 'gen/codegen_output/language/**.js', 'gen/codegen_output/language/**.err', 'gen/codegen_output/corelib/**.js', diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart index d990f27e9f64..d7567ad260ab 100644 --- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart +++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart @@ -236,7 +236,7 @@ class CodeGenerator extends GeneralizingAstVisitor items.add(new JS.ExportDeclaration( js.call('const # = Object.create(null)', [libraryTemp]))); - // dart:_runtime has a magic module that holds extenstion method symbols. + // dart:_runtime has a magic module that holds extension method symbols. // TODO(jmesserly): find a cleaner design for this. if (_isDartRuntime(library)) { items.add(new JS.ExportDeclaration( diff --git a/pkg/dev_compiler/lib/src/compiler/compiler.dart b/pkg/dev_compiler/lib/src/compiler/compiler.dart index a708b3c0f0fd..63ccc69ed73d 100644 --- a/pkg/dev_compiler/lib/src/compiler/compiler.dart +++ b/pkg/dev_compiler/lib/src/compiler/compiler.dart @@ -2,21 +2,19 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:collection' show HashSet; -import 'package:args/args.dart' show ArgParser, ArgResults; -import 'package:args/src/usage_exception.dart' show UsageException; +import 'dart:collection' show HashSet, Queue; +import 'package:analyzer/dart/element/element.dart' show LibraryElement; import 'package:analyzer/analyzer.dart' - show - AnalysisError, - CompilationUnit, - CompileTimeErrorCode, - ErrorSeverity, - StaticWarningCode; + show AnalysisError, CompilationUnit, ErrorSeverity; import 'package:analyzer/file_system/file_system.dart' show ResourceProvider; import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; import 'package:analyzer/src/generated/source.dart' show DartUriResolver; import 'package:analyzer/src/generated/source_io.dart' show Source, SourceKind, UriResolver; +import 'package:analyzer/src/summary/package_bundle_reader.dart' + show InSummarySource; +import 'package:args/args.dart' show ArgParser, ArgResults; +import 'package:args/src/usage_exception.dart' show UsageException; import 'package:func/func.dart' show Func1; import 'package:path/path.dart' as path; @@ -76,14 +74,15 @@ class ModuleCompiler { var trees = []; var errors = []; - // Validate that all parts were explicitly passed in. - // If not, it's an error. - var explicitParts = new HashSet(); - var usedParts = new HashSet(); + var librariesToCompile = new Queue(); + + var compilingSdk = false; for (var sourcePath in unit.sources) { var sourceUri = Uri.parse(sourcePath); if (sourceUri.scheme == '') { sourceUri = path.toUri(path.absolute(sourcePath)); + } else if (sourceUri.scheme == 'dart') { + compilingSdk = true; } Source source = context.sourceFactory.forUri2(sourceUri); @@ -101,31 +100,32 @@ class ModuleCompiler { // Ignore parts. They need to be handled in the context of their library. if (context.computeKindOf(source) == SourceKind.PART) { - explicitParts.add(source); continue; } - var resolvedTree = context.resolveCompilationUnit2(source, source); - trees.add(resolvedTree); - errors.addAll(context.computeErrors(source)); + librariesToCompile.add(context.computeLibraryElement(source)); + } + + var libraries = new HashSet(); + while (librariesToCompile.isNotEmpty) { + var library = librariesToCompile.removeFirst(); + if (library.source is InSummarySource) continue; + if (!compilingSdk && library.source.isInSystemLibrary) continue; + if (!libraries.add(library)) continue; + + librariesToCompile.addAll(library.importedLibraries); + librariesToCompile.addAll(library.exportedLibraries); + + var tree = context.resolveCompilationUnit(library.source, library); + trees.add(tree); + errors.addAll(context.computeErrors(library.source)); - var library = resolvedTree.element.library; for (var part in library.parts) { - if (!library.isInSdk) usedParts.add(part.source); trees.add(context.resolveCompilationUnit(part.source, library)); errors.addAll(context.computeErrors(part.source)); } } - // Check if all parts were explicitly passed in. - // Also verify all explicitly parts were used. - var missingParts = usedParts.difference(explicitParts); - var unusedParts = explicitParts.difference(usedParts); - errors.addAll(missingParts - .map((s) => new AnalysisError(s, 0, 0, missingPartErrorCode))); - errors.addAll(unusedParts - .map((s) => new AnalysisError(s, 0, 0, unusedPartWarningCode))); - sortErrors(context, errors); var messages = []; for (var e in errors) { @@ -365,11 +365,3 @@ class JSModuleFile { return map; } } - -/// (Public for tests) the error code used when a part is missing. -final missingPartErrorCode = const CompileTimeErrorCode( - 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); - -/// (Public for tests) the error code used when a part is unused. -final unusedPartWarningCode = const StaticWarningCode('UNUSED_PART', - 'The part was not used by any libraries being compiled.', null, false); diff --git a/pkg/dev_compiler/pubspec.lock b/pkg/dev_compiler/pubspec.lock index 9dd9ab4bc8a1..49a8211fcae3 100644 --- a/pkg/dev_compiler/pubspec.lock +++ b/pkg/dev_compiler/pubspec.lock @@ -319,4 +319,5 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.10" -sdk: ">=1.17.0-dev.6.2 <2.0.0" +sdks: + dart: ">=1.17.0-dev.6.2 <2.0.0" diff --git a/pkg/dev_compiler/test/browser/language_tests.js b/pkg/dev_compiler/test/browser/language_tests.js index 1b930af951e9..64af69b041fc 100644 --- a/pkg/dev_compiler/test/browser/language_tests.js +++ b/pkg/dev_compiler/test/browser/language_tests.js @@ -202,6 +202,7 @@ 'generic_field_mixin4_test': skip_fail, 'generic_field_mixin5_test': skip_fail, 'generic_field_mixin_test': skip_fail, + 'generic_instanceof_test': fail, // runtime strong mode reject 'generic_instanceof2_test': skip_fail, 'generic_is_check_test': skip_fail, 'getter_closure_execution_order_test': skip_fail, @@ -338,7 +339,6 @@ 'abstract_runtime_error_test_03_multi': notyetstrong, 'abstract_syntax_test_00_multi': notyetstrong, 'abstract_syntax_test_01_multi': notyetstrong, - 'application_test': notyetstrong, 'argument_definition_test_01_multi': notyetstrong, 'arithmetic_test': notyetstrong, 'assign_static_type_test_01_multi': notyetstrong, @@ -937,9 +937,6 @@ 'enum_syntax_test_30_multi': notyetstrong, 'error_stacktrace_test': notyetstrong, 'example_constructor_test': notyetstrong, - 'export_double_same_main_test': notyetstrong, - 'export_main_override_test': notyetstrong, - 'export_main_test': notyetstrong, 'external_test_01_multi': notyetstrong, 'external_test_02_multi': notyetstrong, 'external_test_11_multi': notyetstrong, @@ -1118,7 +1115,6 @@ 'generic_constructor_mixin_test': notyetstrong, 'generic_field_mixin6_test_01_multi': notyetstrong, 'generic_field_mixin6_test_none_multi': notyetstrong, - 'generic_instanceof_test': notyetstrong, 'generic_list_checked_test': notyetstrong, 'generic_test': notyetstrong, 'generics_test': notyetstrong, @@ -1157,7 +1153,6 @@ 'getter_setter_in_lib_test': notyetstrong, 'getters_setters2_test_02_multi': notyetstrong, 'getters_setters2_test_03_multi': notyetstrong, - 'hello_script_test': notyetstrong, 'hidden_import_test_01_multi': notyetstrong, 'hidden_import_test_02_multi': notyetstrong, 'identical_const_test_01_multi': notyetstrong, @@ -1239,7 +1234,6 @@ 'inferrer_this_access_test': notyetstrong, 'inline_effect_context_test': notyetstrong, 'inline_in_for_initializer_and_bailout_test': notyetstrong, - 'inline_super_test': notyetstrong, 'inline_test_context_test': notyetstrong, 'inline_value_context_test': notyetstrong, 'inlined_throw_test': notyetstrong, @@ -1281,7 +1275,6 @@ 'keyword_type_expression_test_02_multi': notyetstrong, 'keyword_type_expression_test_03_multi': notyetstrong, 'label_test': notyetstrong, - 'lazy_static6_test': notyetstrong, 'least_upper_bound_expansive_test_01_multi': notyetstrong, 'least_upper_bound_expansive_test_02_multi': notyetstrong, 'least_upper_bound_expansive_test_03_multi': notyetstrong, @@ -1305,15 +1298,12 @@ 'least_upper_bound_test_29_multi': notyetstrong, 'least_upper_bound_test_30_multi': notyetstrong, 'least_upper_bound_test_32_multi': notyetstrong, - 'library1_test': notyetstrong, 'library_ambiguous_test_00_multi': notyetstrong, 'library_ambiguous_test_01_multi': notyetstrong, 'library_ambiguous_test_02_multi': notyetstrong, 'library_ambiguous_test_03_multi': notyetstrong, 'library_ambiguous_test_04_multi': notyetstrong, 'library_ambiguous_test_05_multi': notyetstrong, - 'library_juxtaposition_test': notyetstrong, - 'library_prefixes_test': notyetstrong, 'list_double_index_in_loop2_test': notyetstrong, 'list_double_index_in_loop_test': notyetstrong, 'list_literal1_test_01_multi': notyetstrong, @@ -1565,8 +1555,6 @@ 'mixin_type_parameters_super_extends_test': notyetstrong, 'mixin_type_parameters_super_test': notyetstrong, 'mixin_with_two_implicit_constructors_test': notyetstrong, - 'multi_pass2_test': notyetstrong, - 'multi_pass_test': notyetstrong, 'multiline_newline_test_01_multi': notyetstrong, 'multiline_newline_test_02_multi': notyetstrong, 'multiline_newline_test_03_multi': notyetstrong, @@ -1754,7 +1742,6 @@ 'parameter_initializer_test': notyetstrong, 'parser_quirks_test': notyetstrong, 'part2_test': notyetstrong, - 'part_test': notyetstrong, 'positional_parameters_type_test_01_multi': notyetstrong, 'positional_parameters_type_test_02_multi': notyetstrong, 'prefix14_test': notyetstrong, @@ -1771,7 +1758,6 @@ 'prefix_identifier_reference_test_05_multi': notyetstrong, 'prefix_unqualified_invocation_test_01_multi': notyetstrong, 'prefix_unqualified_invocation_test_02_multi': notyetstrong, - 'private2_test': notyetstrong, 'private3_test': notyetstrong, 'private_access_test_01_multi': notyetstrong, 'private_access_test_02_multi': notyetstrong, @@ -2051,10 +2037,8 @@ 'this_test_07_multi': notyetstrong, 'this_test_08_multi': notyetstrong, 'throw_expr_test': notyetstrong, - 'top_level_entry_test': notyetstrong, 'top_level_getter_no_setter1_test_01_multi': notyetstrong, 'top_level_getter_no_setter2_test_01_multi': notyetstrong, - 'top_level_multiple_files_test': notyetstrong, 'toplevel_collision1_test_00_multi': notyetstrong, 'toplevel_collision1_test_01_multi': notyetstrong, 'toplevel_collision1_test_02_multi': notyetstrong, @@ -2496,7 +2480,7 @@ 'package_resource_test': notyetstrong, 'print_test_01_multi': notyetstrong, 'print_test_none_multi': notyetstrong, - 'set_test': notyetstrong, + 'set_test': fail, // runtime strong mode reject 'splay_tree_test': notyetstrong, 'string_base_vm_test': notyetstrong, 'string_from_environment3_test_01_multi': notyetstrong, diff --git a/pkg/dev_compiler/test/codegen_expected/async_helper/async_helper.js b/pkg/dev_compiler/test/codegen_expected/async_helper/async_helper.js deleted file mode 100644 index cb018a89fa0d..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/async_helper/async_helper.js +++ /dev/null @@ -1,76 +0,0 @@ -dart_library.library('async_helper', null, /* Imports */[ - 'dart_sdk' -], function load__async_helper(exports, dart_sdk) { - 'use strict'; - const core = dart_sdk.core; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const async_helper = Object.create(null); - let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))(); - let StringToException = () => (StringToException = dart.constFn(dart.definiteFunctionType(core.Exception, [core.String])))(); - let _Action0Tovoid = () => (_Action0Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async_helper._Action0])))(); - let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))(); - let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic])))(); - let FnTovoid = () => (FnTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [VoidTodynamic()])))(); - async_helper._initialized = false; - async_helper._Action0 = dart.typedef('_Action0', () => dart.functionType(dart.void, [])); - async_helper._onAsyncEnd = null; - async_helper._asyncLevel = 0; - async_helper._buildException = function(msg) { - return core.Exception.new(dart.str`Fatal: ${msg}. This is most likely a bug in your test.`); - }; - dart.fn(async_helper._buildException, StringToException()); - async_helper.asyncTestInitialize = function(callback) { - async_helper._asyncLevel = 0; - async_helper._initialized = false; - async_helper._onAsyncEnd = callback; - }; - dart.fn(async_helper.asyncTestInitialize, _Action0Tovoid()); - dart.copyProperties(async_helper, { - get asyncTestStarted() { - return async_helper._initialized; - } - }); - async_helper.asyncStart = function() { - if (dart.test(async_helper._initialized) && async_helper._asyncLevel == 0) { - dart.throw(async_helper._buildException('asyncStart() was called even though we are done ' + 'with testing.')); - } - if (!dart.test(async_helper._initialized)) { - if (async_helper._onAsyncEnd == null) { - dart.throw(async_helper._buildException('asyncStart() was called before asyncTestInitialize()')); - } - core.print('unittest-suite-wait-for-done'); - async_helper._initialized = true; - } - async_helper._asyncLevel = dart.notNull(async_helper._asyncLevel) + 1; - }; - dart.fn(async_helper.asyncStart, VoidTovoid()); - async_helper.asyncEnd = function() { - if (dart.notNull(async_helper._asyncLevel) <= 0) { - if (!dart.test(async_helper._initialized)) { - dart.throw(async_helper._buildException('asyncEnd() was called before asyncStart().')); - } else { - dart.throw(async_helper._buildException('asyncEnd() was called more often than ' + 'asyncStart().')); - } - } - async_helper._asyncLevel = dart.notNull(async_helper._asyncLevel) - 1; - if (async_helper._asyncLevel == 0) { - let callback = async_helper._onAsyncEnd; - async_helper._onAsyncEnd = null; - callback(); - core.print('unittest-suite-success'); - } - }; - dart.fn(async_helper.asyncEnd, VoidTovoid()); - async_helper.asyncSuccess = function(_) { - return async_helper.asyncEnd(); - }; - dart.fn(async_helper.asyncSuccess, dynamicTovoid()); - async_helper.asyncTest = function(f) { - async_helper.asyncStart(); - dart.dsend(f(), 'then', async_helper.asyncSuccess); - }; - dart.fn(async_helper.asyncTest, FnTovoid()); - // Exports: - exports.async_helper = async_helper; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/destructuring.js b/pkg/dev_compiler/test/codegen_expected/destructuring.js index 832872dd741d..4365000fe3b2 100644 --- a/pkg/dev_compiler/test/codegen_expected/destructuring.js +++ b/pkg/dev_compiler/test/codegen_expected/destructuring.js @@ -6,6 +6,7 @@ dart_library.library('destructuring', null, /* Imports */[ const dart = dart_sdk.dart; const dartx = dart_sdk.dartx; const destructuring = Object.create(null); + const src__varargs = Object.create(null); let intAnddynamic__Todynamic = () => (intAnddynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.int, dart.dynamic], [dart.dynamic])))(); let intAnddynamic__Todynamic$ = () => (intAnddynamic__Todynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.int, dart.dynamic], {c: dart.dynamic})))(); let intAnddynamicTodynamic = () => (intAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.int, dart.dynamic])))(); @@ -13,6 +14,7 @@ dart_library.library('destructuring', null, /* Imports */[ let __Todynamic = () => (__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [], [core.int, dart.dynamic, dart.dynamic])))(); let __Todynamic$ = () => (__Todynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [], {let: core.int, function: dart.dynamic, arguments: dart.dynamic})))(); let __Todynamic$0 = () => (__Todynamic$0 = dart.constFn(dart.definiteFunctionType(dart.dynamic, [], {constructor: core.int, valueOf: dart.dynamic, hasOwnProperty: dart.dynamic})))(); + let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))(); destructuring.f = function(a, b, c = 1) { destructuring.f(a, b, c); }; @@ -71,6 +73,19 @@ dart_library.library('destructuring', null, /* Imports */[ destructuring.f(constructor, valueOf, hasOwnProperty); }; dart.fn(destructuring.names_clashing_with_object_props, __Todynamic$0()); + src__varargs._Rest = class _Rest extends core.Object { + new() { + } + }; + dart.setSignature(src__varargs._Rest, { + constructors: () => ({new: dart.definiteFunctionType(src__varargs._Rest, [])}) + }); + src__varargs.rest = dart.const(new src__varargs._Rest()); + src__varargs.spread = function(args) { + dart.throw(new core.StateError('The spread function cannot be called, ' + 'it should be compiled away.')); + }; + dart.fn(src__varargs.spread, dynamicTodynamic()); // Exports: exports.destructuring = destructuring; + exports.src__varargs = src__varargs; }); diff --git a/pkg/dev_compiler/test/codegen_expected/expect/expect.js b/pkg/dev_compiler/test/codegen_expected/expect/expect.js deleted file mode 100644 index 9094b2095db7..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/expect/expect.js +++ /dev/null @@ -1,304 +0,0 @@ -dart_library.library('expect', null, /* Imports */[ - 'dart_sdk' -], function load__expect(exports, dart_sdk) { - 'use strict'; - const core = dart_sdk.core; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const expect = Object.create(null); - let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic])))(); - expect.Expect = class Expect extends core.Object { - static _truncateString(string, start, end, length) { - if (dart.notNull(end) - dart.notNull(start) > dart.notNull(length)) { - end = dart.notNull(start) + dart.notNull(length); - } else if (dart.notNull(end) - dart.notNull(start) < dart.notNull(length)) { - let overflow = dart.notNull(length) - (dart.notNull(end) - dart.notNull(start)); - if (overflow > 10) overflow = 10; - start = dart.notNull(start) - ((overflow + 1) / 2)[dartx.truncate](); - end = dart.notNull(end) + (overflow / 2)[dartx.truncate](); - if (dart.notNull(start) < 0) start = 0; - if (dart.notNull(end) > dart.notNull(string[dartx.length])) end = string[dartx.length]; - } - if (start == 0 && end == string[dartx.length]) return string; - let buf = new core.StringBuffer(); - if (dart.notNull(start) > 0) buf.write("..."); - for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { - let code = string[dartx.codeUnitAt](i); - if (dart.notNull(code) < 32) { - buf.write("\\x"); - buf.write("0123456789abcdef"[dartx.get]((dart.notNull(code) / 16)[dartx.truncate]())); - buf.write("0123456789abcdef"[dartx.get](code[dartx['%']](16))); - } else { - buf.writeCharCode(string[dartx.codeUnitAt](i)); - } - } - if (dart.notNull(end) < dart.notNull(string[dartx.length])) buf.write("..."); - return buf.toString(); - } - static _stringDifference(expected, actual) { - if (dart.notNull(expected[dartx.length]) < 20 && dart.notNull(actual[dartx.length]) < 20) return null; - for (let i = 0; i < dart.notNull(expected[dartx.length]) && i < dart.notNull(actual[dartx.length]); i++) { - if (expected[dartx.codeUnitAt](i) != actual[dartx.codeUnitAt](i)) { - let start = i; - i++; - while (i < dart.notNull(expected[dartx.length]) && i < dart.notNull(actual[dartx.length])) { - if (expected[dartx.codeUnitAt](i) == actual[dartx.codeUnitAt](i)) break; - i++; - } - let end = i; - let truncExpected = expect.Expect._truncateString(expected, start, end, 20); - let truncActual = expect.Expect._truncateString(actual, start, end, 20); - return dart.str`at index ${start}: Expected <${truncExpected}>, ` + dart.str`Found: <${truncActual}>`; - } - } - return null; - } - static equals(expected, actual, reason) { - if (reason === void 0) reason = null; - if (dart.equals(expected, actual)) return; - let msg = expect.Expect._getMessage(reason); - if (typeof expected == 'string' && typeof actual == 'string') { - let stringDifference = expect.Expect._stringDifference(expected, actual); - if (stringDifference != null) { - expect.Expect._fail(dart.str`Expect.equals(${stringDifference}${msg}) fails.`); - } - } - expect.Expect._fail(dart.str`Expect.equals(expected: <${expected}>, actual: <${actual}>${msg}) fails.`); - } - static isTrue(actual, reason) { - if (reason === void 0) reason = null; - if (dart.test(expect._identical(actual, true))) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.isTrue(${actual}${msg}) fails.`); - } - static isFalse(actual, reason) { - if (reason === void 0) reason = null; - if (dart.test(expect._identical(actual, false))) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.isFalse(${actual}${msg}) fails.`); - } - static isNull(actual, reason) { - if (reason === void 0) reason = null; - if (null == actual) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.isNull(actual: <${actual}>${msg}) fails.`); - } - static isNotNull(actual, reason) { - if (reason === void 0) reason = null; - if (null != actual) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.isNotNull(actual: <${actual}>${msg}) fails.`); - } - static identical(expected, actual, reason) { - if (reason === void 0) reason = null; - if (dart.test(expect._identical(expected, actual))) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.identical(expected: <${expected}>, actual: <${actual}>${msg}) ` + "fails."); - } - static fail(msg) { - expect.Expect._fail(dart.str`Expect.fail('${msg}')`); - } - static approxEquals(expected, actual, tolerance, reason) { - if (tolerance === void 0) tolerance = null; - if (reason === void 0) reason = null; - if (tolerance == null) { - tolerance = (dart.notNull(expected) / 10000.0)[dartx.abs](); - } - if (dart.notNull((dart.notNull(expected) - dart.notNull(actual))[dartx.abs]()) <= dart.notNull(tolerance)) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.approxEquals(expected:<${expected}>, actual:<${actual}>, ` + dart.str`tolerance:<${tolerance}>${msg}) fails`); - } - static notEquals(unexpected, actual, reason) { - if (reason === void 0) reason = null; - if (!dart.equals(unexpected, actual)) return; - let msg = expect.Expect._getMessage(reason); - expect.Expect._fail(dart.str`Expect.notEquals(unexpected: <${unexpected}>, actual:<${actual}>${msg}) ` + "fails."); - } - static listEquals(expected, actual, reason) { - if (reason === void 0) reason = null; - let msg = expect.Expect._getMessage(reason); - let n = dart.notNull(expected[dartx.length]) < dart.notNull(actual[dartx.length]) ? expected[dartx.length] : actual[dartx.length]; - for (let i = 0; i < dart.notNull(n); i++) { - if (!dart.equals(expected[dartx.get](i), actual[dartx.get](i))) { - expect.Expect._fail(dart.str`Expect.listEquals(at index ${i}, ` + dart.str`expected: <${expected[dartx.get](i)}>, actual: <${actual[dartx.get](i)}>${msg}) fails`); - } - } - if (expected[dartx.length] != actual[dartx.length]) { - expect.Expect._fail('Expect.listEquals(list length, ' + dart.str`expected: <${expected[dartx.length]}>, actual: <${actual[dartx.length]}>${msg}) ` + 'fails: Next element <' + dart.str`${dart.notNull(expected[dartx.length]) > dart.notNull(n) ? expected[dartx.get](n) : actual[dartx.get](n)}>`); - } - } - static mapEquals(expected, actual, reason) { - if (reason === void 0) reason = null; - let msg = expect.Expect._getMessage(reason); - for (let key of expected[dartx.keys]) { - if (!dart.test(actual[dartx.containsKey](key))) { - expect.Expect._fail(dart.str`Expect.mapEquals(missing expected key: <${key}>${msg}) fails`); - } - expect.Expect.equals(expected[dartx.get](key), actual[dartx.get](key)); - } - for (let key of actual[dartx.keys]) { - if (!dart.test(expected[dartx.containsKey](key))) { - expect.Expect._fail(dart.str`Expect.mapEquals(unexpected key: <${key}>${msg}) fails`); - } - } - } - static stringEquals(expected, actual, reason) { - if (reason === void 0) reason = null; - if (expected == actual) return; - let msg = expect.Expect._getMessage(reason); - let defaultMessage = dart.str`Expect.stringEquals(expected: <${expected}>", <${actual}>${msg}) fails`; - if (expected == null || actual == null) { - expect.Expect._fail(dart.str`${defaultMessage}`); - } - let left = 0; - let right = 0; - let eLen = expected[dartx.length]; - let aLen = actual[dartx.length]; - while (true) { - if (left == eLen || left == aLen || expected[dartx.get](left) != actual[dartx.get](left)) { - break; - } - left++; - } - let eRem = dart.notNull(eLen) - left; - let aRem = dart.notNull(aLen) - left; - while (true) { - if (right == eRem || right == aRem || expected[dartx.get](dart.notNull(eLen) - right - 1) != actual[dartx.get](dart.notNull(aLen) - right - 1)) { - break; - } - right++; - } - let leftSnippet = expected[dartx.substring](left < 10 ? 0 : left - 10, left); - let rightSnippetLength = right < 10 ? right : 10; - let rightSnippet = expected[dartx.substring](dart.notNull(eLen) - right, dart.notNull(eLen) - right + rightSnippetLength); - let eSnippet = expected[dartx.substring](left, dart.notNull(eLen) - right); - let aSnippet = actual[dartx.substring](left, dart.notNull(aLen) - right); - if (dart.notNull(eSnippet[dartx.length]) > 43) { - eSnippet = dart.notNull(eSnippet[dartx.substring](0, 20)) + "..." + dart.notNull(eSnippet[dartx.substring](dart.notNull(eSnippet[dartx.length]) - 20)); - } - if (dart.notNull(aSnippet[dartx.length]) > 43) { - aSnippet = dart.notNull(aSnippet[dartx.substring](0, 20)) + "..." + dart.notNull(aSnippet[dartx.substring](dart.notNull(aSnippet[dartx.length]) - 20)); - } - let leftLead = "..."; - let rightTail = "..."; - if (left <= 10) leftLead = ""; - if (right <= 10) rightTail = ""; - let diff = dart.str`\nDiff (${left}..${dart.notNull(eLen) - right}/${dart.notNull(aLen) - right}):\n` + dart.str`${leftLead}${leftSnippet}[ ${eSnippet} ]${rightSnippet}${rightTail}\n` + dart.str`${leftLead}${leftSnippet}[ ${aSnippet} ]${rightSnippet}${rightTail}`; - expect.Expect._fail(dart.str`${defaultMessage}${diff}`); - } - static setEquals(expected, actual, reason) { - if (reason === void 0) reason = null; - let missingSet = core.Set.from(expected); - missingSet.removeAll(actual); - let extraSet = core.Set.from(actual); - extraSet.removeAll(expected); - if (dart.test(extraSet.isEmpty) && dart.test(missingSet.isEmpty)) return; - let msg = expect.Expect._getMessage(reason); - let sb = new core.StringBuffer(dart.str`Expect.setEquals(${msg}) fails`); - if (!dart.test(missingSet.isEmpty)) { - sb.write('\nExpected collection does not contain: '); - } - for (let val of missingSet) { - sb.write(dart.str`${val} `); - } - if (!dart.test(extraSet.isEmpty)) { - sb.write('\nExpected collection should not contain: '); - } - for (let val of extraSet) { - sb.write(dart.str`${val} `); - } - expect.Expect._fail(sb.toString()); - } - static throws(f, check, reason) { - if (check === void 0) check = null; - if (reason === void 0) reason = null; - let msg = reason == null ? "" : dart.str`(${reason})`; - if (!expect._Nullary.is(f)) { - expect.Expect._fail(dart.str`Expect.throws${msg}: Function f not callable with zero arguments`); - } - try { - f(); - } catch (e) { - let s = dart.stackTrace(e); - if (check != null) { - if (!dart.test(dart.dcall(check, e))) { - expect.Expect._fail(dart.str`Expect.throws${msg}: Unexpected '${e}'\n${s}`); - } - } - return; - } - - expect.Expect._fail(dart.str`Expect.throws${msg} fails: Did not throw`); - } - static _getMessage(reason) { - return reason == null ? "" : dart.str`, '${reason}'`; - } - static _fail(message) { - dart.throw(new expect.ExpectException(message)); - } - }; - dart.setSignature(expect.Expect, { - statics: () => ({ - _truncateString: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, core.int]), - _stringDifference: dart.definiteFunctionType(core.String, [core.String, core.String]), - equals: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String]), - isTrue: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]), - isFalse: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]), - isNull: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]), - isNotNull: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]), - identical: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String]), - fail: dart.definiteFunctionType(dart.void, [core.String]), - approxEquals: dart.definiteFunctionType(dart.void, [core.num, core.num], [core.num, core.String]), - notEquals: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String]), - listEquals: dart.definiteFunctionType(dart.void, [core.List, core.List], [core.String]), - mapEquals: dart.definiteFunctionType(dart.void, [core.Map, core.Map], [core.String]), - stringEquals: dart.definiteFunctionType(dart.void, [core.String, core.String], [core.String]), - setEquals: dart.definiteFunctionType(dart.void, [core.Iterable, core.Iterable], [core.String]), - throws: dart.definiteFunctionType(dart.void, [dart.functionType(dart.void, [])], [expect._CheckExceptionFn, core.String]), - _getMessage: dart.definiteFunctionType(core.String, [core.String]), - _fail: dart.definiteFunctionType(dart.void, [core.String]) - }), - names: ['_truncateString', '_stringDifference', 'equals', 'isTrue', 'isFalse', 'isNull', 'isNotNull', 'identical', 'fail', 'approxEquals', 'notEquals', 'listEquals', 'mapEquals', 'stringEquals', 'setEquals', 'throws', '_getMessage', '_fail'] - }); - expect._identical = function(a, b) { - return core.identical(a, b); - }; - dart.fn(expect._identical, dynamicAnddynamicTobool()); - expect._CheckExceptionFn = dart.typedef('_CheckExceptionFn', () => dart.functionType(core.bool, [dart.dynamic])); - expect._Nullary = dart.typedef('_Nullary', () => dart.functionType(dart.dynamic, [])); - expect.ExpectException = class ExpectException extends core.Object { - new(message) { - this.message = message; - } - toString() { - return this.message; - } - }; - expect.ExpectException[dart.implements] = () => [core.Exception]; - dart.setSignature(expect.ExpectException, { - constructors: () => ({new: dart.definiteFunctionType(expect.ExpectException, [core.String])}) - }); - expect.NoInline = class NoInline extends core.Object { - new() { - } - }; - dart.setSignature(expect.NoInline, { - constructors: () => ({new: dart.definiteFunctionType(expect.NoInline, [])}) - }); - expect.TrustTypeAnnotations = class TrustTypeAnnotations extends core.Object { - new() { - } - }; - dart.setSignature(expect.TrustTypeAnnotations, { - constructors: () => ({new: dart.definiteFunctionType(expect.TrustTypeAnnotations, [])}) - }); - expect.AssumeDynamic = class AssumeDynamic extends core.Object { - new() { - } - }; - dart.setSignature(expect.AssumeDynamic, { - constructors: () => ({new: dart.definiteFunctionType(expect.AssumeDynamic, [])}) - }); - // Exports: - exports.expect = expect; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/js/js.js b/pkg/dev_compiler/test/codegen_expected/js/js.js deleted file mode 100644 index 2fed93910cf4..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/js/js.js +++ /dev/null @@ -1,31 +0,0 @@ -dart_library.library('js', null, /* Imports */[ - 'dart_sdk' -], function load__js(exports, dart_sdk) { - 'use strict'; - const core = dart_sdk.core; - const js = dart_sdk.js; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const js$ = Object.create(null); - js$.JS = class JS extends core.Object { - new(name) { - if (name === void 0) name = null; - this.name = name; - } - }; - dart.setSignature(js$.JS, { - constructors: () => ({new: dart.definiteFunctionType(js$.JS, [], [core.String])}) - }); - js$._Anonymous = class _Anonymous extends core.Object { - new() { - } - }; - dart.setSignature(js$._Anonymous, { - constructors: () => ({new: dart.definiteFunctionType(js$._Anonymous, [])}) - }); - js$.anonymous = dart.const(new js$._Anonymous()); - js$.allowInteropCaptureThis = js.allowInteropCaptureThis; - js$.allowInterop = js.allowInterop; - // Exports: - exports.js = js$; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/application_test.js b/pkg/dev_compiler/test/codegen_expected/language/application_test.js index 0c6a6854ae66..b7bf099f5404 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/application_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/application_test.js @@ -1 +1,15 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/application_test', null, /* Imports */[ + 'dart_sdk' +], function load__application_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const application_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + application_test.main = function() { + }; + dart.fn(application_test.main, VoidTodynamic()); + // Exports: + exports.application_test = application_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/cyclic_import_test.js b/pkg/dev_compiler/test/codegen_expected/language/cyclic_import_test.js index f6232dc6d414..8e0ccf598c55 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/cyclic_import_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/cyclic_import_test.js @@ -9,561 +9,17 @@ dart_library.library('language/cyclic_import_test', null, /* Imports */[ const expect$ = expect.expect; const cyclic_import_test = Object.create(null); const sub__sub = Object.create(null); - const cyclic_import_test$ = Object.create(null); - const sub__sub$ = Object.create(null); - const cyclic_import_test$0 = Object.create(null); - const sub__sub$0 = Object.create(null); - const cyclic_import_test$1 = Object.create(null); - const sub__sub$1 = Object.create(null); - const cyclic_import_test$2 = Object.create(null); - const sub__sub$2 = Object.create(null); - const cyclic_import_test$3 = Object.create(null); - const sub__sub$3 = Object.create(null); - const cyclic_import_test$4 = Object.create(null); - const sub__sub$4 = Object.create(null); - const cyclic_import_test$5 = Object.create(null); - const sub__sub$5 = Object.create(null); - const cyclic_import_test$6 = Object.create(null); - const sub__sub$6 = Object.create(null); - const cyclic_import_test$7 = Object.create(null); - const sub__sub$7 = Object.create(null); - const cyclic_import_test$8 = Object.create(null); - const sub__sub$8 = Object.create(null); - const cyclic_import_test$9 = Object.create(null); - const sub__sub$9 = Object.create(null); - const cyclic_import_test$10 = Object.create(null); - const sub__sub$10 = Object.create(null); - const cyclic_import_test$11 = Object.create(null); - const sub__sub$11 = Object.create(null); - const cyclic_import_test$12 = Object.create(null); - const sub__sub$12 = Object.create(null); - const cyclic_import_test$13 = Object.create(null); - const sub__sub$13 = Object.create(null); - const cyclic_import_test$14 = Object.create(null); - const sub__sub$14 = Object.create(null); - const cyclic_import_test$15 = Object.create(null); - const sub__sub$15 = Object.create(null); - const cyclic_import_test$16 = Object.create(null); - const sub__sub$16 = Object.create(null); - const cyclic_import_test$17 = Object.create(null); - const sub__sub$17 = Object.create(null); - const cyclic_import_test$18 = Object.create(null); - const sub__sub$18 = Object.create(null); - const cyclic_import_test$19 = Object.create(null); - const sub__sub$19 = Object.create(null); - const cyclic_import_test$20 = Object.create(null); - const sub__sub$20 = Object.create(null); - const cyclic_import_test$21 = Object.create(null); - const sub__sub$21 = Object.create(null); - const cyclic_import_test$22 = Object.create(null); - const sub__sub$22 = Object.create(null); - const cyclic_import_test$23 = Object.create(null); - const sub__sub$23 = Object.create(null); - const cyclic_import_test$24 = Object.create(null); - const sub__sub$24 = Object.create(null); - const cyclic_import_test$25 = Object.create(null); - const sub__sub$25 = Object.create(null); - const cyclic_import_test$26 = Object.create(null); - const sub__sub$26 = Object.create(null); - const cyclic_import_test$27 = Object.create(null); - const sub__sub$27 = Object.create(null); - const cyclic_import_test$28 = Object.create(null); - const sub__sub$28 = Object.create(null); - const cyclic_import_test$29 = Object.create(null); - const sub__sub$29 = Object.create(null); - const cyclic_import_test$30 = Object.create(null); - const sub__sub$30 = Object.create(null); - const cyclic_import_test$31 = Object.create(null); - const sub__sub$31 = Object.create(null); - const cyclic_import_test$32 = Object.create(null); - const sub__sub$32 = Object.create(null); - const cyclic_import_test$33 = Object.create(null); - const sub__sub$33 = Object.create(null); - const cyclic_import_test$34 = Object.create(null); - const sub__sub$34 = Object.create(null); - const cyclic_import_test$35 = Object.create(null); - const sub__sub$35 = Object.create(null); - const cyclic_import_test$36 = Object.create(null); - const sub__sub$36 = Object.create(null); - const cyclic_import_test$37 = Object.create(null); - const sub__sub$37 = Object.create(null); - const cyclic_import_test$38 = Object.create(null); - const sub__sub$38 = Object.create(null); - const cyclic_import_test$39 = Object.create(null); - const sub__sub$39 = Object.create(null); - const cyclic_import_test$40 = Object.create(null); - const sub__sub$40 = Object.create(null); - const cyclic_import_test$41 = Object.create(null); - const sub__sub$41 = Object.create(null); - const cyclic_import_test$42 = Object.create(null); - const sub__sub$42 = Object.create(null); - const cyclic_import_test$43 = Object.create(null); - const sub__sub$43 = Object.create(null); - const cyclic_import_test$44 = Object.create(null); - const sub__sub$44 = Object.create(null); - const cyclic_import_test$45 = Object.create(null); - const sub__sub$45 = Object.create(null); - const cyclic_import_test$46 = Object.create(null); - const sub__sub$46 = Object.create(null); - const cyclic_import_test$47 = Object.create(null); - const sub__sub$47 = Object.create(null); - const cyclic_import_test$48 = Object.create(null); - const sub__sub$48 = Object.create(null); - const cyclic_import_test$49 = Object.create(null); - const sub__sub$49 = Object.create(null); - const cyclic_import_test$50 = Object.create(null); - const sub__sub$50 = Object.create(null); - const cyclic_import_test$51 = Object.create(null); - const sub__sub$51 = Object.create(null); - const cyclic_import_test$52 = Object.create(null); - const sub__sub$52 = Object.create(null); - const cyclic_import_test$53 = Object.create(null); - const sub__sub$53 = Object.create(null); - const cyclic_import_test$54 = Object.create(null); - const sub__sub$54 = Object.create(null); - const cyclic_import_test$55 = Object.create(null); - const sub__sub$55 = Object.create(null); - const cyclic_import_test$56 = Object.create(null); - const sub__sub$56 = Object.create(null); - const cyclic_import_test$57 = Object.create(null); - const sub__sub$57 = Object.create(null); - const cyclic_import_test$58 = Object.create(null); - const sub__sub$58 = Object.create(null); - const cyclic_import_test$59 = Object.create(null); - const sub__sub$59 = Object.create(null); - const cyclic_import_test$60 = Object.create(null); - const sub__sub$60 = Object.create(null); - const cyclic_import_test$61 = Object.create(null); - const sub__sub$61 = Object.create(null); - const cyclic_import_test$62 = Object.create(null); - const sub__sub$62 = Object.create(null); - const cyclic_import_test$63 = Object.create(null); - const sub__sub$63 = Object.create(null); - const cyclic_import_test$64 = Object.create(null); - const sub__sub$64 = Object.create(null); - const cyclic_import_test$65 = Object.create(null); - const sub__sub$65 = Object.create(null); - const cyclic_import_test$66 = Object.create(null); - const sub__sub$66 = Object.create(null); - const cyclic_import_test$67 = Object.create(null); - const sub__sub$67 = Object.create(null); - const cyclic_import_test$68 = Object.create(null); - const sub__sub$68 = Object.create(null); - const cyclic_import_test$69 = Object.create(null); - const sub__sub$69 = Object.create(null); - const cyclic_import_test$70 = Object.create(null); - const sub__sub$70 = Object.create(null); - const cyclic_import_test$71 = Object.create(null); - const sub__sub$71 = Object.create(null); - const cyclic_import_test$72 = Object.create(null); - const sub__sub$72 = Object.create(null); - const cyclic_import_test$73 = Object.create(null); - const sub__sub$73 = Object.create(null); - const cyclic_import_test$74 = Object.create(null); - const sub__sub$74 = Object.create(null); - const cyclic_import_test$75 = Object.create(null); - const sub__sub$75 = Object.create(null); - const cyclic_import_test$76 = Object.create(null); - const sub__sub$76 = Object.create(null); - const cyclic_import_test$77 = Object.create(null); - const sub__sub$77 = Object.create(null); - const cyclic_import_test$78 = Object.create(null); - const sub__sub$78 = Object.create(null); - const cyclic_import_test$79 = Object.create(null); - const sub__sub$79 = Object.create(null); - const cyclic_import_test$80 = Object.create(null); - const sub__sub$80 = Object.create(null); - const cyclic_import_test$81 = Object.create(null); - const sub__sub$81 = Object.create(null); - const cyclic_import_test$82 = Object.create(null); - const sub__sub$82 = Object.create(null); - const cyclic_import_test$83 = Object.create(null); - const sub__sub$83 = Object.create(null); - const cyclic_import_test$84 = Object.create(null); - const sub__sub$84 = Object.create(null); - const cyclic_import_test$85 = Object.create(null); - const sub__sub$85 = Object.create(null); - const cyclic_import_test$86 = Object.create(null); - const sub__sub$86 = Object.create(null); - const cyclic_import_test$87 = Object.create(null); - const sub__sub$87 = Object.create(null); - const cyclic_import_test$88 = Object.create(null); - const sub__sub$88 = Object.create(null); - const cyclic_import_test$89 = Object.create(null); - const sub__sub$89 = Object.create(null); - const cyclic_import_test$90 = Object.create(null); - const sub__sub$90 = Object.create(null); - const cyclic_import_test$91 = Object.create(null); - const sub__sub$91 = Object.create(null); - const cyclic_import_test$92 = Object.create(null); - const sub__sub$92 = Object.create(null); - const cyclic_import_test$93 = Object.create(null); - const sub__sub$93 = Object.create(null); - const cyclic_import_test$94 = Object.create(null); - const sub__sub$94 = Object.create(null); - const cyclic_import_test$95 = Object.create(null); - const sub__sub$95 = Object.create(null); - const cyclic_import_test$96 = Object.create(null); - const sub__sub$96 = Object.create(null); - const cyclic_import_test$97 = Object.create(null); - const sub__sub$97 = Object.create(null); - const cyclic_import_test$98 = Object.create(null); - const sub__sub$98 = Object.create(null); - const cyclic_import_test$99 = Object.create(null); - const sub__sub$99 = Object.create(null); - const cyclic_import_test$100 = Object.create(null); - const sub__sub$100 = Object.create(null); - const cyclic_import_test$101 = Object.create(null); - const sub__sub$101 = Object.create(null); - const cyclic_import_test$102 = Object.create(null); - const sub__sub$102 = Object.create(null); - const cyclic_import_test$103 = Object.create(null); - const sub__sub$103 = Object.create(null); - const cyclic_import_test$104 = Object.create(null); - const sub__sub$104 = Object.create(null); - const cyclic_import_test$105 = Object.create(null); - const sub__sub$105 = Object.create(null); - const cyclic_import_test$106 = Object.create(null); - const sub__sub$106 = Object.create(null); - const cyclic_import_test$107 = Object.create(null); - const sub__sub$107 = Object.create(null); - const cyclic_import_test$108 = Object.create(null); - const sub__sub$108 = Object.create(null); - const cyclic_import_test$109 = Object.create(null); - const sub__sub$109 = Object.create(null); - const cyclic_import_test$110 = Object.create(null); - const sub__sub$110 = Object.create(null); - const cyclic_import_test$111 = Object.create(null); - const sub__sub$111 = Object.create(null); - const cyclic_import_test$112 = Object.create(null); - const sub__sub$112 = Object.create(null); - const cyclic_import_test$113 = Object.create(null); - const sub__sub$113 = Object.create(null); - const cyclic_import_test$114 = Object.create(null); - const sub__sub$114 = Object.create(null); - const cyclic_import_test$115 = Object.create(null); - const sub__sub$115 = Object.create(null); - const cyclic_import_test$116 = Object.create(null); - const sub__sub$116 = Object.create(null); - const cyclic_import_test$117 = Object.create(null); - const sub__sub$117 = Object.create(null); - const cyclic_import_test$118 = Object.create(null); - const sub__sub$118 = Object.create(null); - const cyclic_import_test$119 = Object.create(null); - const sub__sub$119 = Object.create(null); - const cyclic_import_test$120 = Object.create(null); - const sub__sub$120 = Object.create(null); - const cyclic_import_test$121 = Object.create(null); - const sub__sub$121 = Object.create(null); - const cyclic_import_test$122 = Object.create(null); - const sub__sub$122 = Object.create(null); - const cyclic_import_test$123 = Object.create(null); - const sub__sub$123 = Object.create(null); - const cyclic_import_test$124 = Object.create(null); - const sub__sub$124 = Object.create(null); - const cyclic_import_test$125 = Object.create(null); - const sub__sub$125 = Object.create(null); - const cyclic_import_test$126 = Object.create(null); - const sub__sub$126 = Object.create(null); - const cyclic_import_test$127 = Object.create(null); - const sub__sub$127 = Object.create(null); - const cyclic_import_test$128 = Object.create(null); - const sub__sub$128 = Object.create(null); - const cyclic_import_test$129 = Object.create(null); - const sub__sub$129 = Object.create(null); - const cyclic_import_test$130 = Object.create(null); - const sub__sub$130 = Object.create(null); - const cyclic_import_test$131 = Object.create(null); - const sub__sub$131 = Object.create(null); - const cyclic_import_test$132 = Object.create(null); - const sub__sub$132 = Object.create(null); - const cyclic_import_test$133 = Object.create(null); - const sub__sub$133 = Object.create(null); - const cyclic_import_test$134 = Object.create(null); - const sub__sub$134 = Object.create(null); let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); - cyclic_import_test$134.value = 42; - cyclic_import_test$134.main = function() { - sub__sub$134.subMain(); + cyclic_import_test.value = 42; + cyclic_import_test.main = function() { + sub__sub.subMain(); }; - dart.fn(cyclic_import_test$134.main, VoidTodynamic()); - sub__sub$134.subMain = function() { - expect$.Expect.equals(42, cyclic_import_test$134.value); + dart.fn(cyclic_import_test.main, VoidTodynamic()); + sub__sub.subMain = function() { + expect$.Expect.equals(42, cyclic_import_test.value); }; - dart.fn(sub__sub$134.subMain, VoidTodynamic()); + dart.fn(sub__sub.subMain, VoidTodynamic()); // Exports: exports.cyclic_import_test = cyclic_import_test; exports.sub__sub = sub__sub; - exports.cyclic_import_test = cyclic_import_test$; - exports.sub__sub = sub__sub$; - exports.cyclic_import_test = cyclic_import_test$0; - exports.sub__sub = sub__sub$0; - exports.cyclic_import_test = cyclic_import_test$1; - exports.sub__sub = sub__sub$1; - exports.cyclic_import_test = cyclic_import_test$2; - exports.sub__sub = sub__sub$2; - exports.cyclic_import_test = cyclic_import_test$3; - exports.sub__sub = sub__sub$3; - exports.cyclic_import_test = cyclic_import_test$4; - exports.sub__sub = sub__sub$4; - exports.cyclic_import_test = cyclic_import_test$5; - exports.sub__sub = sub__sub$5; - exports.cyclic_import_test = cyclic_import_test$6; - exports.sub__sub = sub__sub$6; - exports.cyclic_import_test = cyclic_import_test$7; - exports.sub__sub = sub__sub$7; - exports.cyclic_import_test = cyclic_import_test$8; - exports.sub__sub = sub__sub$8; - exports.cyclic_import_test = cyclic_import_test$9; - exports.sub__sub = sub__sub$9; - exports.cyclic_import_test = cyclic_import_test$10; - exports.sub__sub = sub__sub$10; - exports.cyclic_import_test = cyclic_import_test$11; - exports.sub__sub = sub__sub$11; - exports.cyclic_import_test = cyclic_import_test$12; - exports.sub__sub = sub__sub$12; - exports.cyclic_import_test = cyclic_import_test$13; - exports.sub__sub = sub__sub$13; - exports.cyclic_import_test = cyclic_import_test$14; - exports.sub__sub = sub__sub$14; - exports.cyclic_import_test = cyclic_import_test$15; - exports.sub__sub = sub__sub$15; - exports.cyclic_import_test = cyclic_import_test$16; - exports.sub__sub = sub__sub$16; - exports.cyclic_import_test = cyclic_import_test$17; - exports.sub__sub = sub__sub$17; - exports.cyclic_import_test = cyclic_import_test$18; - exports.sub__sub = sub__sub$18; - exports.cyclic_import_test = cyclic_import_test$19; - exports.sub__sub = sub__sub$19; - exports.cyclic_import_test = cyclic_import_test$20; - exports.sub__sub = sub__sub$20; - exports.cyclic_import_test = cyclic_import_test$21; - exports.sub__sub = sub__sub$21; - exports.cyclic_import_test = cyclic_import_test$22; - exports.sub__sub = sub__sub$22; - exports.cyclic_import_test = cyclic_import_test$23; - exports.sub__sub = sub__sub$23; - exports.cyclic_import_test = cyclic_import_test$24; - exports.sub__sub = sub__sub$24; - exports.cyclic_import_test = cyclic_import_test$25; - exports.sub__sub = sub__sub$25; - exports.cyclic_import_test = cyclic_import_test$26; - exports.sub__sub = sub__sub$26; - exports.cyclic_import_test = cyclic_import_test$27; - exports.sub__sub = sub__sub$27; - exports.cyclic_import_test = cyclic_import_test$28; - exports.sub__sub = sub__sub$28; - exports.cyclic_import_test = cyclic_import_test$29; - exports.sub__sub = sub__sub$29; - exports.cyclic_import_test = cyclic_import_test$30; - exports.sub__sub = sub__sub$30; - exports.cyclic_import_test = cyclic_import_test$31; - exports.sub__sub = sub__sub$31; - exports.cyclic_import_test = cyclic_import_test$32; - exports.sub__sub = sub__sub$32; - exports.cyclic_import_test = cyclic_import_test$33; - exports.sub__sub = sub__sub$33; - exports.cyclic_import_test = cyclic_import_test$34; - exports.sub__sub = sub__sub$34; - exports.cyclic_import_test = cyclic_import_test$35; - exports.sub__sub = sub__sub$35; - exports.cyclic_import_test = cyclic_import_test$36; - exports.sub__sub = sub__sub$36; - exports.cyclic_import_test = cyclic_import_test$37; - exports.sub__sub = sub__sub$37; - exports.cyclic_import_test = cyclic_import_test$38; - exports.sub__sub = sub__sub$38; - exports.cyclic_import_test = cyclic_import_test$39; - exports.sub__sub = sub__sub$39; - exports.cyclic_import_test = cyclic_import_test$40; - exports.sub__sub = sub__sub$40; - exports.cyclic_import_test = cyclic_import_test$41; - exports.sub__sub = sub__sub$41; - exports.cyclic_import_test = cyclic_import_test$42; - exports.sub__sub = sub__sub$42; - exports.cyclic_import_test = cyclic_import_test$43; - exports.sub__sub = sub__sub$43; - exports.cyclic_import_test = cyclic_import_test$44; - exports.sub__sub = sub__sub$44; - exports.cyclic_import_test = cyclic_import_test$45; - exports.sub__sub = sub__sub$45; - exports.cyclic_import_test = cyclic_import_test$46; - exports.sub__sub = sub__sub$46; - exports.cyclic_import_test = cyclic_import_test$47; - exports.sub__sub = sub__sub$47; - exports.cyclic_import_test = cyclic_import_test$48; - exports.sub__sub = sub__sub$48; - exports.cyclic_import_test = cyclic_import_test$49; - exports.sub__sub = sub__sub$49; - exports.cyclic_import_test = cyclic_import_test$50; - exports.sub__sub = sub__sub$50; - exports.cyclic_import_test = cyclic_import_test$51; - exports.sub__sub = sub__sub$51; - exports.cyclic_import_test = cyclic_import_test$52; - exports.sub__sub = sub__sub$52; - exports.cyclic_import_test = cyclic_import_test$53; - exports.sub__sub = sub__sub$53; - exports.cyclic_import_test = cyclic_import_test$54; - exports.sub__sub = sub__sub$54; - exports.cyclic_import_test = cyclic_import_test$55; - exports.sub__sub = sub__sub$55; - exports.cyclic_import_test = cyclic_import_test$56; - exports.sub__sub = sub__sub$56; - exports.cyclic_import_test = cyclic_import_test$57; - exports.sub__sub = sub__sub$57; - exports.cyclic_import_test = cyclic_import_test$58; - exports.sub__sub = sub__sub$58; - exports.cyclic_import_test = cyclic_import_test$59; - exports.sub__sub = sub__sub$59; - exports.cyclic_import_test = cyclic_import_test$60; - exports.sub__sub = sub__sub$60; - exports.cyclic_import_test = cyclic_import_test$61; - exports.sub__sub = sub__sub$61; - exports.cyclic_import_test = cyclic_import_test$62; - exports.sub__sub = sub__sub$62; - exports.cyclic_import_test = cyclic_import_test$63; - exports.sub__sub = sub__sub$63; - exports.cyclic_import_test = cyclic_import_test$64; - exports.sub__sub = sub__sub$64; - exports.cyclic_import_test = cyclic_import_test$65; - exports.sub__sub = sub__sub$65; - exports.cyclic_import_test = cyclic_import_test$66; - exports.sub__sub = sub__sub$66; - exports.cyclic_import_test = cyclic_import_test$67; - exports.sub__sub = sub__sub$67; - exports.cyclic_import_test = cyclic_import_test$68; - exports.sub__sub = sub__sub$68; - exports.cyclic_import_test = cyclic_import_test$69; - exports.sub__sub = sub__sub$69; - exports.cyclic_import_test = cyclic_import_test$70; - exports.sub__sub = sub__sub$70; - exports.cyclic_import_test = cyclic_import_test$71; - exports.sub__sub = sub__sub$71; - exports.cyclic_import_test = cyclic_import_test$72; - exports.sub__sub = sub__sub$72; - exports.cyclic_import_test = cyclic_import_test$73; - exports.sub__sub = sub__sub$73; - exports.cyclic_import_test = cyclic_import_test$74; - exports.sub__sub = sub__sub$74; - exports.cyclic_import_test = cyclic_import_test$75; - exports.sub__sub = sub__sub$75; - exports.cyclic_import_test = cyclic_import_test$76; - exports.sub__sub = sub__sub$76; - exports.cyclic_import_test = cyclic_import_test$77; - exports.sub__sub = sub__sub$77; - exports.cyclic_import_test = cyclic_import_test$78; - exports.sub__sub = sub__sub$78; - exports.cyclic_import_test = cyclic_import_test$79; - exports.sub__sub = sub__sub$79; - exports.cyclic_import_test = cyclic_import_test$80; - exports.sub__sub = sub__sub$80; - exports.cyclic_import_test = cyclic_import_test$81; - exports.sub__sub = sub__sub$81; - exports.cyclic_import_test = cyclic_import_test$82; - exports.sub__sub = sub__sub$82; - exports.cyclic_import_test = cyclic_import_test$83; - exports.sub__sub = sub__sub$83; - exports.cyclic_import_test = cyclic_import_test$84; - exports.sub__sub = sub__sub$84; - exports.cyclic_import_test = cyclic_import_test$85; - exports.sub__sub = sub__sub$85; - exports.cyclic_import_test = cyclic_import_test$86; - exports.sub__sub = sub__sub$86; - exports.cyclic_import_test = cyclic_import_test$87; - exports.sub__sub = sub__sub$87; - exports.cyclic_import_test = cyclic_import_test$88; - exports.sub__sub = sub__sub$88; - exports.cyclic_import_test = cyclic_import_test$89; - exports.sub__sub = sub__sub$89; - exports.cyclic_import_test = cyclic_import_test$90; - exports.sub__sub = sub__sub$90; - exports.cyclic_import_test = cyclic_import_test$91; - exports.sub__sub = sub__sub$91; - exports.cyclic_import_test = cyclic_import_test$92; - exports.sub__sub = sub__sub$92; - exports.cyclic_import_test = cyclic_import_test$93; - exports.sub__sub = sub__sub$93; - exports.cyclic_import_test = cyclic_import_test$94; - exports.sub__sub = sub__sub$94; - exports.cyclic_import_test = cyclic_import_test$95; - exports.sub__sub = sub__sub$95; - exports.cyclic_import_test = cyclic_import_test$96; - exports.sub__sub = sub__sub$96; - exports.cyclic_import_test = cyclic_import_test$97; - exports.sub__sub = sub__sub$97; - exports.cyclic_import_test = cyclic_import_test$98; - exports.sub__sub = sub__sub$98; - exports.cyclic_import_test = cyclic_import_test$99; - exports.sub__sub = sub__sub$99; - exports.cyclic_import_test = cyclic_import_test$100; - exports.sub__sub = sub__sub$100; - exports.cyclic_import_test = cyclic_import_test$101; - exports.sub__sub = sub__sub$101; - exports.cyclic_import_test = cyclic_import_test$102; - exports.sub__sub = sub__sub$102; - exports.cyclic_import_test = cyclic_import_test$103; - exports.sub__sub = sub__sub$103; - exports.cyclic_import_test = cyclic_import_test$104; - exports.sub__sub = sub__sub$104; - exports.cyclic_import_test = cyclic_import_test$105; - exports.sub__sub = sub__sub$105; - exports.cyclic_import_test = cyclic_import_test$106; - exports.sub__sub = sub__sub$106; - exports.cyclic_import_test = cyclic_import_test$107; - exports.sub__sub = sub__sub$107; - exports.cyclic_import_test = cyclic_import_test$108; - exports.sub__sub = sub__sub$108; - exports.cyclic_import_test = cyclic_import_test$109; - exports.sub__sub = sub__sub$109; - exports.cyclic_import_test = cyclic_import_test$110; - exports.sub__sub = sub__sub$110; - exports.cyclic_import_test = cyclic_import_test$111; - exports.sub__sub = sub__sub$111; - exports.cyclic_import_test = cyclic_import_test$112; - exports.sub__sub = sub__sub$112; - exports.cyclic_import_test = cyclic_import_test$113; - exports.sub__sub = sub__sub$113; - exports.cyclic_import_test = cyclic_import_test$114; - exports.sub__sub = sub__sub$114; - exports.cyclic_import_test = cyclic_import_test$115; - exports.sub__sub = sub__sub$115; - exports.cyclic_import_test = cyclic_import_test$116; - exports.sub__sub = sub__sub$116; - exports.cyclic_import_test = cyclic_import_test$117; - exports.sub__sub = sub__sub$117; - exports.cyclic_import_test = cyclic_import_test$118; - exports.sub__sub = sub__sub$118; - exports.cyclic_import_test = cyclic_import_test$119; - exports.sub__sub = sub__sub$119; - exports.cyclic_import_test = cyclic_import_test$120; - exports.sub__sub = sub__sub$120; - exports.cyclic_import_test = cyclic_import_test$121; - exports.sub__sub = sub__sub$121; - exports.cyclic_import_test = cyclic_import_test$122; - exports.sub__sub = sub__sub$122; - exports.cyclic_import_test = cyclic_import_test$123; - exports.sub__sub = sub__sub$123; - exports.cyclic_import_test = cyclic_import_test$124; - exports.sub__sub = sub__sub$124; - exports.cyclic_import_test = cyclic_import_test$125; - exports.sub__sub = sub__sub$125; - exports.cyclic_import_test = cyclic_import_test$126; - exports.sub__sub = sub__sub$126; - exports.cyclic_import_test = cyclic_import_test$127; - exports.sub__sub = sub__sub$127; - exports.cyclic_import_test = cyclic_import_test$128; - exports.sub__sub = sub__sub$128; - exports.cyclic_import_test = cyclic_import_test$129; - exports.sub__sub = sub__sub$129; - exports.cyclic_import_test = cyclic_import_test$130; - exports.sub__sub = sub__sub$130; - exports.cyclic_import_test = cyclic_import_test$131; - exports.sub__sub = sub__sub$131; - exports.cyclic_import_test = cyclic_import_test$132; - exports.sub__sub = sub__sub$132; - exports.cyclic_import_test = cyclic_import_test$133; - exports.sub__sub = sub__sub$133; - exports.cyclic_import_test = cyclic_import_test$134; - exports.sub__sub = sub__sub$134; }); diff --git a/pkg/dev_compiler/test/codegen_expected/language/export_double_same_main_test.js b/pkg/dev_compiler/test/codegen_expected/language/export_double_same_main_test.js index 0c6a6854ae66..4caf5c848fcd 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/export_double_same_main_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/export_double_same_main_test.js @@ -1 +1,22 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/export_double_same_main_test', null, /* Imports */[ + 'dart_sdk' +], function load__export_double_same_main_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const export_double_same_main_test = Object.create(null); + const top_level_entry_test = Object.create(null); + const export_main_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + top_level_entry_test.main = function() { + }; + dart.fn(top_level_entry_test.main, VoidTodynamic()); + export_double_same_main_test.main = top_level_entry_test.main; + export_double_same_main_test.main = top_level_entry_test.main; + export_main_test.main = top_level_entry_test.main; + // Exports: + exports.export_double_same_main_test = export_double_same_main_test; + exports.top_level_entry_test = top_level_entry_test; + exports.export_main_test = export_main_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/export_main_override_test.js b/pkg/dev_compiler/test/codegen_expected/language/export_main_override_test.js index 0c6a6854ae66..152a84a5c6e2 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/export_main_override_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/export_main_override_test.js @@ -1 +1,21 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/export_main_override_test', null, /* Imports */[ + 'dart_sdk' +], function load__export_main_override_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const export_main_override_test = Object.create(null); + const top_level_entry_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + export_main_override_test.main = function() { + core.print('export_main_override'); + }; + dart.fn(export_main_override_test.main, VoidTodynamic()); + top_level_entry_test.main = function() { + }; + dart.fn(top_level_entry_test.main, VoidTodynamic()); + // Exports: + exports.export_main_override_test = export_main_override_test; + exports.top_level_entry_test = top_level_entry_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/export_main_test.js b/pkg/dev_compiler/test/codegen_expected/language/export_main_test.js index 0c6a6854ae66..e859856d8eba 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/export_main_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/export_main_test.js @@ -1 +1,18 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/export_main_test', null, /* Imports */[ + 'dart_sdk' +], function load__export_main_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const export_main_test = Object.create(null); + const top_level_entry_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + top_level_entry_test.main = function() { + }; + dart.fn(top_level_entry_test.main, VoidTodynamic()); + export_main_test.main = top_level_entry_test.main; + // Exports: + exports.export_main_test = export_main_test; + exports.top_level_entry_test = top_level_entry_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/generic_instanceof_test.js b/pkg/dev_compiler/test/codegen_expected/language/generic_instanceof_test.js index 0c6a6854ae66..e6087c6a9c59 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/generic_instanceof_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/generic_instanceof_test.js @@ -1 +1,164 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/generic_instanceof_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__generic_instanceof_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const generic_instanceof_test = Object.create(null); + let Foo = () => (Foo = dart.constFn(generic_instanceof_test.Foo$()))(); + let FooOfString = () => (FooOfString = dart.constFn(generic_instanceof_test.Foo$(core.String)))(); + let ListOfObject = () => (ListOfObject = dart.constFn(core.List$(core.Object)))(); + let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); + let ListOfnum = () => (ListOfnum = dart.constFn(core.List$(core.num)))(); + let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))(); + let FooOfList = () => (FooOfList = dart.constFn(generic_instanceof_test.Foo$(core.List)))(); + let FooOfListOfObject = () => (FooOfListOfObject = dart.constFn(generic_instanceof_test.Foo$(ListOfObject())))(); + let FooOfListOfint = () => (FooOfListOfint = dart.constFn(generic_instanceof_test.Foo$(ListOfint())))(); + let FooOfListOfnum = () => (FooOfListOfnum = dart.constFn(generic_instanceof_test.Foo$(ListOfnum())))(); + let FooOfListOfString = () => (FooOfListOfString = dart.constFn(generic_instanceof_test.Foo$(ListOfString())))(); + let FooOfObject = () => (FooOfObject = dart.constFn(generic_instanceof_test.Foo$(core.Object)))(); + let FooOfint = () => (FooOfint = dart.constFn(generic_instanceof_test.Foo$(core.int)))(); + let FooOfnum = () => (FooOfnum = dart.constFn(generic_instanceof_test.Foo$(core.num)))(); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + generic_instanceof_test.main = function() { + for (let i = 0; i < 5; i++) { + generic_instanceof_test.GenericInstanceof.testMain(); + } + }; + dart.fn(generic_instanceof_test.main, VoidTodynamic()); + generic_instanceof_test.Foo$ = dart.generic(T => { + let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))(); + class Foo extends core.Object { + new() { + } + isT(x) { + return T.is(x); + } + isListT(x) { + return ListOfT().is(x); + } + } + dart.addTypeTests(Foo); + dart.setSignature(Foo, { + constructors: () => ({new: dart.definiteFunctionType(generic_instanceof_test.Foo$(T), [])}), + methods: () => ({ + isT: dart.definiteFunctionType(core.bool, [dart.dynamic]), + isListT: dart.definiteFunctionType(core.bool, [dart.dynamic]) + }) + }); + return Foo; + }); + generic_instanceof_test.Foo = Foo(); + generic_instanceof_test.GenericInstanceof = class GenericInstanceof extends core.Object { + static testMain() { + let fooObject = new (FooOfString())(); + expect$.Expect.equals(true, fooObject.isT("string")); + expect$.Expect.equals(false, fooObject.isT(1)); + let fooString = new (FooOfString())(); + expect$.Expect.equals(true, fooString.isT("string")); + expect$.Expect.equals(false, fooString.isT(1)); + { + let foo = new (FooOfString())(); + expect$.Expect.equals(true, foo.isT("string")); + expect$.Expect.equals(false, foo.isT(1)); + } + { + let foo = new generic_instanceof_test.Foo(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfList())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfObject())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfint())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfnum())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfString())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new generic_instanceof_test.Foo(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfObject())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfint())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfnum())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfString())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); + } + } + }; + dart.setSignature(generic_instanceof_test.GenericInstanceof, { + statics: () => ({testMain: dart.definiteFunctionType(dart.void, [])}), + names: ['testMain'] + }); + // Exports: + exports.generic_instanceof_test = generic_instanceof_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/hello_script_test.js b/pkg/dev_compiler/test/codegen_expected/language/hello_script_test.js index 0c6a6854ae66..dc4563f06359 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/hello_script_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/hello_script_test.js @@ -1 +1,38 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/hello_script_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__hello_script_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const hello_script_test = Object.create(null); + const hello_script_lib = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + hello_script_test.main = function() { + hello_script_lib.HelloLib.doTest(); + expect$.Expect.equals(18, hello_script_lib.x); + core.print("Hello done."); + }; + dart.fn(hello_script_test.main, VoidTodynamic()); + hello_script_lib.HelloLib = class HelloLib extends core.Object { + static doTest() { + hello_script_lib.x = 17; + expect$.Expect.equals(17, (() => { + let x = hello_script_lib.x; + hello_script_lib.x = dart.dsend(x, '+', 1); + return x; + })()); + core.print("Hello from Lib!"); + } + }; + dart.setSignature(hello_script_lib.HelloLib, { + statics: () => ({doTest: dart.definiteFunctionType(dart.dynamic, [])}), + names: ['doTest'] + }); + hello_script_lib.x = null; + // Exports: + exports.hello_script_test = hello_script_test; + exports.hello_script_lib = hello_script_lib; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/inline_super_test.js b/pkg/dev_compiler/test/codegen_expected/language/inline_super_test.js index 0c6a6854ae66..41f75e43411c 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/inline_super_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/inline_super_test.js @@ -1 +1,43 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/inline_super_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__inline_super_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const inline_super_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + inline_super_test.Percept = class Percept extends core.Object {}; + inline_super_test.Actor = class Actor extends core.Object { + new(percept) { + this.percept = percept; + } + }; + dart.setSignature(inline_super_test.Actor, { + constructors: () => ({new: dart.definiteFunctionType(inline_super_test.Actor, [dart.dynamic])}) + }); + inline_super_test.LivingActor = class LivingActor extends inline_super_test.Actor { + new() { + super.new(new inline_super_test.Percept()); + } + }; + dart.setSignature(inline_super_test.LivingActor, { + constructors: () => ({new: dart.definiteFunctionType(inline_super_test.LivingActor, [])}) + }); + inline_super_test.main = function() { + expect$.Expect.isTrue(inline_super_test.Percept.is(new inline_super_test.Player().percept)); + }; + dart.fn(inline_super_test.main, VoidTodynamic()); + inline_super_test.Player = class Player extends inline_super_test.LivingActor { + new() { + super.new(); + } + }; + dart.setSignature(inline_super_test.Player, { + constructors: () => ({new: dart.definiteFunctionType(inline_super_test.Player, [])}) + }); + // Exports: + exports.inline_super_test = inline_super_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/lazy_static6_test.js b/pkg/dev_compiler/test/codegen_expected/language/lazy_static6_test.js index 0c6a6854ae66..6aa437b5a795 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/lazy_static6_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/lazy_static6_test.js @@ -1 +1,27 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/lazy_static6_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__lazy_static6_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const lazy_static6_test = Object.create(null); + let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.functionType(dart.dynamic, [dart.dynamic])))(); + let dynamicTodynamic$ = () => (dynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))(); + let dynamicToFn = () => (dynamicToFn = dart.constFn(dart.definiteFunctionType(dynamicTodynamic(), [dart.dynamic])))(); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + dart.defineLazy(lazy_static6_test, { + get x() { + return dart.fn(t => dart.fn(u => dart.dsend(t, '+', u), dynamicTodynamic$()), dynamicToFn()); + } + }); + lazy_static6_test.main = function() { + expect$.Expect.equals(499, dart.dcall(dart.dcall(lazy_static6_test.x, 498), 1)); + expect$.Expect.equals(42, dart.dcall(dart.dcall(lazy_static6_test.x, 39), 3)); + }; + dart.fn(lazy_static6_test.main, VoidTodynamic()); + // Exports: + exports.lazy_static6_test = lazy_static6_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/library1_test.js b/pkg/dev_compiler/test/codegen_expected/language/library1_test.js index 0c6a6854ae66..4eff24b77aff 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/library1_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/library1_test.js @@ -1 +1,42 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/library1_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__library1_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const library1_test = Object.create(null); + const library1_lib = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + library1_test.main = function() { + library1_test.Library1Test.testMain(); + }; + dart.fn(library1_test.main, VoidTodynamic()); + library1_test.Library1Test = class Library1Test extends core.Object { + static testMain() { + let a = new library1_lib.A(); + let s = a.foo(); + expect$.Expect.equals(s, "foo-rty two"); + } + }; + dart.setSignature(library1_test.Library1Test, { + statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), + names: ['testMain'] + }); + library1_lib.A = class A extends core.Object { + new() { + } + foo() { + return "foo-rty two"; + } + }; + dart.setSignature(library1_lib.A, { + constructors: () => ({new: dart.definiteFunctionType(library1_lib.A, [])}), + methods: () => ({foo: dart.definiteFunctionType(core.String, [])}) + }); + // Exports: + exports.library1_test = library1_test; + exports.library1_lib = library1_lib; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/library_juxtaposition_test.js b/pkg/dev_compiler/test/codegen_expected/language/library_juxtaposition_test.js index 0c6a6854ae66..96a559e66cec 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/library_juxtaposition_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/library_juxtaposition_test.js @@ -1 +1,22 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/library_juxtaposition_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__library_juxtaposition_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const library_juxtaposition_test = Object.create(null); + const library_juxtaposition_lib = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + library_juxtaposition_test.main = function() { + expect$.Expect.equals(library_juxtaposition_lib.c, 47); + }; + dart.fn(library_juxtaposition_test.main, VoidTodynamic()); + library_juxtaposition_lib.c = 47; + library_juxtaposition_test.c = library_juxtaposition_lib.c; + // Exports: + exports.library_juxtaposition_test = library_juxtaposition_test; + exports.library_juxtaposition_lib = library_juxtaposition_lib; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/library_prefixes_test.js b/pkg/dev_compiler/test/codegen_expected/language/library_prefixes_test.js index 0c6a6854ae66..d8afbb619d20 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/library_prefixes_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/library_prefixes_test.js @@ -1 +1,350 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/library_prefixes_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__library_prefixes_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const library_prefixes_test = Object.create(null); + const library_prefixes = Object.create(null); + const library_prefixes_test1 = Object.create(null); + const library_prefixes_test2 = Object.create(null); + let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + library_prefixes_test.LibraryPrefixesTest = class LibraryPrefixesTest extends core.Object { + static testMain() { + library_prefixes.LibraryPrefixes.main(dart.fn((a, b) => { + expect$.Expect.equals(a, b); + }, dynamicAnddynamicTodynamic())); + } + }; + dart.setSignature(library_prefixes_test.LibraryPrefixesTest, { + statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), + names: ['testMain'] + }); + library_prefixes_test.main = function() { + library_prefixes_test.LibraryPrefixesTest.testMain(); + }; + dart.fn(library_prefixes_test.main, VoidTodynamic()); + let const$; + let const$0; + let const$1; + let const$2; + let const$3; + let const$4; + let const$5; + let const$6; + library_prefixes.LibraryPrefixes = class LibraryPrefixes extends core.Object { + static main(expectEquals) { + let a = library_prefixes_test1.Constants.PI; + let b = library_prefixes_test2.Constants.PI; + dart.dcall(expectEquals, 3.14, a); + dart.dcall(expectEquals, 3.14, b); + dart.dcall(expectEquals, 1, library_prefixes_test1.Constants.foo); + dart.dcall(expectEquals, 2, library_prefixes_test2.Constants.foo); + dart.dcall(expectEquals, -1, library_prefixes_test1.A.y); + dart.dcall(expectEquals, 0, library_prefixes_test2.A.y); + dart.dcall(expectEquals, 1, new library_prefixes_test1.A().x); + dart.dcall(expectEquals, 2, new library_prefixes_test2.A().x); + dart.dcall(expectEquals, 3, new library_prefixes_test1.A.named().x); + dart.dcall(expectEquals, 4, new library_prefixes_test2.A.named().x); + dart.dcall(expectEquals, 3, library_prefixes_test1.A.fac().x); + dart.dcall(expectEquals, 4, library_prefixes_test2.A.fac().x); + dart.dcall(expectEquals, 1, new library_prefixes_test1.B().x); + dart.dcall(expectEquals, 2, new library_prefixes_test2.B().x); + dart.dcall(expectEquals, 8, new library_prefixes_test1.B.named().x); + dart.dcall(expectEquals, 13, new library_prefixes_test2.B.named().x); + dart.dcall(expectEquals, 8, library_prefixes_test1.B.fac().x); + dart.dcall(expectEquals, 13, library_prefixes_test2.B.fac().x); + dart.dcall(expectEquals, 1, (const$ || (const$ = dart.const(new library_prefixes_test1.C()))).x); + dart.dcall(expectEquals, 2, (const$0 || (const$0 = dart.const(new library_prefixes_test2.C()))).x); + dart.dcall(expectEquals, 3, (const$1 || (const$1 = dart.const(new library_prefixes_test1.C.named()))).x); + dart.dcall(expectEquals, 4, (const$2 || (const$2 = dart.const(new library_prefixes_test2.C.named()))).x); + dart.dcall(expectEquals, 3, library_prefixes_test1.C.fac().x); + dart.dcall(expectEquals, 4, library_prefixes_test2.C.fac().x); + dart.dcall(expectEquals, 1, (const$3 || (const$3 = dart.const(new library_prefixes_test1.D()))).x); + dart.dcall(expectEquals, 2, (const$4 || (const$4 = dart.const(new library_prefixes_test2.D()))).x); + dart.dcall(expectEquals, 8, (const$5 || (const$5 = dart.const(new library_prefixes_test1.D.named()))).x); + dart.dcall(expectEquals, 13, (const$6 || (const$6 = dart.const(new library_prefixes_test2.D.named()))).x); + dart.dcall(expectEquals, 8, library_prefixes_test1.D.fac().x); + dart.dcall(expectEquals, 13, library_prefixes_test2.D.fac().x); + dart.dcall(expectEquals, 0, library_prefixes_test1.E.foo()); + dart.dcall(expectEquals, 3, library_prefixes_test2.E.foo()); + dart.dcall(expectEquals, 1, new library_prefixes_test1.E().bar()); + dart.dcall(expectEquals, 4, new library_prefixes_test2.E().bar()); + dart.dcall(expectEquals, 9, dart.dcall(new library_prefixes_test1.E().toto(7))); + dart.dcall(expectEquals, 16, dart.dcall(new library_prefixes_test2.E().toto(11))); + dart.dcall(expectEquals, 111, dart.dcall(new library_prefixes_test1.E.fun(100).f)); + dart.dcall(expectEquals, 1313, dart.dcall(new library_prefixes_test2.E.fun(1300).f)); + dart.dcall(expectEquals, 999, dart.dcall(library_prefixes_test1.E.fooo(900))); + dart.dcall(expectEquals, 2048, dart.dcall(library_prefixes_test2.E.fooo(1024))); + } + }; + dart.setSignature(library_prefixes.LibraryPrefixes, { + statics: () => ({main: dart.definiteFunctionType(dart.void, [dart.dynamic])}), + names: ['main'] + }); + library_prefixes_test1.Constants = class Constants extends core.Object {}; + library_prefixes_test1.Constants.PI = 3.14; + library_prefixes_test1.Constants.foo = 1; + library_prefixes_test1.A = class A extends core.Object { + new() { + this.x = 1; + } + named() { + this.x = 3; + } + superC(x) { + this.x = core.int._check(dart.dsend(x, '+', 7)); + } + static fac() { + return new library_prefixes_test1.A.named(); + } + }; + dart.defineNamedConstructor(library_prefixes_test1.A, 'named'); + dart.defineNamedConstructor(library_prefixes_test1.A, 'superC'); + dart.setSignature(library_prefixes_test1.A, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test1.A, []), + named: dart.definiteFunctionType(library_prefixes_test1.A, []), + superC: dart.definiteFunctionType(library_prefixes_test1.A, [dart.dynamic]), + fac: dart.definiteFunctionType(library_prefixes_test1.A, []) + }) + }); + library_prefixes_test1.A.y = -1; + library_prefixes_test1.B = class B extends library_prefixes_test1.A { + new() { + super.new(); + } + named() { + super.superC(1); + } + static fac() { + return new library_prefixes_test1.B.named(); + } + }; + dart.defineNamedConstructor(library_prefixes_test1.B, 'named'); + dart.setSignature(library_prefixes_test1.B, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test1.B, []), + named: dart.definiteFunctionType(library_prefixes_test1.B, []), + fac: dart.definiteFunctionType(library_prefixes_test1.B, []) + }) + }); + let const$7; + library_prefixes_test1.C = class C extends core.Object { + new() { + this.x = 1; + } + named() { + this.x = 3; + } + superC(x) { + this.x = core.int._check(dart.dsend(x, '+', 7)); + } + static fac() { + return const$7 || (const$7 = dart.const(new library_prefixes_test1.C.named())); + } + }; + dart.defineNamedConstructor(library_prefixes_test1.C, 'named'); + dart.defineNamedConstructor(library_prefixes_test1.C, 'superC'); + dart.setSignature(library_prefixes_test1.C, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test1.C, []), + named: dart.definiteFunctionType(library_prefixes_test1.C, []), + superC: dart.definiteFunctionType(library_prefixes_test1.C, [dart.dynamic]), + fac: dart.definiteFunctionType(library_prefixes_test1.C, []) + }) + }); + let const$8; + library_prefixes_test1.D = class D extends library_prefixes_test1.C { + new() { + super.new(); + } + named() { + super.superC(1); + } + static fac() { + return const$8 || (const$8 = dart.const(new library_prefixes_test1.D.named())); + } + }; + dart.defineNamedConstructor(library_prefixes_test1.D, 'named'); + dart.setSignature(library_prefixes_test1.D, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test1.D, []), + named: dart.definiteFunctionType(library_prefixes_test1.D, []), + fac: dart.definiteFunctionType(library_prefixes_test1.D, []) + }) + }); + library_prefixes_test1.E = class E extends core.Object { + new() { + this.f = null; + } + fun(x) { + this.f = dart.fn(() => dart.dsend(x, '+', 11), VoidTodynamic()); + } + static foo() { + return 0; + } + static fooo(x) { + return dart.fn(() => dart.dsend(x, '+', 99), VoidTodynamic()); + } + bar() { + return 1; + } + toto(x) { + return dart.fn(() => dart.dsend(x, '+', 2), VoidTodynamic()); + } + }; + dart.defineNamedConstructor(library_prefixes_test1.E, 'fun'); + dart.setSignature(library_prefixes_test1.E, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test1.E, []), + fun: dart.definiteFunctionType(library_prefixes_test1.E, [dart.dynamic]) + }), + methods: () => ({ + bar: dart.definiteFunctionType(dart.dynamic, []), + toto: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]) + }), + statics: () => ({ + foo: dart.definiteFunctionType(dart.dynamic, []), + fooo: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]) + }), + names: ['foo', 'fooo'] + }); + library_prefixes_test2.Constants = class Constants extends core.Object {}; + library_prefixes_test2.Constants.PI = 3.14; + library_prefixes_test2.Constants.foo = 2; + library_prefixes_test2.A = class A extends core.Object { + new() { + this.x = 2; + } + named() { + this.x = 4; + } + superC(x) { + this.x = core.int._check(dart.dsend(x, '+', 11)); + } + static fac() { + return new library_prefixes_test2.A.named(); + } + }; + dart.defineNamedConstructor(library_prefixes_test2.A, 'named'); + dart.defineNamedConstructor(library_prefixes_test2.A, 'superC'); + dart.setSignature(library_prefixes_test2.A, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test2.A, []), + named: dart.definiteFunctionType(library_prefixes_test2.A, []), + superC: dart.definiteFunctionType(library_prefixes_test2.A, [dart.dynamic]), + fac: dart.definiteFunctionType(library_prefixes_test2.A, []) + }) + }); + library_prefixes_test2.A.y = 0; + library_prefixes_test2.B = class B extends library_prefixes_test2.A { + new() { + super.new(); + } + named() { + super.superC(2); + } + static fac() { + return new library_prefixes_test2.B.named(); + } + }; + dart.defineNamedConstructor(library_prefixes_test2.B, 'named'); + dart.setSignature(library_prefixes_test2.B, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test2.B, []), + named: dart.definiteFunctionType(library_prefixes_test2.B, []), + fac: dart.definiteFunctionType(library_prefixes_test2.B, []) + }) + }); + let const$9; + library_prefixes_test2.C = class C extends core.Object { + new() { + this.x = 2; + } + named() { + this.x = 4; + } + superC(x) { + this.x = core.int._check(dart.dsend(x, '+', 11)); + } + static fac() { + return const$9 || (const$9 = dart.const(new library_prefixes_test2.C.named())); + } + }; + dart.defineNamedConstructor(library_prefixes_test2.C, 'named'); + dart.defineNamedConstructor(library_prefixes_test2.C, 'superC'); + dart.setSignature(library_prefixes_test2.C, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test2.C, []), + named: dart.definiteFunctionType(library_prefixes_test2.C, []), + superC: dart.definiteFunctionType(library_prefixes_test2.C, [dart.dynamic]), + fac: dart.definiteFunctionType(library_prefixes_test2.C, []) + }) + }); + let const$10; + library_prefixes_test2.D = class D extends library_prefixes_test2.C { + new() { + super.new(); + } + named() { + super.superC(2); + } + static fac() { + return const$10 || (const$10 = dart.const(new library_prefixes_test2.D.named())); + } + }; + dart.defineNamedConstructor(library_prefixes_test2.D, 'named'); + dart.setSignature(library_prefixes_test2.D, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test2.D, []), + named: dart.definiteFunctionType(library_prefixes_test2.D, []), + fac: dart.definiteFunctionType(library_prefixes_test2.D, []) + }) + }); + library_prefixes_test2.E = class E extends core.Object { + new() { + this.f = null; + } + fun(x) { + this.f = dart.fn(() => dart.dsend(x, '+', 13), VoidTodynamic()); + } + static foo() { + return 3; + } + static fooo(x) { + return dart.fn(() => dart.dsend(x, '+', 1024), VoidTodynamic()); + } + bar() { + return 4; + } + toto(x) { + return dart.fn(() => dart.dsend(x, '+', 5), VoidTodynamic()); + } + }; + dart.defineNamedConstructor(library_prefixes_test2.E, 'fun'); + dart.setSignature(library_prefixes_test2.E, { + constructors: () => ({ + new: dart.definiteFunctionType(library_prefixes_test2.E, []), + fun: dart.definiteFunctionType(library_prefixes_test2.E, [dart.dynamic]) + }), + methods: () => ({ + bar: dart.definiteFunctionType(dart.dynamic, []), + toto: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]) + }), + statics: () => ({ + foo: dart.definiteFunctionType(dart.dynamic, []), + fooo: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]) + }), + names: ['foo', 'fooo'] + }); + // Exports: + exports.library_prefixes_test = library_prefixes_test; + exports.library_prefixes = library_prefixes; + exports.library_prefixes_test1 = library_prefixes_test1; + exports.library_prefixes_test2 = library_prefixes_test2; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/many_generic_instanceof_test.js b/pkg/dev_compiler/test/codegen_expected/language/many_generic_instanceof_test.js index 0c6a6854ae66..add8b9df5157 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/many_generic_instanceof_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/many_generic_instanceof_test.js @@ -1 +1,173 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/many_generic_instanceof_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__many_generic_instanceof_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const many_generic_instanceof_test = Object.create(null); + let Foo = () => (Foo = dart.constFn(many_generic_instanceof_test.Foo$()))(); + let FooOfString = () => (FooOfString = dart.constFn(many_generic_instanceof_test.Foo$(core.String)))(); + let ListOfObject = () => (ListOfObject = dart.constFn(core.List$(core.Object)))(); + let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); + let ListOfnum = () => (ListOfnum = dart.constFn(core.List$(core.num)))(); + let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))(); + let FooOfList = () => (FooOfList = dart.constFn(many_generic_instanceof_test.Foo$(core.List)))(); + let FooOfListOfObject = () => (FooOfListOfObject = dart.constFn(many_generic_instanceof_test.Foo$(ListOfObject())))(); + let FooOfListOfint = () => (FooOfListOfint = dart.constFn(many_generic_instanceof_test.Foo$(ListOfint())))(); + let FooOfListOfnum = () => (FooOfListOfnum = dart.constFn(many_generic_instanceof_test.Foo$(ListOfnum())))(); + let FooOfListOfString = () => (FooOfListOfString = dart.constFn(many_generic_instanceof_test.Foo$(ListOfString())))(); + let FooOfObject = () => (FooOfObject = dart.constFn(many_generic_instanceof_test.Foo$(core.Object)))(); + let FooOfint = () => (FooOfint = dart.constFn(many_generic_instanceof_test.Foo$(core.int)))(); + let FooOfnum = () => (FooOfnum = dart.constFn(many_generic_instanceof_test.Foo$(core.num)))(); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + many_generic_instanceof_test.ManyGenericInstanceofTest = class ManyGenericInstanceofTest extends core.Object { + static testMain() { + for (let i = 0; i < 20; i++) { + many_generic_instanceof_test.GenericInstanceof.testMain(); + } + } + }; + dart.setSignature(many_generic_instanceof_test.ManyGenericInstanceofTest, { + statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), + names: ['testMain'] + }); + many_generic_instanceof_test.main = function() { + many_generic_instanceof_test.ManyGenericInstanceofTest.testMain(); + }; + dart.fn(many_generic_instanceof_test.main, VoidTodynamic()); + many_generic_instanceof_test.Foo$ = dart.generic(T => { + let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))(); + class Foo extends core.Object { + new() { + } + isT(x) { + return T.is(x); + } + isListT(x) { + return ListOfT().is(x); + } + } + dart.addTypeTests(Foo); + dart.setSignature(Foo, { + constructors: () => ({new: dart.definiteFunctionType(many_generic_instanceof_test.Foo$(T), [])}), + methods: () => ({ + isT: dart.definiteFunctionType(core.bool, [dart.dynamic]), + isListT: dart.definiteFunctionType(core.bool, [dart.dynamic]) + }) + }); + return Foo; + }); + many_generic_instanceof_test.Foo = Foo(); + many_generic_instanceof_test.GenericInstanceof = class GenericInstanceof extends core.Object { + static testMain() { + let fooObject = new (FooOfString())(); + expect$.Expect.equals(true, fooObject.isT("string")); + expect$.Expect.equals(false, fooObject.isT(1)); + let fooString = new (FooOfString())(); + expect$.Expect.equals(true, fooString.isT("string")); + expect$.Expect.equals(false, fooString.isT(1)); + { + let foo = new (FooOfString())(); + expect$.Expect.equals(true, foo.isT("string")); + expect$.Expect.equals(false, foo.isT(1)); + } + { + let foo = new many_generic_instanceof_test.Foo(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfList())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfObject())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfint())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfnum())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfString().new(5))); + } + { + let foo = new (FooOfListOfString())(); + expect$.Expect.equals(true, foo.isT(core.List.new(5))); + expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); + } + { + let foo = new many_generic_instanceof_test.Foo(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfObject())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfint())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfnum())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfString().new(5))); + } + { + let foo = new (FooOfString())(); + expect$.Expect.equals(true, foo.isListT(core.List.new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfint().new(5))); + expect$.Expect.equals(false, foo.isListT(ListOfnum().new(5))); + expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); + } + } + }; + dart.setSignature(many_generic_instanceof_test.GenericInstanceof, { + statics: () => ({testMain: dart.definiteFunctionType(dart.void, [])}), + names: ['testMain'] + }); + // Exports: + exports.many_generic_instanceof_test = many_generic_instanceof_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/multi_pass2_test.js b/pkg/dev_compiler/test/codegen_expected/language/multi_pass2_test.js index 0c6a6854ae66..8b80dd975bbf 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/multi_pass2_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/multi_pass2_test.js @@ -1 +1,52 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/multi_pass2_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__multi_pass2_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const multi_pass2_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + multi_pass2_test.Base = class Base extends core.Object { + new(value) { + this.value = value; + } + }; + dart.setSignature(multi_pass2_test.Base, { + constructors: () => ({new: dart.definiteFunctionType(multi_pass2_test.Base, [dart.dynamic])}) + }); + multi_pass2_test.MultiPass2Test = class MultiPass2Test extends core.Object { + static testMain() { + let a = new multi_pass2_test.B(5); + expect$.Expect.equals(5, a.value); + } + }; + dart.setSignature(multi_pass2_test.MultiPass2Test, { + statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), + names: ['testMain'] + }); + multi_pass2_test.main = function() { + multi_pass2_test.MultiPass2Test.testMain(); + }; + dart.fn(multi_pass2_test.main, VoidTodynamic()); + multi_pass2_test.A = class A extends multi_pass2_test.Base { + new(v) { + super.new(v); + } + }; + dart.setSignature(multi_pass2_test.A, { + constructors: () => ({new: dart.definiteFunctionType(multi_pass2_test.A, [dart.dynamic])}) + }); + multi_pass2_test.B = class B extends multi_pass2_test.A { + new(v) { + super.new(v); + } + }; + dart.setSignature(multi_pass2_test.B, { + constructors: () => ({new: dart.definiteFunctionType(multi_pass2_test.B, [dart.dynamic])}) + }); + // Exports: + exports.multi_pass2_test = multi_pass2_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/multi_pass_test.js b/pkg/dev_compiler/test/codegen_expected/language/multi_pass_test.js index 0c6a6854ae66..9b250013a7eb 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/multi_pass_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/multi_pass_test.js @@ -1 +1,52 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/multi_pass_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__multi_pass_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const multi_pass_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + multi_pass_test.Base = class Base extends core.Object { + new(value) { + this.value = value; + } + }; + dart.setSignature(multi_pass_test.Base, { + constructors: () => ({new: dart.definiteFunctionType(multi_pass_test.Base, [dart.dynamic])}) + }); + multi_pass_test.MultiPassTest = class MultiPassTest extends core.Object { + static testMain() { + let a = new multi_pass_test.B(5); + expect$.Expect.equals(5, a.value); + } + }; + dart.setSignature(multi_pass_test.MultiPassTest, { + statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), + names: ['testMain'] + }); + multi_pass_test.main = function() { + multi_pass_test.MultiPassTest.testMain(); + }; + dart.fn(multi_pass_test.main, VoidTodynamic()); + multi_pass_test.A = class A extends multi_pass_test.Base { + new(v) { + super.new(v); + } + }; + dart.setSignature(multi_pass_test.A, { + constructors: () => ({new: dart.definiteFunctionType(multi_pass_test.A, [dart.dynamic])}) + }); + multi_pass_test.B = class B extends multi_pass_test.A { + new(v) { + super.new(v); + } + }; + dart.setSignature(multi_pass_test.B, { + constructors: () => ({new: dart.definiteFunctionType(multi_pass_test.B, [dart.dynamic])}) + }); + // Exports: + exports.multi_pass_test = multi_pass_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/part_test.js b/pkg/dev_compiler/test/codegen_expected/language/part_test.js index 0c6a6854ae66..74611497d643 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/part_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/part_test.js @@ -1 +1,17 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/part_test', null, /* Imports */[ + 'dart_sdk' +], function load__part_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const part_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + part_test.main = function() { + core.print(part_test.foo); + }; + dart.fn(part_test.main, VoidTodynamic()); + part_test.foo = 'foo'; + // Exports: + exports.part_test = part_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/private2_test.js b/pkg/dev_compiler/test/codegen_expected/language/private2_test.js index 0c6a6854ae66..b3cc159ad8ab 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/private2_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/private2_test.js @@ -1 +1,49 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/private2_test', null, /* Imports */[ + 'dart_sdk' +], function load__private2_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const private2_test = Object.create(null); + const private2_lib = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + const _f = Symbol('_f'); + private2_test.A = class A extends core.Object { + new() { + this[_f] = 42; + this.g = 43; + } + }; + dart.setSignature(private2_test.A, { + constructors: () => ({new: dart.definiteFunctionType(private2_test.A, [])}) + }); + private2_lib.B = class B extends private2_test.A { + new() { + super.new(); + } + }; + dart.setSignature(private2_lib.B, { + constructors: () => ({new: dart.definiteFunctionType(private2_lib.B, [])}) + }); + private2_test.C = class C extends private2_lib.B { + new() { + super.new(); + } + }; + dart.setSignature(private2_test.C, { + constructors: () => ({new: dart.definiteFunctionType(private2_test.C, [])}) + }); + private2_test.main = function() { + let a = new private2_test.A(); + core.print(a.g); + core.print(a[_f]); + let o = new private2_test.C(); + core.print(o.g); + core.print(o[_f]); + }; + dart.fn(private2_test.main, VoidTodynamic()); + // Exports: + exports.private2_test = private2_test; + exports.private2_lib = private2_lib; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/regress_18535_test.js b/pkg/dev_compiler/test/codegen_expected/language/regress_18535_test.js index ce55af772b18..0c6a6854ae66 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/regress_18535_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/regress_18535_test.js @@ -1,17 +1 @@ -dart_library.library('language/regress_18535_test', null, /* Imports */[ - 'dart_sdk' -], function load__regress_18535_test(exports, dart_sdk) { - 'use strict'; - const core = dart_sdk.core; - const mirrors = dart_sdk.mirrors; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const regress_18535_test = Object.create(null); - let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))(); - regress_18535_test.main = function() { - core.print(mirrors.currentMirrorSystem().libraries); - }; - dart.fn(regress_18535_test.main, VoidTovoid()); - // Exports: - exports.regress_18535_test = regress_18535_test; -}); +//FAILED TO COMPILE \ No newline at end of file diff --git a/pkg/dev_compiler/test/codegen_expected/language/top_level_entry_test.js b/pkg/dev_compiler/test/codegen_expected/language/top_level_entry_test.js index 0c6a6854ae66..6ead4c1880b3 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/top_level_entry_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/top_level_entry_test.js @@ -1 +1,15 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/top_level_entry_test', null, /* Imports */[ + 'dart_sdk' +], function load__top_level_entry_test(exports, dart_sdk) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const top_level_entry_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + top_level_entry_test.main = function() { + }; + dart.fn(top_level_entry_test.main, VoidTodynamic()); + // Exports: + exports.top_level_entry_test = top_level_entry_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/top_level_multiple_files_test.js b/pkg/dev_compiler/test/codegen_expected/language/top_level_multiple_files_test.js index 0c6a6854ae66..9e8bc81fc6ff 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/top_level_multiple_files_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/top_level_multiple_files_test.js @@ -1 +1,24 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/top_level_multiple_files_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__top_level_multiple_files_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const top_level_multiple_files_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + top_level_multiple_files_test.main = function() { + expect$.Expect.equals(top_level_multiple_files_test.topLevelVar, 42); + expect$.Expect.equals(top_level_multiple_files_test.topLevelMethod(), 87); + }; + dart.fn(top_level_multiple_files_test.main, VoidTodynamic()); + top_level_multiple_files_test.topLevelVar = 42; + top_level_multiple_files_test.topLevelMethod = function() { + return 87; + }; + dart.fn(top_level_multiple_files_test.topLevelMethod, VoidTodynamic()); + // Exports: + exports.top_level_multiple_files_test = top_level_multiple_files_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/language/top_level_non_prefixed_library_test.js b/pkg/dev_compiler/test/codegen_expected/language/top_level_non_prefixed_library_test.js index 0c6a6854ae66..2df0dff7b8dc 100644 --- a/pkg/dev_compiler/test/codegen_expected/language/top_level_non_prefixed_library_test.js +++ b/pkg/dev_compiler/test/codegen_expected/language/top_level_non_prefixed_library_test.js @@ -1 +1,26 @@ -//FAILED TO COMPILE \ No newline at end of file +dart_library.library('language/top_level_non_prefixed_library_test', null, /* Imports */[ + 'dart_sdk', + 'expect' +], function load__top_level_non_prefixed_library_test(exports, dart_sdk, expect) { + 'use strict'; + const core = dart_sdk.core; + const dart = dart_sdk.dart; + const dartx = dart_sdk.dartx; + const expect$ = expect.expect; + const top_level_non_prefixed_library_test = Object.create(null); + const top_level_prefixed_library_test = Object.create(null); + let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); + top_level_non_prefixed_library_test.main = function() { + expect$.Expect.equals(top_level_prefixed_library_test.topLevelVar, 42); + expect$.Expect.equals(top_level_prefixed_library_test.topLevelMethod(), 87); + }; + dart.fn(top_level_non_prefixed_library_test.main, VoidTodynamic()); + top_level_prefixed_library_test.topLevelVar = 42; + top_level_prefixed_library_test.topLevelMethod = function() { + return 87; + }; + dart.fn(top_level_prefixed_library_test.topLevelMethod, VoidTodynamic()); + // Exports: + exports.top_level_non_prefixed_library_test = top_level_non_prefixed_library_test; + exports.top_level_prefixed_library_test = top_level_prefixed_library_test; +}); diff --git a/pkg/dev_compiler/test/codegen_expected/matcher/matcher.js b/pkg/dev_compiler/test/codegen_expected/matcher/matcher.js deleted file mode 100644 index c01c0d776fca..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/matcher/matcher.js +++ /dev/null @@ -1,2009 +0,0 @@ -dart_library.library('matcher', null, /* Imports */[ - 'dart_sdk' -], function load__matcher(exports, dart_sdk) { - 'use strict'; - const core = dart_sdk.core; - const mirrors = dart_sdk.mirrors; - const _interceptors = dart_sdk._interceptors; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const matcher = Object.create(null); - const mirror_matchers = Object.create(null); - const src__core_matchers = Object.create(null); - const src__description = Object.create(null); - const src__error_matchers = Object.create(null); - const src__interfaces = Object.create(null); - const src__iterable_matchers = Object.create(null); - const src__map_matchers = Object.create(null); - const src__numeric_matchers = Object.create(null); - const src__operator_matchers = Object.create(null); - const src__pretty_print = Object.create(null); - const src__string_matchers = Object.create(null); - const src__util = Object.create(null); - let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.functionType(core.bool, [dart.dynamic])))(); - let isInstanceOf = () => (isInstanceOf = dart.constFn(src__core_matchers.isInstanceOf$()))(); - let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(dart.functionType(core.bool, [dart.dynamic, dart.dynamic])))(); - let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))(); - let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))(); - let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))(); - let ListOfMatcher = () => (ListOfMatcher = dart.constFn(core.List$(src__interfaces.Matcher)))(); - let dynamicToMatcher = () => (dynamicToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [dart.dynamic])))(); - let dynamic__ToMatcher = () => (dynamic__ToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [dart.dynamic], [core.int])))(); - let Fn__ToMatcher = () => (Fn__ToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [dynamicTobool()], [core.String])))(); - let IterableAndFnAndStringToMatcher = () => (IterableAndFnAndStringToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.Iterable, dynamicAnddynamicTobool(), core.String])))(); - let IterableToMatcher = () => (IterableToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.Iterable])))(); - let dynamicAnddynamicToMatcher = () => (dynamicAnddynamicToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [dart.dynamic, dart.dynamic])))(); - let numAndnumToMatcher = () => (numAndnumToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.num, core.num])))(); - let dynamic__ToMatcher$ = () => (dynamic__ToMatcher$ = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [dart.dynamic], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))(); - let StringToMatcher = () => (StringToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.String])))(); - let StringToString = () => (StringToString = dart.constFn(dart.definiteFunctionType(core.String, [core.String])))(); - let ListOfStringToMatcher = () => (ListOfStringToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [ListOfString()])))(); - let MapAndMapTovoid = () => (MapAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Map, core.Map])))(); - let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Match])))(); - let String__ToMatcher = () => (String__ToMatcher = dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.String], [dart.dynamic])))(); - let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))(); - let dynamicAnddynamicAnddynamic__ToListOfMatcher = () => (dynamicAnddynamicAnddynamic__ToListOfMatcher = dart.constFn(dart.definiteFunctionType(ListOfMatcher(), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))(); - let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))(); - let dynamicAndintAndSet__ToString = () => (dynamicAndintAndSet__ToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, core.int, core.Set, core.bool])))(); - let dynamic__ToString = () => (dynamic__ToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic], {maxLineLength: core.int, maxItems: core.int})))(); - let intToString = () => (intToString = dart.constFn(dart.definiteFunctionType(core.String, [core.int])))(); - let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))(); - src__interfaces.Matcher = class Matcher extends core.Object { - new() { - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - return mismatchDescription; - } - }; - dart.setSignature(src__interfaces.Matcher, { - constructors: () => ({new: dart.definiteFunctionType(src__interfaces.Matcher, [])}), - methods: () => ({describeMismatch: dart.definiteFunctionType(src__interfaces.Description, [dart.dynamic, src__interfaces.Description, core.Map, core.bool])}) - }); - src__core_matchers._IsTrue = class _IsTrue extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return dart.equals(item, true); - } - describe(description) { - return description.add('true'); - } - }; - dart.setSignature(src__core_matchers._IsTrue, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsTrue, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isTrue = dart.const(new src__core_matchers._IsTrue()); - matcher.isTrue = src__core_matchers.isTrue; - src__core_matchers._IsFalse = class _IsFalse extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return dart.equals(item, false); - } - describe(description) { - return description.add('false'); - } - }; - dart.setSignature(src__core_matchers._IsFalse, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsFalse, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isFalse = dart.const(new src__core_matchers._IsFalse()); - matcher.isFalse = src__core_matchers.isFalse; - src__core_matchers._Empty = class _Empty extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dload(item, 'isEmpty')); - } - describe(description) { - return description.add('empty'); - } - }; - dart.setSignature(src__core_matchers._Empty, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Empty, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isEmpty = dart.const(new src__core_matchers._Empty()); - matcher.isEmpty = src__core_matchers.isEmpty; - src__core_matchers.same = function(expected) { - return new src__core_matchers._IsSameAs(expected); - }; - dart.fn(src__core_matchers.same, dynamicToMatcher()); - matcher.same = src__core_matchers.same; - src__core_matchers.equals = function(expected, limit) { - if (limit === void 0) limit = 100; - return typeof expected == 'string' ? new src__core_matchers._StringEqualsMatcher(expected) : new src__core_matchers._DeepMatcher(expected, limit); - }; - dart.fn(src__core_matchers.equals, dynamic__ToMatcher()); - matcher.equals = src__core_matchers.equals; - const _featureDescription = Symbol('_featureDescription'); - const _featureName = Symbol('_featureName'); - const _matcher = Symbol('_matcher'); - src__core_matchers.CustomMatcher = class CustomMatcher extends src__interfaces.Matcher { - new(featureDescription, featureName, matcher) { - this[_featureDescription] = featureDescription; - this[_featureName] = featureName; - this[_matcher] = src__util.wrapMatcher(matcher); - super.new(); - } - featureValueOf(actual) { - return actual; - } - matches(item, matchState) { - let f = this.featureValueOf(item); - if (dart.test(this[_matcher].matches(f, matchState))) return true; - src__util.addStateInfo(matchState, dart.map({feature: f}, core.String, dart.dynamic)); - return false; - } - describe(description) { - return description.add(this[_featureDescription]).add(' ').addDescriptionOf(this[_matcher]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - mismatchDescription.add('has ').add(this[_featureName]).add(' with value ').addDescriptionOf(matchState[dartx.get]('feature')); - let innerDescription = new src__description.StringDescription(); - this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDescription, core.Map._check(matchState[dartx.get]('state')), verbose); - if (dart.notNull(innerDescription.length) > 0) { - mismatchDescription.add(' which ').add(innerDescription.toString()); - } - return mismatchDescription; - } - }; - dart.setSignature(src__core_matchers.CustomMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.CustomMatcher, [core.String, core.String, dart.dynamic])}), - methods: () => ({ - featureValueOf: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]), - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - matcher.CustomMatcher = src__core_matchers.CustomMatcher; - const _name = Symbol('_name'); - src__core_matchers.TypeMatcher = class TypeMatcher extends src__interfaces.Matcher { - new(name) { - this[_name] = name; - super.new(); - } - describe(description) { - return description.add(this[_name]); - } - }; - dart.setSignature(src__core_matchers.TypeMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.TypeMatcher, [core.String])}), - methods: () => ({describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description])}) - }); - src__core_matchers._IsList = class _IsList extends src__core_matchers.TypeMatcher { - new() { - super.new("List"); - } - matches(item, matchState) { - return core.List.is(item); - } - }; - dart.setSignature(src__core_matchers._IsList, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsList, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__core_matchers.isList = dart.const(new src__core_matchers._IsList()); - matcher.isList = src__core_matchers.isList; - src__core_matchers.predicate = function(f, description) { - if (description === void 0) description = 'satisfies function'; - return new src__core_matchers._Predicate(f, description); - }; - dart.fn(src__core_matchers.predicate, Fn__ToMatcher()); - matcher.predicate = src__core_matchers.predicate; - src__core_matchers._IsNotNull = class _IsNotNull extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return item != null; - } - describe(description) { - return description.add('not null'); - } - }; - dart.setSignature(src__core_matchers._IsNotNull, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsNotNull, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isNotNull = dart.const(new src__core_matchers._IsNotNull()); - matcher.isNotNull = src__core_matchers.isNotNull; - src__core_matchers.hasLength = function(matcher) { - return new src__core_matchers._HasLength(src__util.wrapMatcher(matcher)); - }; - dart.fn(src__core_matchers.hasLength, dynamicToMatcher()); - matcher.hasLength = src__core_matchers.hasLength; - src__core_matchers.isInstanceOf$ = dart.generic(T => { - class isInstanceOf extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(obj, matchState) { - return T.is(obj); - } - describe(description) { - return description.add(dart.str`an instance of ${dart.wrapType(T)}`); - } - } - dart.addTypeTests(isInstanceOf); - dart.setSignature(isInstanceOf, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.isInstanceOf$(T), [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - return isInstanceOf; - }); - src__core_matchers.isInstanceOf = isInstanceOf(); - matcher.isInstanceOf$ = src__core_matchers.isInstanceOf$; - matcher.isInstanceOf = src__core_matchers.isInstanceOf; - src__core_matchers._IsNaN = class _IsNaN extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.double.NAN[dartx.compareTo](core.num._check(item)) == 0; - } - describe(description) { - return description.add('NaN'); - } - }; - dart.setSignature(src__core_matchers._IsNaN, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsNaN, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isNaN = dart.const(new src__core_matchers._IsNaN()); - matcher.isNaN = src__core_matchers.isNaN; - src__core_matchers._ReturnsNormally = class _ReturnsNormally extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(f, matchState) { - try { - dart.dcall(f); - return true; - } catch (e) { - let s = dart.stackTrace(e); - src__util.addStateInfo(matchState, dart.map({exception: e, stack: s}, core.String, dart.dynamic)); - return false; - } - - } - describe(description) { - return description.add("return normally"); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('exception')); - if (dart.test(verbose)) { - mismatchDescription.add(' at ').add(dart.toString(matchState[dartx.get]('stack'))); - } - return mismatchDescription; - } - }; - dart.setSignature(src__core_matchers._ReturnsNormally, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._ReturnsNormally, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.returnsNormally = dart.const(new src__core_matchers._ReturnsNormally()); - matcher.returnsNormally = src__core_matchers.returnsNormally; - src__core_matchers._IsAnything = class _IsAnything extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return true; - } - describe(description) { - return description.add('anything'); - } - }; - dart.setSignature(src__core_matchers._IsAnything, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsAnything, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.anything = dart.const(new src__core_matchers._IsAnything()); - matcher.anything = src__core_matchers.anything; - matcher.TypeMatcher = src__core_matchers.TypeMatcher; - src__core_matchers.contains = function(expected) { - return new src__core_matchers._Contains(expected); - }; - dart.fn(src__core_matchers.contains, dynamicToMatcher()); - matcher.contains = src__core_matchers.contains; - src__core_matchers._NotEmpty = class _NotEmpty extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dload(item, 'isNotEmpty')); - } - describe(description) { - return description.add('non-empty'); - } - }; - dart.setSignature(src__core_matchers._NotEmpty, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._NotEmpty, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isNotEmpty = dart.const(new src__core_matchers._NotEmpty()); - matcher.isNotEmpty = src__core_matchers.isNotEmpty; - src__core_matchers._IsNull = class _IsNull extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return item == null; - } - describe(description) { - return description.add('null'); - } - }; - dart.setSignature(src__core_matchers._IsNull, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsNull, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isNull = dart.const(new src__core_matchers._IsNull()); - matcher.isNull = src__core_matchers.isNull; - src__core_matchers._IsMap = class _IsMap extends src__core_matchers.TypeMatcher { - new() { - super.new("Map"); - } - matches(item, matchState) { - return core.Map.is(item); - } - }; - dart.setSignature(src__core_matchers._IsMap, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsMap, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__core_matchers.isMap = dart.const(new src__core_matchers._IsMap()); - matcher.isMap = src__core_matchers.isMap; - src__core_matchers._IsNotNaN = class _IsNotNaN extends src__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.double.NAN[dartx.compareTo](core.num._check(item)) != 0; - } - describe(description) { - return description.add('not NaN'); - } - }; - dart.setSignature(src__core_matchers._IsNotNaN, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsNotNaN, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers.isNotNaN = dart.const(new src__core_matchers._IsNotNaN()); - matcher.isNotNaN = src__core_matchers.isNotNaN; - src__core_matchers.isIn = function(expected) { - return new src__core_matchers._In(expected); - }; - dart.fn(src__core_matchers.isIn, dynamicToMatcher()); - matcher.isIn = src__core_matchers.isIn; - const _out = Symbol('_out'); - src__description.StringDescription = class StringDescription extends core.Object { - new(init) { - if (init === void 0) init = ''; - this[_out] = new core.StringBuffer(); - this[_out].write(init); - } - get length() { - return this[_out].length; - } - toString() { - return dart.toString(this[_out]); - } - add(text) { - this[_out].write(text); - return this; - } - replace(text) { - this[_out].clear(); - return this.add(text); - } - addDescriptionOf(value) { - if (src__interfaces.Matcher.is(value)) { - value.describe(this); - } else { - this.add(src__pretty_print.prettyPrint(value, {maxLineLength: 80, maxItems: 25})); - } - return this; - } - addAll(start, separator, end, list) { - let separate = false; - this.add(start); - for (let item of list) { - if (separate) { - this.add(separator); - } - this.addDescriptionOf(item); - separate = true; - } - this.add(end); - return this; - } - }; - src__description.StringDescription[dart.implements] = () => [src__interfaces.Description]; - dart.setSignature(src__description.StringDescription, { - constructors: () => ({new: dart.definiteFunctionType(src__description.StringDescription, [], [core.String])}), - methods: () => ({ - add: dart.definiteFunctionType(src__interfaces.Description, [core.String]), - replace: dart.definiteFunctionType(src__interfaces.Description, [core.String]), - addDescriptionOf: dart.definiteFunctionType(src__interfaces.Description, [dart.dynamic]), - addAll: dart.definiteFunctionType(src__interfaces.Description, [core.String, core.String, core.String, core.Iterable]) - }) - }); - matcher.StringDescription = src__description.StringDescription; - src__error_matchers._ConcurrentModificationError = class _ConcurrentModificationError extends src__core_matchers.TypeMatcher { - new() { - super.new("ConcurrentModificationError"); - } - matches(item, matchState) { - return core.ConcurrentModificationError.is(item); - } - }; - dart.setSignature(src__error_matchers._ConcurrentModificationError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._ConcurrentModificationError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isConcurrentModificationError = dart.const(new src__error_matchers._ConcurrentModificationError()); - matcher.isConcurrentModificationError = src__error_matchers.isConcurrentModificationError; - src__error_matchers._CyclicInitializationError = class _CyclicInitializationError extends src__core_matchers.TypeMatcher { - new() { - super.new("CyclicInitializationError"); - } - matches(item, matchState) { - return core.CyclicInitializationError.is(item); - } - }; - dart.setSignature(src__error_matchers._CyclicInitializationError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._CyclicInitializationError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isCyclicInitializationError = dart.const(new src__error_matchers._CyclicInitializationError()); - matcher.isCyclicInitializationError = src__error_matchers.isCyclicInitializationError; - src__error_matchers._ArgumentError = class _ArgumentError extends src__core_matchers.TypeMatcher { - new() { - super.new("ArgumentError"); - } - matches(item, matchState) { - return core.ArgumentError.is(item); - } - }; - dart.setSignature(src__error_matchers._ArgumentError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._ArgumentError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isArgumentError = dart.const(new src__error_matchers._ArgumentError()); - matcher.isArgumentError = src__error_matchers.isArgumentError; - src__error_matchers._Exception = class _Exception extends src__core_matchers.TypeMatcher { - new() { - super.new("Exception"); - } - matches(item, matchState) { - return core.Exception.is(item); - } - }; - dart.setSignature(src__error_matchers._Exception, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Exception, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isException = dart.const(new src__error_matchers._Exception()); - matcher.isException = src__error_matchers.isException; - src__error_matchers._NullThrownError = class _NullThrownError extends src__core_matchers.TypeMatcher { - new() { - super.new("NullThrownError"); - } - matches(item, matchState) { - return core.NullThrownError.is(item); - } - }; - dart.setSignature(src__error_matchers._NullThrownError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._NullThrownError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isNullThrownError = dart.const(new src__error_matchers._NullThrownError()); - matcher.isNullThrownError = src__error_matchers.isNullThrownError; - src__error_matchers._RangeError = class _RangeError extends src__core_matchers.TypeMatcher { - new() { - super.new("RangeError"); - } - matches(item, matchState) { - return core.RangeError.is(item); - } - }; - dart.setSignature(src__error_matchers._RangeError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._RangeError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isRangeError = dart.const(new src__error_matchers._RangeError()); - matcher.isRangeError = src__error_matchers.isRangeError; - src__error_matchers._FormatException = class _FormatException extends src__core_matchers.TypeMatcher { - new() { - super.new("FormatException"); - } - matches(item, matchState) { - return core.FormatException.is(item); - } - }; - dart.setSignature(src__error_matchers._FormatException, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._FormatException, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isFormatException = dart.const(new src__error_matchers._FormatException()); - matcher.isFormatException = src__error_matchers.isFormatException; - src__error_matchers._StateError = class _StateError extends src__core_matchers.TypeMatcher { - new() { - super.new("StateError"); - } - matches(item, matchState) { - return core.StateError.is(item); - } - }; - dart.setSignature(src__error_matchers._StateError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._StateError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isStateError = dart.const(new src__error_matchers._StateError()); - matcher.isStateError = src__error_matchers.isStateError; - src__error_matchers._NoSuchMethodError = class _NoSuchMethodError extends src__core_matchers.TypeMatcher { - new() { - super.new("NoSuchMethodError"); - } - matches(item, matchState) { - return core.NoSuchMethodError.is(item); - } - }; - dart.setSignature(src__error_matchers._NoSuchMethodError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._NoSuchMethodError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isNoSuchMethodError = dart.const(new src__error_matchers._NoSuchMethodError()); - matcher.isNoSuchMethodError = src__error_matchers.isNoSuchMethodError; - src__error_matchers._UnimplementedError = class _UnimplementedError extends src__core_matchers.TypeMatcher { - new() { - super.new("UnimplementedError"); - } - matches(item, matchState) { - return core.UnimplementedError.is(item); - } - }; - dart.setSignature(src__error_matchers._UnimplementedError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._UnimplementedError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isUnimplementedError = dart.const(new src__error_matchers._UnimplementedError()); - matcher.isUnimplementedError = src__error_matchers.isUnimplementedError; - src__error_matchers._UnsupportedError = class _UnsupportedError extends src__core_matchers.TypeMatcher { - new() { - super.new("UnsupportedError"); - } - matches(item, matchState) { - return core.UnsupportedError.is(item); - } - }; - dart.setSignature(src__error_matchers._UnsupportedError, { - constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._UnsupportedError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__error_matchers.isUnsupportedError = dart.const(new src__error_matchers._UnsupportedError()); - matcher.isUnsupportedError = src__error_matchers.isUnsupportedError; - matcher.Matcher = src__interfaces.Matcher; - src__interfaces.Description = class Description extends core.Object {}; - matcher.Description = src__interfaces.Description; - src__iterable_matchers.pairwiseCompare = function(expected, comparator, description) { - return new src__iterable_matchers._PairwiseCompare(expected, comparator, description); - }; - dart.fn(src__iterable_matchers.pairwiseCompare, IterableAndFnAndStringToMatcher()); - matcher.pairwiseCompare = src__iterable_matchers.pairwiseCompare; - src__iterable_matchers.anyElement = function(matcher) { - return new src__iterable_matchers._AnyElement(src__util.wrapMatcher(matcher)); - }; - dart.fn(src__iterable_matchers.anyElement, dynamicToMatcher()); - matcher.anyElement = src__iterable_matchers.anyElement; - src__iterable_matchers.orderedEquals = function(expected) { - return new src__iterable_matchers._OrderedEquals(expected); - }; - dart.fn(src__iterable_matchers.orderedEquals, IterableToMatcher()); - matcher.orderedEquals = src__iterable_matchers.orderedEquals; - src__iterable_matchers.unorderedEquals = function(expected) { - return new src__iterable_matchers._UnorderedEquals(expected); - }; - dart.fn(src__iterable_matchers.unorderedEquals, IterableToMatcher()); - matcher.unorderedEquals = src__iterable_matchers.unorderedEquals; - src__iterable_matchers.unorderedMatches = function(expected) { - return new src__iterable_matchers._UnorderedMatches(expected); - }; - dart.fn(src__iterable_matchers.unorderedMatches, IterableToMatcher()); - matcher.unorderedMatches = src__iterable_matchers.unorderedMatches; - src__iterable_matchers.everyElement = function(matcher) { - return new src__iterable_matchers._EveryElement(src__util.wrapMatcher(matcher)); - }; - dart.fn(src__iterable_matchers.everyElement, dynamicToMatcher()); - matcher.everyElement = src__iterable_matchers.everyElement; - src__map_matchers.containsValue = function(value) { - return new src__map_matchers._ContainsValue(value); - }; - dart.fn(src__map_matchers.containsValue, dynamicToMatcher()); - matcher.containsValue = src__map_matchers.containsValue; - src__map_matchers.containsPair = function(key, value) { - return new src__map_matchers._ContainsMapping(key, src__util.wrapMatcher(value)); - }; - dart.fn(src__map_matchers.containsPair, dynamicAnddynamicToMatcher()); - matcher.containsPair = src__map_matchers.containsPair; - const _value = Symbol('_value'); - const _equalValue = Symbol('_equalValue'); - const _lessThanValue = Symbol('_lessThanValue'); - const _greaterThanValue = Symbol('_greaterThanValue'); - const _comparisonDescription = Symbol('_comparisonDescription'); - const _valueInDescription = Symbol('_valueInDescription'); - src__numeric_matchers._OrderingComparison = class _OrderingComparison extends src__interfaces.Matcher { - new(value, equalValue, lessThanValue, greaterThanValue, comparisonDescription, valueInDescription) { - if (valueInDescription === void 0) valueInDescription = true; - this[_value] = value; - this[_equalValue] = equalValue; - this[_lessThanValue] = lessThanValue; - this[_greaterThanValue] = greaterThanValue; - this[_comparisonDescription] = comparisonDescription; - this[_valueInDescription] = valueInDescription; - super.new(); - } - matches(item, matchState) { - if (dart.equals(item, this[_value])) { - return this[_equalValue]; - } else if (dart.test(dart.dsend(item, '<', this[_value]))) { - return this[_lessThanValue]; - } else { - return this[_greaterThanValue]; - } - } - describe(description) { - if (dart.test(this[_valueInDescription])) { - return description.add(this[_comparisonDescription]).add(' ').addDescriptionOf(this[_value]); - } else { - return description.add(this[_comparisonDescription]); - } - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - mismatchDescription.add('is not '); - return this.describe(mismatchDescription); - } - }; - dart.setSignature(src__numeric_matchers._OrderingComparison, { - constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._OrderingComparison, [dart.dynamic, core.bool, core.bool, core.bool, core.String], [core.bool])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__numeric_matchers.isPositive = dart.const(new src__numeric_matchers._OrderingComparison(0, false, false, true, 'a positive value', false)); - matcher.isPositive = src__numeric_matchers.isPositive; - src__numeric_matchers.isZero = dart.const(new src__numeric_matchers._OrderingComparison(0, true, false, false, 'a value equal to')); - matcher.isZero = src__numeric_matchers.isZero; - src__numeric_matchers.inOpenClosedRange = function(low, high) { - return new src__numeric_matchers._InRange(low, high, false, true); - }; - dart.fn(src__numeric_matchers.inOpenClosedRange, numAndnumToMatcher()); - matcher.inOpenClosedRange = src__numeric_matchers.inOpenClosedRange; - src__numeric_matchers.inClosedOpenRange = function(low, high) { - return new src__numeric_matchers._InRange(low, high, true, false); - }; - dart.fn(src__numeric_matchers.inClosedOpenRange, numAndnumToMatcher()); - matcher.inClosedOpenRange = src__numeric_matchers.inClosedOpenRange; - src__numeric_matchers.lessThanOrEqualTo = function(value) { - return new src__numeric_matchers._OrderingComparison(value, true, true, false, 'a value less than or equal to'); - }; - dart.fn(src__numeric_matchers.lessThanOrEqualTo, dynamicToMatcher()); - matcher.lessThanOrEqualTo = src__numeric_matchers.lessThanOrEqualTo; - src__numeric_matchers.isNegative = dart.const(new src__numeric_matchers._OrderingComparison(0, false, true, false, 'a negative value', false)); - matcher.isNegative = src__numeric_matchers.isNegative; - src__numeric_matchers.inInclusiveRange = function(low, high) { - return new src__numeric_matchers._InRange(low, high, true, true); - }; - dart.fn(src__numeric_matchers.inInclusiveRange, numAndnumToMatcher()); - matcher.inInclusiveRange = src__numeric_matchers.inInclusiveRange; - src__numeric_matchers.lessThan = function(value) { - return new src__numeric_matchers._OrderingComparison(value, false, true, false, 'a value less than'); - }; - dart.fn(src__numeric_matchers.lessThan, dynamicToMatcher()); - matcher.lessThan = src__numeric_matchers.lessThan; - src__numeric_matchers.greaterThan = function(value) { - return new src__numeric_matchers._OrderingComparison(value, false, false, true, 'a value greater than'); - }; - dart.fn(src__numeric_matchers.greaterThan, dynamicToMatcher()); - matcher.greaterThan = src__numeric_matchers.greaterThan; - src__numeric_matchers.isNonNegative = dart.const(new src__numeric_matchers._OrderingComparison(0, true, false, true, 'a non-negative value', false)); - matcher.isNonNegative = src__numeric_matchers.isNonNegative; - src__numeric_matchers.inExclusiveRange = function(low, high) { - return new src__numeric_matchers._InRange(low, high, false, false); - }; - dart.fn(src__numeric_matchers.inExclusiveRange, numAndnumToMatcher()); - matcher.inExclusiveRange = src__numeric_matchers.inExclusiveRange; - src__numeric_matchers.closeTo = function(value, delta) { - return new src__numeric_matchers._IsCloseTo(value, delta); - }; - dart.fn(src__numeric_matchers.closeTo, numAndnumToMatcher()); - matcher.closeTo = src__numeric_matchers.closeTo; - src__numeric_matchers.greaterThanOrEqualTo = function(value) { - return new src__numeric_matchers._OrderingComparison(value, true, false, true, 'a value greater than or equal to'); - }; - dart.fn(src__numeric_matchers.greaterThanOrEqualTo, dynamicToMatcher()); - matcher.greaterThanOrEqualTo = src__numeric_matchers.greaterThanOrEqualTo; - src__numeric_matchers.isNonZero = dart.const(new src__numeric_matchers._OrderingComparison(0, false, true, true, 'a value not equal to')); - matcher.isNonZero = src__numeric_matchers.isNonZero; - src__numeric_matchers.isNonPositive = dart.const(new src__numeric_matchers._OrderingComparison(0, true, true, false, 'a non-positive value', false)); - matcher.isNonPositive = src__numeric_matchers.isNonPositive; - src__operator_matchers.allOf = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - if (arg1 === void 0) arg1 = null; - if (arg2 === void 0) arg2 = null; - if (arg3 === void 0) arg3 = null; - if (arg4 === void 0) arg4 = null; - if (arg5 === void 0) arg5 = null; - if (arg6 === void 0) arg6 = null; - return new src__operator_matchers._AllOf(src__operator_matchers._wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6)); - }; - dart.fn(src__operator_matchers.allOf, dynamic__ToMatcher$()); - matcher.allOf = src__operator_matchers.allOf; - src__operator_matchers.isNot = function(matcher) { - return new src__operator_matchers._IsNot(src__util.wrapMatcher(matcher)); - }; - dart.fn(src__operator_matchers.isNot, dynamicToMatcher()); - matcher.isNot = src__operator_matchers.isNot; - src__operator_matchers.anyOf = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - if (arg1 === void 0) arg1 = null; - if (arg2 === void 0) arg2 = null; - if (arg3 === void 0) arg3 = null; - if (arg4 === void 0) arg4 = null; - if (arg5 === void 0) arg5 = null; - if (arg6 === void 0) arg6 = null; - return new src__operator_matchers._AnyOf(src__operator_matchers._wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6)); - }; - dart.fn(src__operator_matchers.anyOf, dynamic__ToMatcher$()); - matcher.anyOf = src__operator_matchers.anyOf; - src__string_matchers.endsWith = function(suffixString) { - return new src__string_matchers._StringEndsWith(suffixString); - }; - dart.fn(src__string_matchers.endsWith, StringToMatcher()); - matcher.endsWith = src__string_matchers.endsWith; - src__string_matchers.startsWith = function(prefixString) { - return new src__string_matchers._StringStartsWith(prefixString); - }; - dart.fn(src__string_matchers.startsWith, StringToMatcher()); - matcher.startsWith = src__string_matchers.startsWith; - src__string_matchers.matches = function(re) { - return new src__string_matchers._MatchesRegExp(re); - }; - dart.fn(src__string_matchers.matches, dynamicToMatcher()); - matcher.matches = src__string_matchers.matches; - src__string_matchers.collapseWhitespace = function(string) { - let result = new core.StringBuffer(); - let skipSpace = true; - for (let i = 0; i < dart.notNull(string[dartx.length]); i++) { - let character = string[dartx.get](i); - if (dart.test(src__string_matchers._isWhitespace(character))) { - if (!skipSpace) { - result.write(' '); - skipSpace = true; - } - } else { - result.write(character); - skipSpace = false; - } - } - return result.toString()[dartx.trim](); - }; - dart.fn(src__string_matchers.collapseWhitespace, StringToString()); - matcher.collapseWhitespace = src__string_matchers.collapseWhitespace; - src__string_matchers.equalsIgnoringCase = function(value) { - return new src__string_matchers._IsEqualIgnoringCase(value); - }; - dart.fn(src__string_matchers.equalsIgnoringCase, StringToMatcher()); - matcher.equalsIgnoringCase = src__string_matchers.equalsIgnoringCase; - src__string_matchers.equalsIgnoringWhitespace = function(value) { - return new src__string_matchers._IsEqualIgnoringWhitespace(value); - }; - dart.fn(src__string_matchers.equalsIgnoringWhitespace, StringToMatcher()); - matcher.equalsIgnoringWhitespace = src__string_matchers.equalsIgnoringWhitespace; - src__string_matchers.stringContainsInOrder = function(substrings) { - return new src__string_matchers._StringContainsInOrder(substrings); - }; - dart.fn(src__string_matchers.stringContainsInOrder, ListOfStringToMatcher()); - matcher.stringContainsInOrder = src__string_matchers.stringContainsInOrder; - src__util.addStateInfo = function(matchState, values) { - let innerState = core.Map.from(matchState); - matchState[dartx.clear](); - matchState[dartx.set]('state', innerState); - matchState[dartx.addAll](values); - }; - dart.fn(src__util.addStateInfo, MapAndMapTovoid()); - matcher.addStateInfo = src__util.addStateInfo; - src__util.wrapMatcher = function(x) { - if (src__interfaces.Matcher.is(x)) { - return x; - } else if (src__util._Predicate.is(x)) { - return src__core_matchers.predicate(x); - } else { - return src__core_matchers.equals(x); - } - }; - dart.fn(src__util.wrapMatcher, dynamicToMatcher()); - matcher.wrapMatcher = src__util.wrapMatcher; - src__util.escape = function(str) { - str = str[dartx.replaceAll]('\\', '\\\\'); - return str[dartx.replaceAllMapped](src__util._escapeRegExp, dart.fn(match => { - let mapped = src__util._escapeMap[dartx.get](match.get(0)); - if (mapped != null) return mapped; - return src__util._getHexLiteral(match.get(0)); - }, MatchToString())); - }; - dart.fn(src__util.escape, StringToString()); - matcher.escape = src__util.escape; - mirror_matchers.hasProperty = function(name, matcher) { - if (matcher === void 0) matcher = null; - return new mirror_matchers._HasProperty(name, matcher == null ? null : src__util.wrapMatcher(matcher)); - }; - dart.fn(mirror_matchers.hasProperty, String__ToMatcher()); - const _name$ = Symbol('_name'); - const _matcher$ = Symbol('_matcher'); - mirror_matchers._HasProperty = class _HasProperty extends src__interfaces.Matcher { - new(name, matcher) { - if (matcher === void 0) matcher = null; - this[_name$] = name; - this[_matcher$] = matcher; - super.new(); - } - matches(item, matchState) { - let mirror = mirrors.reflect(item); - let classMirror = mirror.type; - let symbol = core.Symbol.new(this[_name$]); - let candidate = classMirror.declarations[dartx.get](symbol); - if (candidate == null) { - src__util.addStateInfo(matchState, dart.map({reason: dart.str`has no property named "${this[_name$]}"`}, core.String, core.String)); - return false; - } - let isInstanceField = mirrors.VariableMirror.is(candidate) && !dart.test(candidate.isStatic); - let isInstanceGetter = mirrors.MethodMirror.is(candidate) && dart.test(candidate.isGetter) && !dart.test(candidate.isStatic); - if (!(isInstanceField || isInstanceGetter)) { - src__util.addStateInfo(matchState, dart.map({reason: dart.str`has a member named "${this[_name$]}", but it is not an instance property`}, core.String, core.String)); - return false; - } - if (this[_matcher$] == null) return true; - let result = mirror.getField(symbol); - let resultMatches = this[_matcher$].matches(result.reflectee, matchState); - if (!dart.test(resultMatches)) { - src__util.addStateInfo(matchState, dart.map({value: result.reflectee}, core.String, dart.dynamic)); - } - return resultMatches; - } - describe(description) { - description.add(dart.str`has property "${this[_name$]}"`); - if (this[_matcher$] != null) { - description.add(' which matches ').addDescriptionOf(this[_matcher$]); - } - return description; - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - let reason = matchState == null ? null : matchState[dartx.get]('reason'); - if (reason != null) { - mismatchDescription.add(core.String._check(reason)); - } else { - mismatchDescription.add(dart.str`has property "${this[_name$]}" with value `).addDescriptionOf(matchState[dartx.get]('value')); - let innerDescription = new src__description.StringDescription(); - this[_matcher$].describeMismatch(matchState[dartx.get]('value'), innerDescription, core.Map._check(matchState[dartx.get]('state')), verbose); - if (dart.notNull(innerDescription.length) > 0) { - mismatchDescription.add(' which ').add(innerDescription.toString()); - } - } - return mismatchDescription; - } - }; - dart.setSignature(mirror_matchers._HasProperty, { - constructors: () => ({new: dart.definiteFunctionType(mirror_matchers._HasProperty, [core.String], [src__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _expected = Symbol('_expected'); - src__core_matchers._IsSameAs = class _IsSameAs extends src__interfaces.Matcher { - new(expected) { - this[_expected] = expected; - super.new(); - } - matches(item, matchState) { - return core.identical(item, this[_expected]); - } - describe(description) { - return description.add('same instance as ').addDescriptionOf(this[_expected]); - } - }; - dart.setSignature(src__core_matchers._IsSameAs, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsSameAs, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _limit = Symbol('_limit'); - const _compareIterables = Symbol('_compareIterables'); - const _compareSets = Symbol('_compareSets'); - const _recursiveMatch = Symbol('_recursiveMatch'); - const _match = Symbol('_match'); - src__core_matchers._DeepMatcher = class _DeepMatcher extends src__interfaces.Matcher { - new(expected, limit) { - if (limit === void 0) limit = 1000; - this[_expected] = expected; - this[_limit] = limit; - this.count = null; - super.new(); - } - [_compareIterables](expected, actual, matcher, depth, location) { - if (!core.Iterable.is(actual)) return ['is not Iterable', location]; - let expectedIterator = dart.dload(expected, 'iterator'); - let actualIterator = dart.dload(actual, 'iterator'); - for (let index = 0;; index++) { - let expectedNext = dart.dsend(expectedIterator, 'moveNext'); - let actualNext = dart.dsend(actualIterator, 'moveNext'); - if (!dart.test(expectedNext) && !dart.test(actualNext)) return null; - let newLocation = dart.str`${location}[${index}]`; - if (!dart.test(expectedNext)) return JSArrayOfString().of(['longer than expected', newLocation]); - if (!dart.test(actualNext)) return JSArrayOfString().of(['shorter than expected', newLocation]); - let rp = dart.dcall(matcher, dart.dload(expectedIterator, 'current'), dart.dload(actualIterator, 'current'), newLocation, depth); - if (rp != null) return core.List._check(rp); - } - } - [_compareSets](expected, actual, matcher, depth, location) { - if (!core.Iterable.is(actual)) return ['is not Iterable', location]; - actual = dart.dsend(actual, 'toSet'); - for (let expectedElement of expected) { - if (dart.test(dart.dsend(actual, 'every', dart.fn(actualElement => dart.dcall(matcher, expectedElement, actualElement, location, depth) != null, dynamicTobool$())))) { - return [dart.str`does not contain ${expectedElement}`, location]; - } - } - if (dart.test(dart.dsend(dart.dload(actual, 'length'), '>', expected.length))) { - return ['larger than expected', location]; - } else if (dart.test(dart.dsend(dart.dload(actual, 'length'), '<', expected.length))) { - return ['smaller than expected', location]; - } else { - return null; - } - } - [_recursiveMatch](expected, actual, location, depth) { - if (src__interfaces.Matcher.is(expected)) { - let matchState = dart.map(); - if (dart.test(expected.matches(actual, matchState))) return null; - let description = new src__description.StringDescription(); - expected.describe(description); - return JSArrayOfString().of([dart.str`does not match ${description}`, location]); - } else { - try { - if (dart.equals(expected, actual)) return null; - } catch (e) { - return JSArrayOfString().of([dart.str`== threw "${e}"`, location]); - } - - } - if (dart.notNull(depth) > dart.notNull(this[_limit])) return JSArrayOfString().of(['recursion depth limit exceeded', location]); - if (depth == 0 || dart.notNull(this[_limit]) > 1) { - if (core.Set.is(expected)) { - return this[_compareSets](expected, actual, dart.bind(this, _recursiveMatch), dart.notNull(depth) + 1, location); - } else if (core.Iterable.is(expected)) { - return this[_compareIterables](expected, actual, dart.bind(this, _recursiveMatch), dart.notNull(depth) + 1, location); - } else if (core.Map.is(expected)) { - if (!core.Map.is(actual)) return JSArrayOfString().of(['expected a map', location]); - let err = dart.equals(expected[dartx.length], dart.dload(actual, 'length')) ? '' : 'has different length and '; - for (let key of expected[dartx.keys]) { - if (!dart.test(dart.dsend(actual, 'containsKey', key))) { - return JSArrayOfString().of([dart.str`${err}is missing map key '${key}'`, location]); - } - } - for (let key of core.Iterable._check(dart.dload(actual, 'keys'))) { - if (!dart.test(expected[dartx.containsKey](key))) { - return JSArrayOfString().of([dart.str`${err}has extra map key '${key}'`, location]); - } - } - for (let key of expected[dartx.keys]) { - let rp = this[_recursiveMatch](expected[dartx.get](key), dart.dindex(actual, key), dart.str`${location}['${key}']`, dart.notNull(depth) + 1); - if (rp != null) return rp; - } - return null; - } - } - let description = new src__description.StringDescription(); - if (dart.notNull(depth) > 0) { - description.add('was ').addDescriptionOf(actual).add(' instead of ').addDescriptionOf(expected); - return JSArrayOfString().of([description.toString(), location]); - } - return JSArrayOfString().of(["", location]); - } - [_match](expected, actual, matchState) { - let rp = this[_recursiveMatch](expected, actual, '', 0); - if (rp == null) return null; - let reason = null; - if (dart.test(dart.dsend(dart.dload(rp[dartx.get](0), 'length'), '>', 0))) { - if (dart.test(dart.dsend(dart.dload(rp[dartx.get](1), 'length'), '>', 0))) { - reason = dart.str`${rp[dartx.get](0)} at location ${rp[dartx.get](1)}`; - } else { - reason = rp[dartx.get](0); - } - } else { - reason = ''; - } - src__util.addStateInfo(matchState, dart.map({reason: reason}, core.String, dart.dynamic)); - return core.String._check(reason); - } - matches(item, matchState) { - return this[_match](this[_expected], item, matchState) == null; - } - describe(description) { - return description.addDescriptionOf(this[_expected]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - let reason = matchState[dartx.get]('reason'); - if (dart.equals(dart.dload(reason, 'length'), 0) && dart.notNull(mismatchDescription.length) > 0) { - mismatchDescription.add('is ').addDescriptionOf(item); - } else { - mismatchDescription.add(core.String._check(reason)); - } - return mismatchDescription; - } - }; - dart.setSignature(src__core_matchers._DeepMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._DeepMatcher, [dart.dynamic], [core.int])}), - methods: () => ({ - [_compareIterables]: dart.definiteFunctionType(core.List, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_compareSets]: dart.definiteFunctionType(core.List, [core.Set, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_recursiveMatch]: dart.definiteFunctionType(core.List, [dart.dynamic, dart.dynamic, core.String, core.int]), - [_match]: dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic, core.Map]), - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _value$ = Symbol('_value'); - src__core_matchers._StringEqualsMatcher = class _StringEqualsMatcher extends src__interfaces.Matcher { - new(value) { - this[_value$] = value; - super.new(); - } - get showActualValue() { - return true; - } - matches(item, matchState) { - return dart.equals(this[_value$], item); - } - describe(description) { - return description.addDescriptionOf(this[_value$]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'string')) { - return mismatchDescription.addDescriptionOf(item).add('is not a string'); - } else { - let buff = new core.StringBuffer(); - buff.write('is different.'); - let escapedItem = src__util.escape(core.String._check(item)); - let escapedValue = src__util.escape(this[_value$]); - let minLength = dart.notNull(escapedItem[dartx.length]) < dart.notNull(escapedValue[dartx.length]) ? escapedItem[dartx.length] : escapedValue[dartx.length]; - let start = 0; - for (; start < dart.notNull(minLength); start++) { - if (escapedValue[dartx.codeUnitAt](start) != escapedItem[dartx.codeUnitAt](start)) { - break; - } - } - if (start == minLength) { - if (dart.notNull(escapedValue[dartx.length]) < dart.notNull(escapedItem[dartx.length])) { - buff.write(' Both strings start the same, but the given value also' + ' has the following trailing characters: '); - src__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedItem, escapedValue[dartx.length]); - } else { - buff.write(' Both strings start the same, but the given value is' + ' missing the following trailing characters: '); - src__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedValue, escapedItem[dartx.length]); - } - } else { - buff.write('\nExpected: '); - src__core_matchers._StringEqualsMatcher._writeLeading(buff, escapedValue, start); - src__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedValue, start); - buff.write('\n Actual: '); - src__core_matchers._StringEqualsMatcher._writeLeading(buff, escapedItem, start); - src__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedItem, start); - buff.write('\n '); - for (let i = start > 10 ? 14 : start; i > 0; i--) - buff.write(' '); - buff.write(dart.str`^\n Differ at offset ${start}`); - } - return mismatchDescription.replace(buff.toString()); - } - } - static _writeLeading(buff, s, start) { - if (dart.notNull(start) > 10) { - buff.write('... '); - buff.write(s[dartx.substring](dart.notNull(start) - 10, start)); - } else { - buff.write(s[dartx.substring](0, start)); - } - } - static _writeTrailing(buff, s, start) { - if (dart.notNull(start) + 10 > dart.notNull(s[dartx.length])) { - buff.write(s[dartx.substring](start)); - } else { - buff.write(s[dartx.substring](start, dart.notNull(start) + 10)); - buff.write(' ...'); - } - } - }; - dart.setSignature(src__core_matchers._StringEqualsMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._StringEqualsMatcher, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }), - statics: () => ({ - _writeLeading: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.int]), - _writeTrailing: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.int]) - }), - names: ['_writeLeading', '_writeTrailing'] - }); - src__core_matchers._HasLength = class _HasLength extends src__interfaces.Matcher { - new(matcher) { - if (matcher === void 0) matcher = null; - this[_matcher] = matcher; - super.new(); - } - matches(item, matchState) { - try { - if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dart.dload(item, 'length')), '>=', 0))) { - return this[_matcher].matches(dart.dload(item, 'length'), matchState); - } - } catch (e) { - } - - return false; - } - describe(description) { - return description.add('an object with length of ').addDescriptionOf(this[_matcher]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - try { - if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dart.dload(item, 'length')), '>=', 0))) { - return mismatchDescription.add('has length of ').addDescriptionOf(dart.dload(item, 'length')); - } - } catch (e) { - } - - return mismatchDescription.add('has no length property'); - } - }; - dart.setSignature(src__core_matchers._HasLength, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._HasLength, [], [src__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers._Contains = class _Contains extends src__interfaces.Matcher { - new(expected) { - this[_expected] = expected; - super.new(); - } - matches(item, matchState) { - if (typeof item == 'string') { - return dart.notNull(item[dartx.indexOf](core.Pattern._check(this[_expected]))) >= 0; - } else if (core.Iterable.is(item)) { - if (src__interfaces.Matcher.is(this[_expected])) { - return item[dartx.any](dart.fn(e => core.bool._check(dart.dsend(this[_expected], 'matches', e, matchState)), dynamicTobool$())); - } else { - return item[dartx.contains](this[_expected]); - } - } else if (core.Map.is(item)) { - return item[dartx.containsKey](this[_expected]); - } - return false; - } - describe(description) { - return description.add('contains ').addDescriptionOf(this[_expected]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (typeof item == 'string' || core.Iterable.is(item) || core.Map.is(item)) { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } else { - return mismatchDescription.add('is not a string, map or iterable'); - } - } - }; - dart.setSignature(src__core_matchers._Contains, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Contains, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers._In = class _In extends src__interfaces.Matcher { - new(expected) { - this[_expected] = expected; - super.new(); - } - matches(item, matchState) { - if (typeof this[_expected] == 'string') { - return core.bool._check(dart.dsend(dart.dsend(this[_expected], 'indexOf', item), '>=', 0)); - } else if (core.Iterable.is(this[_expected])) { - return core.bool._check(dart.dsend(this[_expected], 'any', dart.fn(e => dart.equals(e, item), dynamicTobool$()))); - } else if (core.Map.is(this[_expected])) { - return core.bool._check(dart.dsend(this[_expected], 'containsKey', item)); - } - return false; - } - describe(description) { - return description.add('is in ').addDescriptionOf(this[_expected]); - } - }; - dart.setSignature(src__core_matchers._In, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._In, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__core_matchers._PredicateFunction = dart.typedef('_PredicateFunction', () => dart.functionType(core.bool, [dart.dynamic])); - const _description = Symbol('_description'); - src__core_matchers._Predicate = class _Predicate extends src__interfaces.Matcher { - new(matcher, description) { - this[_matcher] = matcher; - this[_description] = description; - super.new(); - } - matches(item, matchState) { - return dart.dcall(this[_matcher], item); - } - describe(description) { - return description.add(this[_description]); - } - }; - dart.setSignature(src__core_matchers._Predicate, { - constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Predicate, [src__core_matchers._PredicateFunction, core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _matcher$0 = Symbol('_matcher'); - src__iterable_matchers._IterableMatcher = class _IterableMatcher extends src__interfaces.Matcher { - new() { - super.new(); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Iterable.is(item)) { - return mismatchDescription.addDescriptionOf(item).add(' not an Iterable'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__iterable_matchers._IterableMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._IterableMatcher, [])}) - }); - src__iterable_matchers._EveryElement = class _EveryElement extends src__iterable_matchers._IterableMatcher { - new(matcher) { - this[_matcher$0] = matcher; - super.new(); - } - matches(item, matchState) { - if (!core.Iterable.is(item)) { - return false; - } - let i = 0; - for (let element of core.Iterable._check(item)) { - if (!dart.test(this[_matcher$0].matches(element, matchState))) { - src__util.addStateInfo(matchState, dart.map({index: i, element: element}, core.String, dart.dynamic)); - return false; - } - ++i; - } - return true; - } - describe(description) { - return description.add('every element(').addDescriptionOf(this[_matcher$0]).add(')'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (matchState[dartx.get]('index') != null) { - let index = matchState[dartx.get]('index'); - let element = matchState[dartx.get]('element'); - mismatchDescription.add('has value ').addDescriptionOf(element).add(' which '); - let subDescription = new src__description.StringDescription(); - this[_matcher$0].describeMismatch(element, subDescription, core.Map._check(matchState[dartx.get]('state')), verbose); - if (dart.notNull(subDescription.length) > 0) { - mismatchDescription.add(subDescription.toString()); - } else { - mismatchDescription.add("doesn't match "); - this[_matcher$0].describe(mismatchDescription); - } - mismatchDescription.add(dart.str` at index ${index}`); - return mismatchDescription; - } - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - }; - dart.setSignature(src__iterable_matchers._EveryElement, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._EveryElement, [src__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__iterable_matchers._AnyElement = class _AnyElement extends src__iterable_matchers._IterableMatcher { - new(matcher) { - this[_matcher$0] = matcher; - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dsend(item, 'any', dart.fn(e => this[_matcher$0].matches(e, matchState), dynamicTobool$()))); - } - describe(description) { - return description.add('some element ').addDescriptionOf(this[_matcher$0]); - } - }; - dart.setSignature(src__iterable_matchers._AnyElement, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._AnyElement, [src__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _expected$ = Symbol('_expected'); - src__iterable_matchers._OrderedEquals = class _OrderedEquals extends src__interfaces.Matcher { - new(expected) { - this[_expected$] = expected; - this[_matcher$0] = null; - super.new(); - this[_matcher$0] = src__core_matchers.equals(this[_expected$], 1); - } - matches(item, matchState) { - return core.Iterable.is(item) && dart.test(this[_matcher$0].matches(item, matchState)); - } - describe(description) { - return description.add('equals ').addDescriptionOf(this[_expected$]).add(' ordered'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Iterable.is(item)) { - return mismatchDescription.add('is not an Iterable'); - } else { - return this[_matcher$0].describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__iterable_matchers._OrderedEquals, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._OrderedEquals, [core.Iterable])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _expectedValues = Symbol('_expectedValues'); - const _test = Symbol('_test'); - src__iterable_matchers._UnorderedMatches = class _UnorderedMatches extends src__interfaces.Matcher { - new(expected) { - this[_expected$] = expected[dartx.map](src__interfaces.Matcher)(src__util.wrapMatcher)[dartx.toList](); - super.new(); - } - [_test](item) { - if (!core.Iterable.is(item)) return 'not iterable'; - item = dart.dsend(item, 'toList'); - if (dart.notNull(this[_expected$][dartx.length]) > dart.notNull(core.num._check(dart.dload(item, 'length')))) { - return dart.str`has too few elements (${dart.dload(item, 'length')} < ${this[_expected$][dartx.length]})`; - } else if (dart.notNull(this[_expected$][dartx.length]) < dart.notNull(core.num._check(dart.dload(item, 'length')))) { - return dart.str`has too many elements (${dart.dload(item, 'length')} > ${this[_expected$][dartx.length]})`; - } - let matched = ListOfbool().filled(core.int._check(dart.dload(item, 'length')), false); - let expectedPosition = 0; - for (let expectedMatcher of this[_expected$]) { - let actualPosition = 0; - let gotMatch = false; - for (let actualElement of core.Iterable._check(item)) { - if (!dart.test(matched[dartx.get](actualPosition))) { - if (dart.test(expectedMatcher.matches(actualElement, dart.map()))) { - matched[dartx.set](actualPosition, gotMatch = true); - break; - } - } - ++actualPosition; - } - if (!gotMatch) { - return dart.toString(new src__description.StringDescription().add('has no match for ').addDescriptionOf(expectedMatcher).add(dart.str` at index ${expectedPosition}`)); - } - ++expectedPosition; - } - return null; - } - matches(item, mismatchState) { - return this[_test](item) == null; - } - describe(description) { - return description.add('matches ').addAll('[', ', ', ']', this[_expected$]).add(' unordered'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - return mismatchDescription.add(this[_test](item)); - } - }; - dart.setSignature(src__iterable_matchers._UnorderedMatches, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._UnorderedMatches, [core.Iterable])}), - methods: () => ({ - [_test]: dart.definiteFunctionType(core.String, [dart.dynamic]), - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__iterable_matchers._UnorderedEquals = class _UnorderedEquals extends src__iterable_matchers._UnorderedMatches { - new(expected) { - this[_expectedValues] = expected[dartx.toList](); - super.new(expected[dartx.map](src__interfaces.Matcher)(src__core_matchers.equals)); - } - describe(description) { - return description.add('equals ').addDescriptionOf(this[_expectedValues]).add(' unordered'); - } - }; - dart.setSignature(src__iterable_matchers._UnorderedEquals, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._UnorderedEquals, [core.Iterable])}) - }); - src__iterable_matchers._Comparator = dart.typedef('_Comparator', () => dart.functionType(core.bool, [dart.dynamic, dart.dynamic])); - const _comparator = Symbol('_comparator'); - const _description$ = Symbol('_description'); - src__iterable_matchers._PairwiseCompare = class _PairwiseCompare extends src__iterable_matchers._IterableMatcher { - new(expected, comparator, description) { - this[_expected$] = expected; - this[_comparator] = comparator; - this[_description$] = description; - super.new(); - } - matches(item, matchState) { - if (!core.Iterable.is(item)) return false; - if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length])) return false; - let iterator = dart.dload(item, 'iterator'); - let i = 0; - for (let e of this[_expected$]) { - dart.dsend(iterator, 'moveNext'); - if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'current')))) { - src__util.addStateInfo(matchState, dart.map({index: i, expected: e, actual: dart.dload(iterator, 'current')}, core.String, dart.dynamic)); - return false; - } - i++; - } - return true; - } - describe(description) { - return description.add(dart.str`pairwise ${this[_description$]} `).addDescriptionOf(this[_expected$]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Iterable.is(item)) { - return mismatchDescription.add('is not an Iterable'); - } else if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length])) { - return mismatchDescription.add(dart.str`has length ${dart.dload(item, 'length')} instead of ${this[_expected$][dartx.length]}`); - } else { - return mismatchDescription.add('has ').addDescriptionOf(matchState[dartx.get]("actual")).add(dart.str` which is not ${this[_description$]} `).addDescriptionOf(matchState[dartx.get]("expected")).add(dart.str` at index ${matchState[dartx.get]("index")}`); - } - } - }; - dart.setSignature(src__iterable_matchers._PairwiseCompare, { - constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers._PairwiseCompare, [core.Iterable, src__iterable_matchers._Comparator, core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _value$0 = Symbol('_value'); - src__map_matchers._ContainsValue = class _ContainsValue extends src__interfaces.Matcher { - new(value) { - this[_value$0] = value; - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dsend(item, 'containsValue', this[_value$0])); - } - describe(description) { - return description.add('contains value ').addDescriptionOf(this[_value$0]); - } - }; - dart.setSignature(src__map_matchers._ContainsValue, { - constructors: () => ({new: dart.definiteFunctionType(src__map_matchers._ContainsValue, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _key = Symbol('_key'); - const _valueMatcher = Symbol('_valueMatcher'); - src__map_matchers._ContainsMapping = class _ContainsMapping extends src__interfaces.Matcher { - new(key, valueMatcher) { - this[_key] = key; - this[_valueMatcher] = valueMatcher; - super.new(); - } - matches(item, matchState) { - return dart.test(dart.dsend(item, 'containsKey', this[_key])) && dart.test(this[_valueMatcher].matches(dart.dindex(item, this[_key]), matchState)); - } - describe(description) { - return description.add('contains pair ').addDescriptionOf(this[_key]).add(' => ').addDescriptionOf(this[_valueMatcher]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!dart.test(dart.dsend(item, 'containsKey', this[_key]))) { - return mismatchDescription.add(" doesn't contain key ").addDescriptionOf(this[_key]); - } else { - mismatchDescription.add(' contains key ').addDescriptionOf(this[_key]).add(' but with value '); - this[_valueMatcher].describeMismatch(dart.dindex(item, this[_key]), mismatchDescription, matchState, verbose); - return mismatchDescription; - } - } - }; - dart.setSignature(src__map_matchers._ContainsMapping, { - constructors: () => ({new: dart.definiteFunctionType(src__map_matchers._ContainsMapping, [dart.dynamic, src__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__numeric_matchers._isNumeric = function(value) { - return typeof value == 'number'; - }; - dart.fn(src__numeric_matchers._isNumeric, dynamicTobool$()); - const _delta = Symbol('_delta'); - src__numeric_matchers._IsCloseTo = class _IsCloseTo extends src__interfaces.Matcher { - new(value, delta) { - this[_value] = value; - this[_delta] = delta; - super.new(); - } - matches(item, matchState) { - if (!dart.test(src__numeric_matchers._isNumeric(item))) { - return false; - } - let diff = dart.dsend(item, '-', this[_value]); - if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-'); - return core.bool._check(dart.dsend(diff, '<=', this[_delta])); - } - describe(description) { - return description.add('a numeric value within ').addDescriptionOf(this[_delta]).add(' of ').addDescriptionOf(this[_value]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'number')) { - return mismatchDescription.add(' not numeric'); - } else { - let diff = dart.dsend(item, '-', this[_value]); - if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-'); - return mismatchDescription.add(' differs by ').addDescriptionOf(diff); - } - } - }; - dart.setSignature(src__numeric_matchers._IsCloseTo, { - constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._IsCloseTo, [core.num, core.num])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _low = Symbol('_low'); - const _high = Symbol('_high'); - const _lowMatchValue = Symbol('_lowMatchValue'); - const _highMatchValue = Symbol('_highMatchValue'); - src__numeric_matchers._InRange = class _InRange extends src__interfaces.Matcher { - new(low, high, lowMatchValue, highMatchValue) { - this[_low] = low; - this[_high] = high; - this[_lowMatchValue] = lowMatchValue; - this[_highMatchValue] = highMatchValue; - super.new(); - } - matches(value, matchState) { - if (!(typeof value == 'number')) { - return false; - } - if (dart.test(dart.dsend(value, '<', this[_low])) || dart.test(dart.dsend(value, '>', this[_high]))) { - return false; - } - if (dart.equals(value, this[_low])) { - return this[_lowMatchValue]; - } - if (dart.equals(value, this[_high])) { - return this[_highMatchValue]; - } - return true; - } - describe(description) { - return description.add("be in range from " + dart.str`${this[_low]} (${dart.test(this[_lowMatchValue]) ? 'inclusive' : 'exclusive'}) to ` + dart.str`${this[_high]} (${dart.test(this[_highMatchValue]) ? 'inclusive' : 'exclusive'})`); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'number')) { - return mismatchDescription.addDescriptionOf(item).add(' not numeric'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__numeric_matchers._InRange, { - constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._InRange, [core.num, core.num, core.bool, core.bool])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _matcher$1 = Symbol('_matcher'); - src__operator_matchers._IsNot = class _IsNot extends src__interfaces.Matcher { - new(matcher) { - this[_matcher$1] = matcher; - super.new(); - } - matches(item, matchState) { - return !dart.test(this[_matcher$1].matches(item, matchState)); - } - describe(description) { - return description.add('not ').addDescriptionOf(this[_matcher$1]); - } - }; - dart.setSignature(src__operator_matchers._IsNot, { - constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers._IsNot, [src__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _matchers = Symbol('_matchers'); - src__operator_matchers._AllOf = class _AllOf extends src__interfaces.Matcher { - new(matchers) { - this[_matchers] = matchers; - super.new(); - } - matches(item, matchState) { - for (let matcher of this[_matchers]) { - if (!dart.test(matcher.matches(item, matchState))) { - src__util.addStateInfo(matchState, dart.map({matcher: matcher}, core.String, src__interfaces.Matcher)); - return false; - } - } - return true; - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - let matcher = matchState[dartx.get]('matcher'); - dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchState[dartx.get]('state'), verbose); - return mismatchDescription; - } - describe(description) { - return description.addAll('(', ' and ', ')', this[_matchers]); - } - }; - dart.setSignature(src__operator_matchers._AllOf, { - constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers._AllOf, [core.List$(src__interfaces.Matcher)])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__operator_matchers._AnyOf = class _AnyOf extends src__interfaces.Matcher { - new(matchers) { - this[_matchers] = matchers; - super.new(); - } - matches(item, matchState) { - for (let matcher of this[_matchers]) { - if (dart.test(matcher.matches(item, matchState))) { - return true; - } - } - return false; - } - describe(description) { - return description.addAll('(', ' or ', ')', this[_matchers]); - } - }; - dart.setSignature(src__operator_matchers._AnyOf, { - constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers._AnyOf, [core.List$(src__interfaces.Matcher)])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__operator_matchers._wrapArgs = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - let args = null; - if (core.List.is(arg0)) { - if (arg1 != null || arg2 != null || arg3 != null || arg4 != null || arg5 != null || arg6 != null) { - dart.throw(new core.ArgumentError('If arg0 is a List, all other arguments must be' + ' null.')); - } - args = arg0; - } else { - args = [arg0, arg1, arg2, arg3, arg4, arg5, arg6][dartx.where](dart.fn(e => e != null, dynamicTobool$())); - } - return args[dartx.map](src__interfaces.Matcher)(dart.fn(e => src__util.wrapMatcher(e), dynamicToMatcher()))[dartx.toList](); - }; - dart.fn(src__operator_matchers._wrapArgs, dynamicAnddynamicAnddynamic__ToListOfMatcher()); - src__pretty_print.prettyPrint = function(object, opts) { - let maxLineLength = opts && 'maxLineLength' in opts ? opts.maxLineLength : null; - let maxItems = opts && 'maxItems' in opts ? opts.maxItems : null; - function _prettyPrint(object, indent, seen, top) { - if (src__interfaces.Matcher.is(object)) { - let description = new src__description.StringDescription(); - object.describe(description); - return dart.str`<${description}>`; - } - if (dart.test(seen.contains(object))) return "(recursive)"; - seen = seen.union(core.Set.from([object])); - function pp(child) { - return _prettyPrint(child, dart.notNull(indent) + 2, seen, false); - } - dart.fn(pp, dynamicToString()); - if (core.Iterable.is(object)) { - let type = core.List.is(object) ? "" : dart.notNull(src__pretty_print._typeName(object)) + ":"; - let strings = object[dartx.map](core.String)(pp)[dartx.toList](); - if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNull(maxItems)) { - strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.length], JSArrayOfString().of(['...'])); - } - let singleLine = dart.str`${type}[${strings[dartx.join](', ')}]`; - if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + dart.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dartx.contains]("\n"))) { - return singleLine; - } - return dart.str`${type}[\n` + dart.notNull(strings[dartx.map](core.String)(dart.fn(string => dart.notNull(src__pretty_print._indent(dart.notNull(indent) + 2)) + dart.notNull(string), StringToString()))[dartx.join](",\n")) + "\n" + dart.notNull(src__pretty_print._indent(indent)) + "]"; - } else if (core.Map.is(object)) { - let strings = object[dartx.keys][dartx.map](core.String)(dart.fn(key => dart.str`${pp(key)}: ${pp(object[dartx.get](key))}`, dynamicToString()))[dartx.toList](); - if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNull(maxItems)) { - strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.length], JSArrayOfString().of(['...'])); - } - let singleLine = dart.str`{${strings[dartx.join](", ")}}`; - if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + dart.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dartx.contains]("\n"))) { - return singleLine; - } - return "{\n" + dart.notNull(strings[dartx.map](core.String)(dart.fn(string => dart.notNull(src__pretty_print._indent(dart.notNull(indent) + 2)) + dart.notNull(string), StringToString()))[dartx.join](",\n")) + "\n" + dart.notNull(src__pretty_print._indent(indent)) + "}"; - } else if (typeof object == 'string') { - let lines = object[dartx.split]("\n"); - return "'" + dart.notNull(lines[dartx.map](core.String)(src__pretty_print._escapeString)[dartx.join](dart.str`\\n'\n${src__pretty_print._indent(dart.notNull(indent) + 2)}'`)) + "'"; - } else { - let value = dart.toString(object)[dartx.replaceAll]("\n", dart.notNull(src__pretty_print._indent(indent)) + "\n"); - let defaultToString = value[dartx.startsWith]("Instance of "); - if (dart.test(top)) value = dart.str`<${value}>`; - if (typeof object == 'number' || typeof object == 'boolean' || core.Function.is(object) || object == null || dart.test(defaultToString)) { - return value; - } else { - return dart.str`${src__pretty_print._typeName(object)}:${value}`; - } - } - } - dart.fn(_prettyPrint, dynamicAndintAndSet__ToString()); - return _prettyPrint(object, 0, core.Set.new(), true); - }; - dart.fn(src__pretty_print.prettyPrint, dynamic__ToString()); - src__pretty_print._indent = function(length) { - return ListOfString().filled(length, ' ')[dartx.join](''); - }; - dart.fn(src__pretty_print._indent, intToString()); - src__pretty_print._typeName = function(x) { - try { - if (x == null) return "null"; - let type = dart.toString(dart.runtimeType(x)); - return dart.test(type[dartx.startsWith]("_")) ? "?" : type; - } catch (e) { - return "?"; - } - - }; - dart.fn(src__pretty_print._typeName, dynamicToString()); - src__pretty_print._escapeString = function(source) { - return src__util.escape(source)[dartx.replaceAll]("'", "\\'"); - }; - dart.fn(src__pretty_print._escapeString, StringToString()); - const _value$1 = Symbol('_value'); - const _matchValue = Symbol('_matchValue'); - src__string_matchers._StringMatcher = class _StringMatcher extends src__interfaces.Matcher { - new() { - super.new(); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'string')) { - return mismatchDescription.addDescriptionOf(item).add(' not a string'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__string_matchers._StringMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._StringMatcher, [])}) - }); - src__string_matchers._IsEqualIgnoringCase = class _IsEqualIgnoringCase extends src__string_matchers._StringMatcher { - new(value) { - this[_value$1] = value; - this[_matchValue] = value[dartx.toLowerCase](); - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && this[_matchValue] == item[dartx.toLowerCase](); - } - describe(description) { - return description.addDescriptionOf(this[_value$1]).add(' ignoring case'); - } - }; - dart.setSignature(src__string_matchers._IsEqualIgnoringCase, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._IsEqualIgnoringCase, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__string_matchers._IsEqualIgnoringWhitespace = class _IsEqualIgnoringWhitespace extends src__string_matchers._StringMatcher { - new(value) { - this[_value$1] = value; - this[_matchValue] = src__string_matchers.collapseWhitespace(value); - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && this[_matchValue] == src__string_matchers.collapseWhitespace(item); - } - describe(description) { - return description.addDescriptionOf(this[_matchValue]).add(' ignoring whitespace'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (typeof item == 'string') { - return mismatchDescription.add('is ').addDescriptionOf(src__string_matchers.collapseWhitespace(item)).add(' with whitespace compressed'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__string_matchers._IsEqualIgnoringWhitespace, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._IsEqualIgnoringWhitespace, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _prefix = Symbol('_prefix'); - src__string_matchers._StringStartsWith = class _StringStartsWith extends src__string_matchers._StringMatcher { - new(prefix) { - this[_prefix] = prefix; - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && dart.test(item[dartx.startsWith](this[_prefix])); - } - describe(description) { - return description.add('a string starting with ').addDescriptionOf(this[_prefix]); - } - }; - dart.setSignature(src__string_matchers._StringStartsWith, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._StringStartsWith, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _suffix = Symbol('_suffix'); - src__string_matchers._StringEndsWith = class _StringEndsWith extends src__string_matchers._StringMatcher { - new(suffix) { - this[_suffix] = suffix; - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && dart.test(item[dartx.endsWith](this[_suffix])); - } - describe(description) { - return description.add('a string ending with ').addDescriptionOf(this[_suffix]); - } - }; - dart.setSignature(src__string_matchers._StringEndsWith, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._StringEndsWith, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _substrings = Symbol('_substrings'); - src__string_matchers._StringContainsInOrder = class _StringContainsInOrder extends src__string_matchers._StringMatcher { - new(substrings) { - this[_substrings] = substrings; - super.new(); - } - matches(item, matchState) { - if (!(typeof item == 'string')) { - return false; - } - let from_index = 0; - for (let s of this[_substrings]) { - from_index = core.int._check(dart.dsend(item, 'indexOf', s, from_index)); - if (dart.notNull(from_index) < 0) return false; - } - return true; - } - describe(description) { - return description.addAll('a string containing ', ', ', ' in order', this[_substrings]); - } - }; - dart.setSignature(src__string_matchers._StringContainsInOrder, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._StringContainsInOrder, [core.List$(core.String)])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - const _regexp = Symbol('_regexp'); - src__string_matchers._MatchesRegExp = class _MatchesRegExp extends src__string_matchers._StringMatcher { - new(re) { - this[_regexp] = null; - super.new(); - if (typeof re == 'string') { - this[_regexp] = core.RegExp.new(re); - } else if (core.RegExp.is(re)) { - this[_regexp] = re; - } else { - dart.throw(new core.ArgumentError('matches requires a regexp or string')); - } - } - matches(item, matchState) { - return typeof item == 'string' ? this[_regexp].hasMatch(item) : false; - } - describe(description) { - return description.add(dart.str`match '${this[_regexp].pattern}'`); - } - }; - dart.setSignature(src__string_matchers._MatchesRegExp, { - constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._MatchesRegExp, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__interfaces.Description, [src__interfaces.Description]) - }) - }); - src__string_matchers._isWhitespace = function(ch) { - return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; - }; - dart.fn(src__string_matchers._isWhitespace, StringTobool()); - src__util._Predicate = dart.typedef('_Predicate', () => dart.functionType(core.bool, [dart.dynamic])); - src__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'}, core.String, core.String)); - dart.defineLazy(src__util, { - get _escapeRegExp() { - return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__util._escapeMap[dartx.keys][dartx.map](core.String)(src__util._getHexLiteral)[dartx.join]()}]`); - } - }); - src__util._getHexLiteral = function(input) { - let rune = input[dartx.runes].single; - return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase]()[dartx.padLeft](2, '0')); - }; - dart.fn(src__util._getHexLiteral, StringToString()); - // Exports: - exports.matcher = matcher; - exports.mirror_matchers = mirror_matchers; - exports.src__core_matchers = src__core_matchers; - exports.src__description = src__description; - exports.src__error_matchers = src__error_matchers; - exports.src__interfaces = src__interfaces; - exports.src__iterable_matchers = src__iterable_matchers; - exports.src__map_matchers = src__map_matchers; - exports.src__numeric_matchers = src__numeric_matchers; - exports.src__operator_matchers = src__operator_matchers; - exports.src__pretty_print = src__pretty_print; - exports.src__string_matchers = src__string_matchers; - exports.src__util = src__util; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/path/path.js b/pkg/dev_compiler/test/codegen_expected/path/path.js deleted file mode 100644 index d7e0b8001d24..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/path/path.js +++ /dev/null @@ -1,1092 +0,0 @@ -dart_library.library('path', null, /* Imports */[ - 'dart_sdk' -], function load__path(exports, dart_sdk) { - 'use strict'; - const core = dart_sdk.core; - const _interceptors = dart_sdk._interceptors; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const path$ = Object.create(null); - const src__characters = Object.create(null); - const src__context = Object.create(null); - const src__internal_style = Object.create(null); - const src__parsed_path = Object.create(null); - const src__path_exception = Object.create(null); - const src__style__posix = Object.create(null); - const src__style__url = Object.create(null); - const src__style__windows = Object.create(null); - const src__style = Object.create(null); - const src__utils = Object.create(null); - let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))(); - let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))(); - let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))(); - let String__ToString = () => (String__ToString = dart.constFn(dart.definiteFunctionType(core.String, [core.String], [core.String, core.String, core.String, core.String, core.String, core.String])))(); - let StringToString = () => (StringToString = dart.constFn(dart.definiteFunctionType(core.String, [core.String])))(); - let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))(); - let String__ToString$ = () => (String__ToString$ = dart.constFn(dart.definiteFunctionType(core.String, [core.String], [core.String, core.String, core.String, core.String, core.String, core.String, core.String])))(); - let IterableOfStringToString = () => (IterableOfStringToString = dart.constFn(dart.definiteFunctionType(core.String, [IterableOfString()])))(); - let StringToListOfString = () => (StringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String])))(); - let String__ToString$0 = () => (String__ToString$0 = dart.constFn(dart.definiteFunctionType(core.String, [core.String], {from: core.String})))(); - let StringAndStringTobool = () => (StringAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String, core.String])))(); - let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))(); - let StringToUri = () => (StringToUri = dart.constFn(dart.definiteFunctionType(core.Uri, [core.String])))(); - let VoidToContext = () => (VoidToContext = dart.constFn(dart.definiteFunctionType(src__context.Context, [])))(); - let StringAndListOfStringTodynamic = () => (StringAndListOfStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, ListOfString()])))(); - let intToString = () => (intToString = dart.constFn(dart.definiteFunctionType(core.String, [core.int])))(); - let VoidToString = () => (VoidToString = dart.constFn(dart.definiteFunctionType(core.String, [])))(); - let intTobool = () => (intTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.int])))(); - dart.defineLazy(path$, { - get posix() { - return src__context.Context.new({style: src__style.Style.posix}); - } - }); - dart.defineLazy(path$, { - get windows() { - return src__context.Context.new({style: src__style.Style.windows}); - } - }); - dart.defineLazy(path$, { - get url() { - return src__context.Context.new({style: src__style.Style.url}); - } - }); - dart.defineLazy(path$, { - get context() { - return src__context.createInternal(); - } - }); - dart.copyProperties(path$, { - get style() { - return path$.context.style; - } - }); - dart.copyProperties(path$, { - get current() { - let uri = core.Uri.base; - if (dart.equals(uri, path$._currentUriBase)) return path$._current; - path$._currentUriBase = uri; - if (dart.equals(src__style.Style.platform, src__style.Style.url)) { - path$._current = dart.toString(uri.resolve('.')); - return path$._current; - } else { - let path = uri.toFilePath(); - let lastIndex = dart.notNull(path[dartx.length]) - 1; - dart.assert(path[dartx.get](lastIndex) == '/' || path[dartx.get](lastIndex) == '\\'); - path$._current = path[dartx.substring](0, lastIndex); - return path$._current; - } - } - }); - path$._currentUriBase = null; - path$._current = null; - dart.copyProperties(path$, { - get separator() { - return path$.context.separator; - } - }); - path$.absolute = function(part1, part2, part3, part4, part5, part6, part7) { - if (part2 === void 0) part2 = null; - if (part3 === void 0) part3 = null; - if (part4 === void 0) part4 = null; - if (part5 === void 0) part5 = null; - if (part6 === void 0) part6 = null; - if (part7 === void 0) part7 = null; - return path$.context.absolute(part1, part2, part3, part4, part5, part6, part7); - }; - dart.fn(path$.absolute, String__ToString()); - path$.basename = function(path) { - return path$.context.basename(path); - }; - dart.fn(path$.basename, StringToString()); - path$.basenameWithoutExtension = function(path) { - return path$.context.basenameWithoutExtension(path); - }; - dart.fn(path$.basenameWithoutExtension, StringToString()); - path$.dirname = function(path) { - return path$.context.dirname(path); - }; - dart.fn(path$.dirname, StringToString()); - path$.extension = function(path) { - return path$.context.extension(path); - }; - dart.fn(path$.extension, StringToString()); - path$.rootPrefix = function(path) { - return path$.context.rootPrefix(path); - }; - dart.fn(path$.rootPrefix, StringToString()); - path$.isAbsolute = function(path) { - return path$.context.isAbsolute(path); - }; - dart.fn(path$.isAbsolute, StringTobool()); - path$.isRelative = function(path) { - return path$.context.isRelative(path); - }; - dart.fn(path$.isRelative, StringTobool()); - path$.isRootRelative = function(path) { - return path$.context.isRootRelative(path); - }; - dart.fn(path$.isRootRelative, StringTobool()); - path$.join = function(part1, part2, part3, part4, part5, part6, part7, part8) { - if (part2 === void 0) part2 = null; - if (part3 === void 0) part3 = null; - if (part4 === void 0) part4 = null; - if (part5 === void 0) part5 = null; - if (part6 === void 0) part6 = null; - if (part7 === void 0) part7 = null; - if (part8 === void 0) part8 = null; - return path$.context.join(part1, part2, part3, part4, part5, part6, part7, part8); - }; - dart.fn(path$.join, String__ToString$()); - path$.joinAll = function(parts) { - return path$.context.joinAll(parts); - }; - dart.fn(path$.joinAll, IterableOfStringToString()); - path$.split = function(path) { - return path$.context.split(path); - }; - dart.fn(path$.split, StringToListOfString()); - path$.normalize = function(path) { - return path$.context.normalize(path); - }; - dart.fn(path$.normalize, StringToString()); - path$.relative = function(path, opts) { - let from = opts && 'from' in opts ? opts.from : null; - return path$.context.relative(path, {from: from}); - }; - dart.fn(path$.relative, String__ToString$0()); - path$.isWithin = function(parent, child) { - return path$.context.isWithin(parent, child); - }; - dart.fn(path$.isWithin, StringAndStringTobool()); - path$.withoutExtension = function(path) { - return path$.context.withoutExtension(path); - }; - dart.fn(path$.withoutExtension, StringToString()); - path$.fromUri = function(uri) { - return path$.context.fromUri(uri); - }; - dart.fn(path$.fromUri, dynamicToString()); - path$.toUri = function(path) { - return path$.context.toUri(path); - }; - dart.fn(path$.toUri, StringToUri()); - path$.prettyUri = function(uri) { - return path$.context.prettyUri(uri); - }; - dart.fn(path$.prettyUri, dynamicToString()); - const _current = Symbol('_current'); - const _parse = Symbol('_parse'); - const _needsNormalization = Symbol('_needsNormalization'); - const _isWithinFast = Symbol('_isWithinFast'); - const _pathDirection = Symbol('_pathDirection'); - src__context.Context = class Context extends core.Object { - static new(opts) { - let style = opts && 'style' in opts ? opts.style : null; - let current = opts && 'current' in opts ? opts.current : null; - if (current == null) { - if (style == null) { - current = path$.current; - } else { - current = "."; - } - } - if (style == null) { - style = src__style.Style.platform; - } else if (!src__internal_style.InternalStyle.is(style)) { - dart.throw(new core.ArgumentError("Only styles defined by the path package are " + "allowed.")); - } - return new src__context.Context._(src__internal_style.InternalStyle.as(style), current); - } - _internal() { - this.style = src__internal_style.InternalStyle.as(src__style.Style.platform); - this[_current] = null; - } - _(style, current) { - this.style = style; - this[_current] = current; - } - get current() { - return this[_current] != null ? this[_current] : path$.current; - } - get separator() { - return this.style.separator; - } - absolute(part1, part2, part3, part4, part5, part6, part7) { - if (part2 === void 0) part2 = null; - if (part3 === void 0) part3 = null; - if (part4 === void 0) part4 = null; - if (part5 === void 0) part5 = null; - if (part6 === void 0) part6 = null; - if (part7 === void 0) part7 = null; - src__context._validateArgList("absolute", JSArrayOfString().of([part1, part2, part3, part4, part5, part6, part7])); - if (part2 == null && dart.test(this.isAbsolute(part1)) && !dart.test(this.isRootRelative(part1))) { - return part1; - } - return this.join(this.current, part1, part2, part3, part4, part5, part6, part7); - } - basename(path) { - return this[_parse](path).basename; - } - basenameWithoutExtension(path) { - return this[_parse](path).basenameWithoutExtension; - } - dirname(path) { - let parsed = this[_parse](path); - parsed.removeTrailingSeparators(); - if (dart.test(parsed.parts[dartx.isEmpty])) return parsed.root == null ? '.' : parsed.root; - if (parsed.parts[dartx.length] == 1) { - return parsed.root == null ? '.' : parsed.root; - } - parsed.parts[dartx.removeLast](); - parsed.separators[dartx.removeLast](); - parsed.removeTrailingSeparators(); - return dart.toString(parsed); - } - extension(path) { - return this[_parse](path).extension; - } - rootPrefix(path) { - return path[dartx.substring](0, this.style.rootLength(path)); - } - isAbsolute(path) { - return dart.notNull(this.style.rootLength(path)) > 0; - } - isRelative(path) { - return !dart.test(this.isAbsolute(path)); - } - isRootRelative(path) { - return this.style.isRootRelative(path); - } - join(part1, part2, part3, part4, part5, part6, part7, part8) { - if (part2 === void 0) part2 = null; - if (part3 === void 0) part3 = null; - if (part4 === void 0) part4 = null; - if (part5 === void 0) part5 = null; - if (part6 === void 0) part6 = null; - if (part7 === void 0) part7 = null; - if (part8 === void 0) part8 = null; - let parts = JSArrayOfString().of([part1, part2, part3, part4, part5, part6, part7, part8]); - src__context._validateArgList("join", parts); - return this.joinAll(parts[dartx.where](dart.fn(part => part != null, StringTobool()))); - } - joinAll(parts) { - let buffer = new core.StringBuffer(); - let needsSeparator = false; - let isAbsoluteAndNotRootRelative = false; - for (let part of parts[dartx.where](dart.fn(part => part != '', StringTobool()))) { - if (dart.test(this.isRootRelative(part)) && isAbsoluteAndNotRootRelative) { - let parsed = this[_parse](part); - parsed.root = this.rootPrefix(buffer.toString()); - if (dart.test(this.style.needsSeparator(parsed.root))) { - parsed.separators[dartx.set](0, this.style.separator); - } - buffer.clear(); - buffer.write(dart.toString(parsed)); - } else if (dart.test(this.isAbsolute(part))) { - isAbsoluteAndNotRootRelative = !dart.test(this.isRootRelative(part)); - buffer.clear(); - buffer.write(part); - } else { - if (dart.notNull(part[dartx.length]) > 0 && dart.test(this.style.containsSeparator(part[dartx.get](0)))) { - } else if (dart.test(needsSeparator)) { - buffer.write(this.separator); - } - buffer.write(part); - } - needsSeparator = this.style.needsSeparator(part); - } - return buffer.toString(); - } - split(path) { - let parsed = this[_parse](path); - parsed.parts = parsed.parts[dartx.where](dart.fn(part => !dart.test(part[dartx.isEmpty]), StringTobool()))[dartx.toList](); - if (parsed.root != null) parsed.parts[dartx.insert](0, parsed.root); - return parsed.parts; - } - normalize(path) { - if (!dart.test(this[_needsNormalization](path))) return path; - let parsed = this[_parse](path); - parsed.normalize(); - return dart.toString(parsed); - } - [_needsNormalization](path) { - let start = 0; - let codeUnits = path[dartx.codeUnits]; - let previousPrevious = null; - let previous = null; - let root = this.style.rootLength(path); - if (root != 0) { - start = root; - previous = src__characters.SLASH; - if (dart.equals(this.style, src__style.Style.windows)) { - for (let i = 0; i < dart.notNull(root); i++) { - if (codeUnits[dartx.get](i) == src__characters.SLASH) return true; - } - } - } - for (let i = start; dart.notNull(i) < dart.notNull(codeUnits[dartx.length]); i = dart.notNull(i) + 1) { - let codeUnit = codeUnits[dartx.get](i); - if (dart.test(this.style.isSeparator(codeUnit))) { - if (dart.equals(this.style, src__style.Style.windows) && codeUnit == src__characters.SLASH) return true; - if (previous != null && dart.test(this.style.isSeparator(core.int._check(previous)))) return true; - if (dart.equals(previous, src__characters.PERIOD) && (previousPrevious == null || dart.equals(previousPrevious, src__characters.PERIOD) || dart.test(this.style.isSeparator(core.int._check(previousPrevious))))) { - return true; - } - } - previousPrevious = previous; - previous = codeUnit; - } - if (previous == null) return true; - if (dart.test(this.style.isSeparator(core.int._check(previous)))) return true; - if (dart.equals(previous, src__characters.PERIOD) && (previousPrevious == null || dart.equals(previousPrevious, src__characters.SLASH) || dart.equals(previousPrevious, src__characters.PERIOD))) { - return true; - } - return false; - } - relative(path, opts) { - let from = opts && 'from' in opts ? opts.from : null; - if (from == null && dart.test(this.isRelative(path))) return this.normalize(path); - from = from == null ? this.current : this.absolute(from); - if (dart.test(this.isRelative(from)) && dart.test(this.isAbsolute(path))) { - return this.normalize(path); - } - if (dart.test(this.isRelative(path)) || dart.test(this.isRootRelative(path))) { - path = this.absolute(path); - } - if (dart.test(this.isRelative(path)) && dart.test(this.isAbsolute(from))) { - dart.throw(new src__path_exception.PathException(dart.str`Unable to find a path to "${path}" from "${from}".`)); - } - let fromParsed = this[_parse](from); - fromParsed.normalize(); - let pathParsed = this[_parse](path); - pathParsed.normalize(); - if (dart.notNull(fromParsed.parts[dartx.length]) > 0 && fromParsed.parts[dartx.get](0) == '.') { - return pathParsed.toString(); - } - if (fromParsed.root != pathParsed.root && (fromParsed.root == null || pathParsed.root == null || fromParsed.root[dartx.toLowerCase]()[dartx.replaceAll]('/', '\\') != pathParsed.root[dartx.toLowerCase]()[dartx.replaceAll]('/', '\\'))) { - return pathParsed.toString(); - } - while (dart.notNull(fromParsed.parts[dartx.length]) > 0 && dart.notNull(pathParsed.parts[dartx.length]) > 0 && fromParsed.parts[dartx.get](0) == pathParsed.parts[dartx.get](0)) { - fromParsed.parts[dartx.removeAt](0); - fromParsed.separators[dartx.removeAt](1); - pathParsed.parts[dartx.removeAt](0); - pathParsed.separators[dartx.removeAt](1); - } - if (dart.notNull(fromParsed.parts[dartx.length]) > 0 && fromParsed.parts[dartx.get](0) == '..') { - dart.throw(new src__path_exception.PathException(dart.str`Unable to find a path to "${path}" from "${from}".`)); - } - pathParsed.parts[dartx.insertAll](0, ListOfString().filled(fromParsed.parts[dartx.length], '..')); - pathParsed.separators[dartx.set](0, ''); - pathParsed.separators[dartx.insertAll](1, ListOfString().filled(fromParsed.parts[dartx.length], this.style.separator)); - if (pathParsed.parts[dartx.length] == 0) return '.'; - if (dart.notNull(pathParsed.parts[dartx.length]) > 1 && pathParsed.parts[dartx.last] == '.') { - pathParsed.parts[dartx.removeLast](); - let _ = pathParsed.separators; - _[dartx.removeLast](); - _[dartx.removeLast](); - _[dartx.add](''); - } - pathParsed.root = ''; - pathParsed.removeTrailingSeparators(); - return pathParsed.toString(); - } - isWithin(parent, child) { - let parentIsAbsolute = this.isAbsolute(parent); - let childIsAbsolute = this.isAbsolute(child); - if (dart.test(parentIsAbsolute) && !dart.test(childIsAbsolute)) { - child = this.absolute(child); - if (dart.test(this.style.isRootRelative(parent))) parent = this.absolute(parent); - } else if (dart.test(childIsAbsolute) && !dart.test(parentIsAbsolute)) { - parent = this.absolute(parent); - if (dart.test(this.style.isRootRelative(child))) child = this.absolute(child); - } else if (dart.test(childIsAbsolute) && dart.test(parentIsAbsolute)) { - let childIsRootRelative = this.style.isRootRelative(child); - let parentIsRootRelative = this.style.isRootRelative(parent); - if (dart.test(childIsRootRelative) && !dart.test(parentIsRootRelative)) { - child = this.absolute(child); - } else if (dart.test(parentIsRootRelative) && !dart.test(childIsRootRelative)) { - parent = this.absolute(parent); - } - } - let fastResult = this[_isWithinFast](parent, child); - if (fastResult != null) return fastResult; - let relative = null; - try { - relative = this.relative(child, {from: parent}); - } catch (_) { - if (src__path_exception.PathException.is(_)) { - return false; - } else - throw _; - } - - let parts = this.split(core.String._check(relative)); - return dart.test(this.isRelative(core.String._check(relative))) && parts[dartx.first] != '..' && parts[dartx.first] != '.'; - } - [_isWithinFast](parent, child) { - if (parent == '.') parent = ''; - let parentRootLength = this.style.rootLength(parent); - let childRootLength = this.style.rootLength(child); - if (parentRootLength != childRootLength) return false; - let parentCodeUnits = parent[dartx.codeUnits]; - let childCodeUnits = child[dartx.codeUnits]; - for (let i = 0; i < dart.notNull(parentRootLength); i++) { - let parentCodeUnit = parentCodeUnits[dartx.get](i); - let childCodeUnit = childCodeUnits[dartx.get](i); - if (parentCodeUnit == childCodeUnit) continue; - if (!dart.test(this.style.isSeparator(parentCodeUnit)) || !dart.test(this.style.isSeparator(childCodeUnit))) { - return false; - } - } - let lastCodeUnit = src__characters.SLASH; - let parentIndex = parentRootLength; - let childIndex = childRootLength; - while (dart.notNull(parentIndex) < dart.notNull(parent[dartx.length]) && dart.notNull(childIndex) < dart.notNull(child[dartx.length])) { - let parentCodeUnit = parentCodeUnits[dartx.get](parentIndex); - let childCodeUnit = childCodeUnits[dartx.get](childIndex); - if (parentCodeUnit == childCodeUnit) { - lastCodeUnit = parentCodeUnit; - parentIndex = dart.notNull(parentIndex) + 1; - childIndex = dart.notNull(childIndex) + 1; - continue; - } - let parentIsSeparator = this.style.isSeparator(parentCodeUnit); - let childIsSeparator = this.style.isSeparator(childCodeUnit); - if (dart.test(parentIsSeparator) && dart.test(childIsSeparator)) { - lastCodeUnit = parentCodeUnit; - parentIndex = dart.notNull(parentIndex) + 1; - childIndex = dart.notNull(childIndex) + 1; - continue; - } - if (dart.test(parentIsSeparator) && dart.test(this.style.isSeparator(lastCodeUnit))) { - parentIndex = dart.notNull(parentIndex) + 1; - continue; - } else if (dart.test(childIsSeparator) && dart.test(this.style.isSeparator(lastCodeUnit))) { - childIndex = dart.notNull(childIndex) + 1; - continue; - } - if (parentCodeUnit == src__characters.PERIOD) { - if (dart.test(this.style.isSeparator(lastCodeUnit))) { - parentIndex = dart.notNull(parentIndex) + 1; - if (parentIndex == parent[dartx.length]) break; - parentCodeUnit = parentCodeUnits[dartx.get](parentIndex); - if (dart.test(this.style.isSeparator(parentCodeUnit))) { - parentIndex = dart.notNull(parentIndex) + 1; - continue; - } - if (parentCodeUnit == src__characters.PERIOD) { - parentIndex = dart.notNull(parentIndex) + 1; - if (parentIndex == parent[dartx.length] || dart.test(this.style.isSeparator(parentCodeUnits[dartx.get](parentIndex)))) { - return null; - } - } - } - } - if (childCodeUnit == src__characters.PERIOD) { - if (dart.test(this.style.isSeparator(lastCodeUnit))) { - childIndex = dart.notNull(childIndex) + 1; - if (childIndex == child[dartx.length]) break; - childCodeUnit = childCodeUnits[dartx.get](childIndex); - if (dart.test(this.style.isSeparator(childCodeUnit))) { - childIndex = dart.notNull(childIndex) + 1; - continue; - } - if (childCodeUnit == src__characters.PERIOD) { - childIndex = dart.notNull(childIndex) + 1; - if (childIndex == child[dartx.length] || dart.test(this.style.isSeparator(childCodeUnits[dartx.get](childIndex)))) { - return null; - } - } - } - } - let childDirection = this[_pathDirection](childCodeUnits, childIndex); - if (!dart.equals(childDirection, src__context._PathDirection.belowRoot)) return null; - let parentDirection = this[_pathDirection](parentCodeUnits, parentIndex); - if (!dart.equals(parentDirection, src__context._PathDirection.belowRoot)) return null; - return false; - } - if (childIndex == child[dartx.length]) { - let direction = this[_pathDirection](parentCodeUnits, parentIndex); - return dart.equals(direction, src__context._PathDirection.aboveRoot) ? null : false; - } - let direction = this[_pathDirection](childCodeUnits, childIndex); - if (dart.equals(direction, src__context._PathDirection.atRoot)) return false; - if (dart.equals(direction, src__context._PathDirection.aboveRoot)) return null; - return dart.test(this.style.isSeparator(childCodeUnits[dartx.get](childIndex))) || dart.test(this.style.isSeparator(lastCodeUnit)); - } - [_pathDirection](codeUnits, index) { - let depth = 0; - let reachedRoot = false; - let i = index; - while (dart.notNull(i) < dart.notNull(codeUnits[dartx.length])) { - while (dart.notNull(i) < dart.notNull(codeUnits[dartx.length]) && dart.test(this.style.isSeparator(codeUnits[dartx.get](i)))) { - i = dart.notNull(i) + 1; - } - if (i == codeUnits[dartx.length]) break; - let start = i; - while (dart.notNull(i) < dart.notNull(codeUnits[dartx.length]) && !dart.test(this.style.isSeparator(codeUnits[dartx.get](i)))) { - i = dart.notNull(i) + 1; - } - if (dart.notNull(i) - dart.notNull(start) == 1 && codeUnits[dartx.get](start) == src__characters.PERIOD) { - } else if (dart.notNull(i) - dart.notNull(start) == 2 && codeUnits[dartx.get](start) == src__characters.PERIOD && codeUnits[dartx.get](dart.notNull(start) + 1) == src__characters.PERIOD) { - depth--; - if (depth < 0) break; - if (depth == 0) reachedRoot = true; - } else { - depth++; - } - if (i == codeUnits[dartx.length]) break; - i = dart.notNull(i) + 1; - } - if (depth < 0) return src__context._PathDirection.aboveRoot; - if (depth == 0) return src__context._PathDirection.atRoot; - if (reachedRoot) return src__context._PathDirection.reachesRoot; - return src__context._PathDirection.belowRoot; - } - withoutExtension(path) { - let parsed = this[_parse](path); - for (let i = dart.notNull(parsed.parts[dartx.length]) - 1; i >= 0; i--) { - if (!dart.test(parsed.parts[dartx.get](i)[dartx.isEmpty])) { - parsed.parts[dartx.set](i, parsed.basenameWithoutExtension); - break; - } - } - return dart.toString(parsed); - } - fromUri(uri) { - if (typeof uri == 'string') uri = core.Uri.parse(core.String._check(uri)); - return this.style.pathFromUri(core.Uri._check(uri)); - } - toUri(path) { - if (dart.test(this.isRelative(path))) { - return this.style.relativePathToUri(path); - } else { - return this.style.absolutePathToUri(this.join(this.current, path)); - } - } - prettyUri(uri) { - if (typeof uri == 'string') uri = core.Uri.parse(core.String._check(uri)); - if (dart.equals(dart.dload(uri, 'scheme'), 'file') && dart.equals(this.style, src__style.Style.url)) return dart.toString(uri); - if (!dart.equals(dart.dload(uri, 'scheme'), 'file') && !dart.equals(dart.dload(uri, 'scheme'), '') && !dart.equals(this.style, src__style.Style.url)) { - return dart.toString(uri); - } - let path = this.normalize(this.fromUri(uri)); - let rel = this.relative(path); - return dart.notNull(this.split(rel)[dartx.length]) > dart.notNull(this.split(path)[dartx.length]) ? path : rel; - } - [_parse](path) { - return src__parsed_path.ParsedPath.parse(path, this.style); - } - }; - dart.defineNamedConstructor(src__context.Context, '_internal'); - dart.defineNamedConstructor(src__context.Context, '_'); - dart.setSignature(src__context.Context, { - constructors: () => ({ - new: dart.definiteFunctionType(src__context.Context, [], {style: src__style.Style, current: core.String}), - _internal: dart.definiteFunctionType(src__context.Context, []), - _: dart.definiteFunctionType(src__context.Context, [src__internal_style.InternalStyle, core.String]) - }), - methods: () => ({ - absolute: dart.definiteFunctionType(core.String, [core.String], [core.String, core.String, core.String, core.String, core.String, core.String]), - basename: dart.definiteFunctionType(core.String, [core.String]), - basenameWithoutExtension: dart.definiteFunctionType(core.String, [core.String]), - dirname: dart.definiteFunctionType(core.String, [core.String]), - extension: dart.definiteFunctionType(core.String, [core.String]), - rootPrefix: dart.definiteFunctionType(core.String, [core.String]), - isAbsolute: dart.definiteFunctionType(core.bool, [core.String]), - isRelative: dart.definiteFunctionType(core.bool, [core.String]), - isRootRelative: dart.definiteFunctionType(core.bool, [core.String]), - join: dart.definiteFunctionType(core.String, [core.String], [core.String, core.String, core.String, core.String, core.String, core.String, core.String]), - joinAll: dart.definiteFunctionType(core.String, [core.Iterable$(core.String)]), - split: dart.definiteFunctionType(core.List$(core.String), [core.String]), - normalize: dart.definiteFunctionType(core.String, [core.String]), - [_needsNormalization]: dart.definiteFunctionType(core.bool, [core.String]), - relative: dart.definiteFunctionType(core.String, [core.String], {from: core.String}), - isWithin: dart.definiteFunctionType(core.bool, [core.String, core.String]), - [_isWithinFast]: dart.definiteFunctionType(core.bool, [core.String, core.String]), - [_pathDirection]: dart.definiteFunctionType(src__context._PathDirection, [core.List$(core.int), core.int]), - withoutExtension: dart.definiteFunctionType(core.String, [core.String]), - fromUri: dart.definiteFunctionType(core.String, [dart.dynamic]), - toUri: dart.definiteFunctionType(core.Uri, [core.String]), - prettyUri: dart.definiteFunctionType(core.String, [dart.dynamic]), - [_parse]: dart.definiteFunctionType(src__parsed_path.ParsedPath, [core.String]) - }) - }); - path$.Context = src__context.Context; - src__path_exception.PathException = class PathException extends core.Object { - new(message) { - this.message = message; - } - toString() { - return dart.str`PathException: ${this.message}`; - } - }; - src__path_exception.PathException[dart.implements] = () => [core.Exception]; - dart.setSignature(src__path_exception.PathException, { - constructors: () => ({new: dart.definiteFunctionType(src__path_exception.PathException, [core.String])}) - }); - path$.PathException = src__path_exception.PathException; - src__style.Style = class Style extends core.Object { - static _getPlatformStyle() { - if (core.Uri.base.scheme != 'file') return src__style.Style.url; - if (!dart.test(core.Uri.base.path[dartx.endsWith]('/'))) return src__style.Style.url; - if (core.Uri.new({path: 'a/b'}).toFilePath() == 'a\\b') return src__style.Style.windows; - return src__style.Style.posix; - } - get context() { - return src__context.Context.new({style: this}); - } - toString() { - return this.name; - } - }; - dart.setSignature(src__style.Style, { - statics: () => ({_getPlatformStyle: dart.definiteFunctionType(src__style.Style, [])}), - names: ['_getPlatformStyle'] - }); - dart.defineLazy(src__style.Style, { - get posix() { - return new src__style__posix.PosixStyle(); - }, - get windows() { - return new src__style__windows.WindowsStyle(); - }, - get url() { - return new src__style__url.UrlStyle(); - }, - get platform() { - return src__style.Style._getPlatformStyle(); - } - }); - path$.Style = src__style.Style; - src__characters.PLUS = 43; - src__characters.MINUS = 45; - src__characters.PERIOD = 46; - src__characters.SLASH = 47; - src__characters.ZERO = 48; - src__characters.NINE = 57; - src__characters.COLON = 58; - src__characters.UPPER_A = 65; - src__characters.UPPER_Z = 90; - src__characters.LOWER_A = 97; - src__characters.LOWER_Z = 122; - src__characters.BACKSLASH = 92; - src__context.createInternal = function() { - return new src__context.Context._internal(); - }; - dart.fn(src__context.createInternal, VoidToContext()); - src__context._validateArgList = function(method, args) { - for (let i = 1; i < dart.notNull(args[dartx.length]); i++) { - if (args[dartx.get](i) == null || args[dartx.get](i - 1) != null) continue; - let numArgs = null; - for (numArgs = args[dartx.length]; dart.test(dart.dsend(numArgs, '>=', 1)); numArgs = dart.dsend(numArgs, '-', 1)) { - if (args[dartx.get](core.int._check(dart.dsend(numArgs, '-', 1))) != null) break; - } - let message = new core.StringBuffer(); - message.write(dart.str`${method}(`); - message.write(args[dartx.take](core.int._check(numArgs))[dartx.map](core.String)(dart.fn(arg => arg == null ? "null" : dart.str`"${arg}"`, StringToString()))[dartx.join](", ")); - message.write(dart.str`): part ${i - 1} was null, but part ${i} was not.`); - dart.throw(new core.ArgumentError(message.toString())); - } - }; - dart.fn(src__context._validateArgList, StringAndListOfStringTodynamic()); - src__context._PathDirection = class _PathDirection extends core.Object { - new(name) { - this.name = name; - } - toString() { - return this.name; - } - }; - dart.setSignature(src__context._PathDirection, { - constructors: () => ({new: dart.definiteFunctionType(src__context._PathDirection, [core.String])}) - }); - dart.defineLazy(src__context._PathDirection, { - get aboveRoot() { - return dart.const(new src__context._PathDirection("above root")); - }, - get atRoot() { - return dart.const(new src__context._PathDirection("at root")); - }, - get reachesRoot() { - return dart.const(new src__context._PathDirection("reaches root")); - }, - get belowRoot() { - return dart.const(new src__context._PathDirection("below root")); - } - }); - src__internal_style.InternalStyle = class InternalStyle extends src__style.Style { - getRoot(path) { - let length = this.rootLength(path); - if (dart.notNull(length) > 0) return path[dartx.substring](0, length); - return dart.test(this.isRootRelative(path)) ? path[dartx.get](0) : null; - } - relativePathToUri(path) { - let segments = this.context.split(path); - if (dart.test(this.isSeparator(path[dartx.codeUnitAt](dart.notNull(path[dartx.length]) - 1)))) segments[dartx.add](''); - return core.Uri.new({pathSegments: segments}); - } - }; - dart.setSignature(src__internal_style.InternalStyle, { - methods: () => ({ - getRoot: dart.definiteFunctionType(core.String, [core.String]), - relativePathToUri: dart.definiteFunctionType(core.Uri, [core.String]) - }) - }); - const _splitExtension = Symbol('_splitExtension'); - src__parsed_path.ParsedPath = class ParsedPath extends core.Object { - get extension() { - return this[_splitExtension]()[dartx.get](1); - } - get isAbsolute() { - return this.root != null; - } - static parse(path, style) { - let root = style.getRoot(path); - let isRootRelative = style.isRootRelative(path); - if (root != null) path = path[dartx.substring](root[dartx.length]); - let parts = JSArrayOfString().of([]); - let separators = JSArrayOfString().of([]); - let start = 0; - if (dart.test(path[dartx.isNotEmpty]) && dart.test(style.isSeparator(path[dartx.codeUnitAt](0)))) { - separators[dartx.add](path[dartx.get](0)); - start = 1; - } else { - separators[dartx.add](''); - } - for (let i = start; i < dart.notNull(path[dartx.length]); i++) { - if (dart.test(style.isSeparator(path[dartx.codeUnitAt](i)))) { - parts[dartx.add](path[dartx.substring](start, i)); - separators[dartx.add](path[dartx.get](i)); - start = i + 1; - } - } - if (start < dart.notNull(path[dartx.length])) { - parts[dartx.add](path[dartx.substring](start)); - separators[dartx.add](''); - } - return new src__parsed_path.ParsedPath._(style, root, isRootRelative, parts, separators); - } - _(style, root, isRootRelative, parts, separators) { - this.style = style; - this.root = root; - this.isRootRelative = isRootRelative; - this.parts = parts; - this.separators = separators; - } - get basename() { - let copy = this.clone(); - copy.removeTrailingSeparators(); - if (dart.test(copy.parts[dartx.isEmpty])) return this.root == null ? '' : this.root; - return copy.parts[dartx.last]; - } - get basenameWithoutExtension() { - return this[_splitExtension]()[dartx.get](0); - } - get hasTrailingSeparator() { - return !dart.test(this.parts[dartx.isEmpty]) && (this.parts[dartx.last] == '' || this.separators[dartx.last] != ''); - } - removeTrailingSeparators() { - while (!dart.test(this.parts[dartx.isEmpty]) && this.parts[dartx.last] == '') { - this.parts[dartx.removeLast](); - this.separators[dartx.removeLast](); - } - if (dart.notNull(this.separators[dartx.length]) > 0) this.separators[dartx.set](dart.notNull(this.separators[dartx.length]) - 1, ''); - } - normalize() { - let leadingDoubles = 0; - let newParts = JSArrayOfString().of([]); - for (let part of this.parts) { - if (part == '.' || part == '') { - } else if (part == '..') { - if (dart.notNull(newParts[dartx.length]) > 0) { - newParts[dartx.removeLast](); - } else { - leadingDoubles++; - } - } else { - newParts[dartx.add](part); - } - } - if (!dart.test(this.isAbsolute)) { - newParts[dartx.insertAll](0, ListOfString().filled(leadingDoubles, '..')); - } - if (newParts[dartx.length] == 0 && !dart.test(this.isAbsolute)) { - newParts[dartx.add]('.'); - } - let newSeparators = ListOfString().generate(newParts[dartx.length], dart.fn(_ => this.style.separator, intToString()), {growable: true}); - newSeparators[dartx.insert](0, dart.test(this.isAbsolute) && dart.notNull(newParts[dartx.length]) > 0 && dart.test(this.style.needsSeparator(this.root)) ? this.style.separator : ''); - this.parts = newParts; - this.separators = newSeparators; - if (this.root != null && dart.equals(this.style, src__style.Style.windows)) { - this.root = this.root[dartx.replaceAll]('/', '\\'); - } - this.removeTrailingSeparators(); - } - toString() { - let builder = new core.StringBuffer(); - if (this.root != null) builder.write(this.root); - for (let i = 0; i < dart.notNull(this.parts[dartx.length]); i++) { - builder.write(this.separators[dartx.get](i)); - builder.write(this.parts[dartx.get](i)); - } - builder.write(this.separators[dartx.last]); - return builder.toString(); - } - [_splitExtension]() { - let file = this.parts[dartx.lastWhere](dart.fn(p => p != '', StringTobool()), {orElse: dart.fn(() => null, VoidToString())}); - if (file == null) return JSArrayOfString().of(['', '']); - if (file == '..') return JSArrayOfString().of(['..', '']); - let lastDot = file[dartx.lastIndexOf]('.'); - if (dart.notNull(lastDot) <= 0) return JSArrayOfString().of([file, '']); - return JSArrayOfString().of([file[dartx.substring](0, lastDot), file[dartx.substring](lastDot)]); - } - clone() { - return new src__parsed_path.ParsedPath._(this.style, this.root, this.isRootRelative, ListOfString().from(this.parts), ListOfString().from(this.separators)); - } - }; - dart.defineNamedConstructor(src__parsed_path.ParsedPath, '_'); - dart.setSignature(src__parsed_path.ParsedPath, { - constructors: () => ({ - parse: dart.definiteFunctionType(src__parsed_path.ParsedPath, [core.String, src__internal_style.InternalStyle]), - _: dart.definiteFunctionType(src__parsed_path.ParsedPath, [src__internal_style.InternalStyle, core.String, core.bool, core.List$(core.String), core.List$(core.String)]) - }), - methods: () => ({ - removeTrailingSeparators: dart.definiteFunctionType(dart.void, []), - normalize: dart.definiteFunctionType(dart.void, []), - [_splitExtension]: dart.definiteFunctionType(core.List$(core.String), []), - clone: dart.definiteFunctionType(src__parsed_path.ParsedPath, []) - }) - }); - let const$; - src__style__posix.PosixStyle = class PosixStyle extends src__internal_style.InternalStyle { - new() { - this.separatorPattern = core.RegExp.new('/'); - this.needsSeparatorPattern = core.RegExp.new('[^/]$'); - this.rootPattern = core.RegExp.new('^/'); - this.name = 'posix'; - this.separator = '/'; - this.separators = const$ || (const$ = dart.constList(['/'], core.String)); - this.relativeRootPattern = null; - } - containsSeparator(path) { - return path[dartx.contains]('/'); - } - isSeparator(codeUnit) { - return codeUnit == src__characters.SLASH; - } - needsSeparator(path) { - return dart.test(path[dartx.isNotEmpty]) && !dart.test(this.isSeparator(path[dartx.codeUnitAt](dart.notNull(path[dartx.length]) - 1))); - } - rootLength(path) { - if (dart.test(path[dartx.isNotEmpty]) && dart.test(this.isSeparator(path[dartx.codeUnitAt](0)))) return 1; - return 0; - } - isRootRelative(path) { - return false; - } - getRelativeRoot(path) { - return null; - } - pathFromUri(uri) { - if (uri.scheme == '' || uri.scheme == 'file') { - return core.Uri.decodeComponent(uri.path); - } - dart.throw(new core.ArgumentError(dart.str`Uri ${uri} must have scheme 'file:'.`)); - } - absolutePathToUri(path) { - let parsed = src__parsed_path.ParsedPath.parse(path, this); - if (dart.test(parsed.parts[dartx.isEmpty])) { - parsed.parts[dartx.addAll](JSArrayOfString().of(["", ""])); - } else if (dart.test(parsed.hasTrailingSeparator)) { - parsed.parts[dartx.add](""); - } - return core.Uri.new({scheme: 'file', pathSegments: parsed.parts}); - } - }; - dart.setSignature(src__style__posix.PosixStyle, { - constructors: () => ({new: dart.definiteFunctionType(src__style__posix.PosixStyle, [])}), - methods: () => ({ - containsSeparator: dart.definiteFunctionType(core.bool, [core.String]), - isSeparator: dart.definiteFunctionType(core.bool, [core.int]), - needsSeparator: dart.definiteFunctionType(core.bool, [core.String]), - rootLength: dart.definiteFunctionType(core.int, [core.String]), - isRootRelative: dart.definiteFunctionType(core.bool, [core.String]), - getRelativeRoot: dart.definiteFunctionType(core.String, [core.String]), - pathFromUri: dart.definiteFunctionType(core.String, [core.Uri]), - absolutePathToUri: dart.definiteFunctionType(core.Uri, [core.String]) - }) - }); - let const$0; - src__style__url.UrlStyle = class UrlStyle extends src__internal_style.InternalStyle { - new() { - this.separatorPattern = core.RegExp.new('/'); - this.needsSeparatorPattern = core.RegExp.new("(^[a-zA-Z][-+.a-zA-Z\\d]*://|[^/])$"); - this.rootPattern = core.RegExp.new("[a-zA-Z][-+.a-zA-Z\\d]*://[^/]*"); - this.relativeRootPattern = core.RegExp.new("^/"); - this.name = 'url'; - this.separator = '/'; - this.separators = const$0 || (const$0 = dart.constList(['/'], core.String)); - } - containsSeparator(path) { - return path[dartx.contains]('/'); - } - isSeparator(codeUnit) { - return codeUnit == src__characters.SLASH; - } - needsSeparator(path) { - if (dart.test(path[dartx.isEmpty])) return false; - if (!dart.test(this.isSeparator(path[dartx.codeUnitAt](dart.notNull(path[dartx.length]) - 1)))) return true; - return dart.test(path[dartx.endsWith]("://")) && this.rootLength(path) == path[dartx.length]; - } - rootLength(path) { - if (dart.test(path[dartx.isEmpty])) return 0; - if (dart.test(this.isSeparator(path[dartx.codeUnitAt](0)))) return 1; - let index = path[dartx.indexOf]("/"); - if (dart.notNull(index) > 0 && dart.test(path[dartx.startsWith]('://', dart.notNull(index) - 1))) { - index = path[dartx.indexOf]('/', dart.notNull(index) + 2); - if (dart.notNull(index) > 0) return index; - return path[dartx.length]; - } - return 0; - } - isRootRelative(path) { - return dart.test(path[dartx.isNotEmpty]) && dart.test(this.isSeparator(path[dartx.codeUnitAt](0))); - } - getRelativeRoot(path) { - return dart.test(this.isRootRelative(path)) ? '/' : null; - } - pathFromUri(uri) { - return dart.toString(uri); - } - relativePathToUri(path) { - return core.Uri.parse(path); - } - absolutePathToUri(path) { - return core.Uri.parse(path); - } - }; - dart.setSignature(src__style__url.UrlStyle, { - constructors: () => ({new: dart.definiteFunctionType(src__style__url.UrlStyle, [])}), - methods: () => ({ - containsSeparator: dart.definiteFunctionType(core.bool, [core.String]), - isSeparator: dart.definiteFunctionType(core.bool, [core.int]), - needsSeparator: dart.definiteFunctionType(core.bool, [core.String]), - rootLength: dart.definiteFunctionType(core.int, [core.String]), - isRootRelative: dart.definiteFunctionType(core.bool, [core.String]), - getRelativeRoot: dart.definiteFunctionType(core.String, [core.String]), - pathFromUri: dart.definiteFunctionType(core.String, [core.Uri]), - absolutePathToUri: dart.definiteFunctionType(core.Uri, [core.String]) - }) - }); - let const$1; - src__style__windows.WindowsStyle = class WindowsStyle extends src__internal_style.InternalStyle { - new() { - this.separatorPattern = core.RegExp.new('[/\\\\]'); - this.needsSeparatorPattern = core.RegExp.new('[^/\\\\]$'); - this.rootPattern = core.RegExp.new('^(\\\\\\\\[^\\\\]+\\\\[^\\\\/]+|[a-zA-Z]:[/\\\\])'); - this.relativeRootPattern = core.RegExp.new("^[/\\\\](?![/\\\\])"); - this.name = 'windows'; - this.separator = '\\'; - this.separators = const$1 || (const$1 = dart.constList(['/', '\\'], core.String)); - } - containsSeparator(path) { - return path[dartx.contains]('/'); - } - isSeparator(codeUnit) { - return codeUnit == src__characters.SLASH || codeUnit == src__characters.BACKSLASH; - } - needsSeparator(path) { - if (dart.test(path[dartx.isEmpty])) return false; - return !dart.test(this.isSeparator(path[dartx.codeUnitAt](dart.notNull(path[dartx.length]) - 1))); - } - rootLength(path) { - if (dart.test(path[dartx.isEmpty])) return 0; - if (path[dartx.codeUnitAt](0) == src__characters.SLASH) return 1; - if (path[dartx.codeUnitAt](0) == src__characters.BACKSLASH) { - if (dart.notNull(path[dartx.length]) < 2 || path[dartx.codeUnitAt](1) != src__characters.BACKSLASH) return 1; - let index = path[dartx.indexOf]('\\', 2); - if (dart.notNull(index) > 0) { - index = path[dartx.indexOf]('\\', dart.notNull(index) + 1); - if (dart.notNull(index) > 0) return index; - } - return path[dartx.length]; - } - if (dart.notNull(path[dartx.length]) < 3) return 0; - if (!dart.test(src__utils.isAlphabetic(path[dartx.codeUnitAt](0)))) return 0; - if (path[dartx.codeUnitAt](1) != src__characters.COLON) return 0; - if (!dart.test(this.isSeparator(path[dartx.codeUnitAt](2)))) return 0; - return 3; - } - isRootRelative(path) { - return this.rootLength(path) == 1; - } - getRelativeRoot(path) { - let length = this.rootLength(path); - if (length == 1) return path[dartx.get](0); - return null; - } - pathFromUri(uri) { - if (uri.scheme != '' && uri.scheme != 'file') { - dart.throw(new core.ArgumentError(dart.str`Uri ${uri} must have scheme 'file:'.`)); - } - let path = uri.path; - if (uri.host == '') { - if (dart.test(path[dartx.startsWith]('/'))) path = path[dartx.replaceFirst]("/", ""); - } else { - path = dart.str`\\\\${uri.host}${path}`; - } - return core.Uri.decodeComponent(path[dartx.replaceAll]("/", "\\")); - } - absolutePathToUri(path) { - let parsed = src__parsed_path.ParsedPath.parse(path, this); - if (dart.test(parsed.root[dartx.startsWith]('\\\\'))) { - let rootParts = parsed.root[dartx.split]('\\')[dartx.where](dart.fn(part => part != '', StringTobool())); - parsed.parts[dartx.insert](0, rootParts[dartx.last]); - if (dart.test(parsed.hasTrailingSeparator)) { - parsed.parts[dartx.add](""); - } - return core.Uri.new({scheme: 'file', host: rootParts[dartx.first], pathSegments: parsed.parts}); - } else { - if (parsed.parts[dartx.length] == 0 || dart.test(parsed.hasTrailingSeparator)) { - parsed.parts[dartx.add](""); - } - parsed.parts[dartx.insert](0, parsed.root[dartx.replaceAll]("/", "")[dartx.replaceAll]("\\", "")); - return core.Uri.new({scheme: 'file', pathSegments: parsed.parts}); - } - } - }; - dart.setSignature(src__style__windows.WindowsStyle, { - constructors: () => ({new: dart.definiteFunctionType(src__style__windows.WindowsStyle, [])}), - methods: () => ({ - containsSeparator: dart.definiteFunctionType(core.bool, [core.String]), - isSeparator: dart.definiteFunctionType(core.bool, [core.int]), - needsSeparator: dart.definiteFunctionType(core.bool, [core.String]), - rootLength: dart.definiteFunctionType(core.int, [core.String]), - isRootRelative: dart.definiteFunctionType(core.bool, [core.String]), - getRelativeRoot: dart.definiteFunctionType(core.String, [core.String]), - pathFromUri: dart.definiteFunctionType(core.String, [core.Uri]), - absolutePathToUri: dart.definiteFunctionType(core.Uri, [core.String]) - }) - }); - src__utils.isAlphabetic = function(char) { - return dart.notNull(char) >= src__characters.UPPER_A && dart.notNull(char) <= src__characters.UPPER_Z || dart.notNull(char) >= src__characters.LOWER_A && dart.notNull(char) <= src__characters.LOWER_Z; - }; - dart.fn(src__utils.isAlphabetic, intTobool()); - src__utils.isNumeric = function(char) { - return dart.notNull(char) >= src__characters.ZERO && dart.notNull(char) <= src__characters.NINE; - }; - dart.fn(src__utils.isNumeric, intTobool()); - // Exports: - exports.path = path$; - exports.src__characters = src__characters; - exports.src__context = src__context; - exports.src__internal_style = src__internal_style; - exports.src__parsed_path = src__parsed_path; - exports.src__path_exception = src__path_exception; - exports.src__style__posix = src__style__posix; - exports.src__style__url = src__style__url; - exports.src__style__windows = src__style__windows; - exports.src__style = src__style; - exports.src__utils = src__utils; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/stack_trace/stack_trace.js b/pkg/dev_compiler/test/codegen_expected/stack_trace/stack_trace.js deleted file mode 100644 index 59171ff3a456..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/stack_trace/stack_trace.js +++ /dev/null @@ -1,797 +0,0 @@ -dart_library.library('stack_trace', null, /* Imports */[ - 'dart_sdk', - 'path' -], function load__stack_trace(exports, dart_sdk, path) { - 'use strict'; - const core = dart_sdk.core; - const async = dart_sdk.async; - const _interceptors = dart_sdk._interceptors; - const math = dart_sdk.math; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const path$ = path.path; - const src__style = path.src__style; - const src__chain = Object.create(null); - const src__frame = Object.create(null); - const src__lazy_trace = Object.create(null); - const src__stack_zone_specification = Object.create(null); - const src__trace = Object.create(null); - const src__unparsed_frame = Object.create(null); - const src__utils = Object.create(null); - const src__vm_trace = Object.create(null); - const stack_trace = Object.create(null); - let JSArrayOfTrace = () => (JSArrayOfTrace = dart.constFn(_interceptors.JSArray$(src__trace.Trace)))(); - let ListOfTrace = () => (ListOfTrace = dart.constFn(core.List$(src__trace.Trace)))(); - let ListOfFrame = () => (ListOfFrame = dart.constFn(core.List$(src__frame.Frame)))(); - let dynamicAndChainTovoid = () => (dynamicAndChainTovoid = dart.constFn(dart.functionType(dart.void, [dart.dynamic, src__chain.Chain])))(); - let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))(); - let ExpandoOf_Node = () => (ExpandoOf_Node = dart.constFn(core.Expando$(src__stack_zone_specification._Node)))(); - let JSArrayOfFrame = () => (JSArrayOfFrame = dart.constFn(_interceptors.JSArray$(src__frame.Frame)))(); - let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); - let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); - let StringToTrace = () => (StringToTrace = dart.constFn(dart.definiteFunctionType(src__trace.Trace, [core.String])))(); - let FrameTobool = () => (FrameTobool = dart.constFn(dart.definiteFunctionType(core.bool, [src__frame.Frame])))(); - let TraceToTrace = () => (TraceToTrace = dart.constFn(dart.definiteFunctionType(src__trace.Trace, [src__trace.Trace])))(); - let TraceTobool = () => (TraceTobool = dart.constFn(dart.definiteFunctionType(core.bool, [src__trace.Trace])))(); - let TraceToListOfFrame = () => (TraceToListOfFrame = dart.constFn(dart.definiteFunctionType(ListOfFrame(), [src__trace.Trace])))(); - let FrameToint = () => (FrameToint = dart.constFn(dart.definiteFunctionType(core.int, [src__frame.Frame])))(); - let TraceToint = () => (TraceToint = dart.constFn(dart.definiteFunctionType(core.int, [src__trace.Trace])))(); - let FrameToString = () => (FrameToString = dart.constFn(dart.definiteFunctionType(core.String, [src__frame.Frame])))(); - let TraceToString = () => (TraceToString = dart.constFn(dart.definiteFunctionType(core.String, [src__trace.Trace])))(); - let VoidToFrame = () => (VoidToFrame = dart.constFn(dart.definiteFunctionType(src__frame.Frame, [])))(); - let dynamicAnddynamicToFrame = () => (dynamicAnddynamicToFrame = dart.constFn(dart.definiteFunctionType(src__frame.Frame, [dart.dynamic, dart.dynamic])))(); - let VoidToTrace = () => (VoidToTrace = dart.constFn(dart.definiteFunctionType(src__trace.Trace, [])))(); - let ObjectAndStackTraceAndEventSinkTovoid = () => (ObjectAndStackTraceAndEventSinkTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace, async.EventSink])))(); - let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))(); - let StringToFrame = () => (StringToFrame = dart.constFn(dart.definiteFunctionType(src__frame.Frame, [core.String])))(); - let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))(); - let FrameToFrame = () => (FrameToFrame = dart.constFn(dart.definiteFunctionType(src__frame.Frame, [src__frame.Frame])))(); - let StringAndintToString = () => (StringAndintToString = dart.constFn(dart.definiteFunctionType(core.String, [core.String, core.int])))(); - let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Match])))(); - src__chain.ChainHandler = dart.typedef('ChainHandler', () => dart.functionType(dart.void, [dart.dynamic, src__chain.Chain])); - let const$; - let const$0; - src__chain.Chain = class Chain extends core.Object { - static get _currentSpec() { - return src__stack_zone_specification.StackZoneSpecification._check(async.Zone.current.get(const$ || (const$ = dart.const(core.Symbol.new('stack_trace.stack_zone.spec'))))); - } - static capture(T) { - return (callback, opts) => { - let onError = opts && 'onError' in opts ? opts.onError : null; - let when = opts && 'when' in opts ? opts.when : true; - if (!dart.test(when)) { - let newOnError = null; - if (onError != null) { - newOnError = dart.fn((error, stackTrace) => { - dart.dcall(onError, error, src__chain.Chain.forTrace(core.StackTrace._check(stackTrace))); - }, dynamicAnddynamicTodynamic()); - } - return async.runZoned(T)(callback, {onError: core.Function._check(newOnError)}); - } - let spec = new src__stack_zone_specification.StackZoneSpecification(onError); - return T.as(async.runZoned(dart.dynamic)(dart.fn(() => { - try { - return callback(); - } catch (error) { - let stackTrace = dart.stackTrace(error); - return async.Zone.current.handleUncaughtError(dart.dynamic)(error, stackTrace); - } - - }, VoidTodynamic()), {zoneSpecification: spec.toSpec(), zoneValues: dart.map([const$0 || (const$0 = dart.const(core.Symbol.new('stack_trace.stack_zone.spec'))), spec], core.Symbol, src__stack_zone_specification.StackZoneSpecification)})); - }; - } - static track(futureOrStream) { - return futureOrStream; - } - static current(level) { - if (level === void 0) level = 0; - if (src__chain.Chain._currentSpec != null) return src__chain.Chain._currentSpec.currentChain(dart.notNull(level) + 1); - return new src__chain.Chain(JSArrayOfTrace().of([src__trace.Trace.current(dart.notNull(level) + 1)])); - } - static forTrace(trace) { - if (src__chain.Chain.is(trace)) return trace; - if (src__chain.Chain._currentSpec == null) return new src__chain.Chain(JSArrayOfTrace().of([src__trace.Trace.from(trace)])); - return src__chain.Chain._currentSpec.chainFor(trace); - } - static parse(chain) { - if (dart.test(chain[dartx.isEmpty])) return new src__chain.Chain(JSArrayOfTrace().of([])); - if (!dart.test(chain[dartx.contains](src__utils.chainGap))) return new src__chain.Chain(JSArrayOfTrace().of([src__trace.Trace.parse(chain)])); - return new src__chain.Chain(chain[dartx.split](src__utils.chainGap)[dartx.map](src__trace.Trace)(dart.fn(trace => new src__trace.Trace.parseFriendly(trace), StringToTrace()))); - } - new(traces) { - this.traces = ListOfTrace().unmodifiable(traces); - } - get terse() { - return this.foldFrames(dart.fn(_ => false, FrameTobool()), {terse: true}); - } - foldFrames(predicate, opts) { - let terse = opts && 'terse' in opts ? opts.terse : false; - let foldedTraces = this.traces[dartx.map](src__trace.Trace)(dart.fn(trace => trace.foldFrames(predicate, {terse: terse}), TraceToTrace())); - let nonEmptyTraces = foldedTraces[dartx.where](dart.fn(trace => { - if (dart.notNull(trace.frames[dartx.length]) > 1) return true; - if (dart.test(trace.frames[dartx.isEmpty])) return false; - if (!dart.test(terse)) return false; - return trace.frames[dartx.single].line != null; - }, TraceTobool())); - if (dart.test(nonEmptyTraces[dartx.isEmpty]) && dart.test(foldedTraces[dartx.isNotEmpty])) { - return new src__chain.Chain(JSArrayOfTrace().of([foldedTraces[dartx.last]])); - } - return new src__chain.Chain(nonEmptyTraces); - } - toTrace() { - return new src__trace.Trace(this.traces[dartx.expand](src__frame.Frame)(dart.fn(trace => trace.frames, TraceToListOfFrame()))); - } - toString() { - let longest = this.traces[dartx.map](core.int)(dart.fn(trace => trace.frames[dartx.map](core.int)(dart.fn(frame => frame.location[dartx.length], FrameToint()))[dartx.fold](core.int)(0, dart.gbind(math.max, core.int)), TraceToint()))[dartx.fold](core.int)(0, dart.gbind(math.max, core.int)); - return this.traces[dartx.map](core.String)(dart.fn(trace => trace.frames[dartx.map](core.String)(dart.fn(frame => dart.str`${src__utils.padRight(frame.location, longest)} ${frame.member}\n`, FrameToString()))[dartx.join](), TraceToString()))[dartx.join](src__utils.chainGap); - } - }; - src__chain.Chain[dart.implements] = () => [core.StackTrace]; - dart.setSignature(src__chain.Chain, { - constructors: () => ({ - current: dart.definiteFunctionType(src__chain.Chain, [], [core.int]), - forTrace: dart.definiteFunctionType(src__chain.Chain, [core.StackTrace]), - parse: dart.definiteFunctionType(src__chain.Chain, [core.String]), - new: dart.definiteFunctionType(src__chain.Chain, [core.Iterable$(src__trace.Trace)]) - }), - methods: () => ({ - foldFrames: dart.definiteFunctionType(src__chain.Chain, [dart.functionType(core.bool, [src__frame.Frame])], {terse: core.bool}), - toTrace: dart.definiteFunctionType(src__trace.Trace, []) - }), - statics: () => ({ - capture: dart.definiteFunctionType(T => [T, [dart.functionType(T, [])], {onError: dynamicAndChainTovoid(), when: core.bool}]), - track: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]) - }), - names: ['capture', 'track'] - }); - dart.defineLazy(src__frame, { - get _vmFrame() { - return core.RegExp.new('^#\\d+\\s+(\\S.*) \\((.+?)((?::\\d+){0,2})\\)$'); - } - }); - dart.defineLazy(src__frame, { - get _v8Frame() { - return core.RegExp.new('^\\s*at (?:(\\S.*?)(?: \\[as [^\\]]+\\])? \\((.*)\\)|(.*))$'); - } - }); - dart.defineLazy(src__frame, { - get _v8UrlLocation() { - return core.RegExp.new('^(.*):(\\d+):(\\d+)|native$'); - } - }); - dart.defineLazy(src__frame, { - get _v8EvalLocation() { - return core.RegExp.new('^eval at (?:\\S.*?) \\((.*)\\)(?:, .*?:\\d+:\\d+)?$'); - } - }); - dart.defineLazy(src__frame, { - get _firefoxSafariFrame() { - return core.RegExp.new('^' + '(?:' + '([^@(/]*)' + '(?:\\(.*\\))?' + '((?:/[^/]*)*)' + '(?:\\(.*\\))?' + '@' + ')?' + '(.*?)' + ':' + '(\\d*)' + '(?::(\\d*))?' + '$'); - } - }); - dart.defineLazy(src__frame, { - get _friendlyFrame() { - return core.RegExp.new('^(\\S+)(?: (\\d+)(?::(\\d+))?)?\\s+([^\\d]\\S*)$'); - } - }); - dart.defineLazy(src__frame, { - get _asyncBody() { - return core.RegExp.new('<(|[^>]+)_async_body>'); - } - }); - dart.defineLazy(src__frame, { - get _initialDot() { - return core.RegExp.new("^\\."); - } - }); - src__frame.Frame = class Frame extends core.Object { - get isCore() { - return this.uri.scheme == 'dart'; - } - get library() { - if (this.uri.scheme == 'data') return "data:..."; - return path$.prettyUri(this.uri); - } - get package() { - if (this.uri.scheme != 'package') return null; - return this.uri.path[dartx.split]('/')[dartx.first]; - } - get location() { - if (this.line == null) return this.library; - if (this.column == null) return dart.str`${this.library} ${this.line}`; - return dart.str`${this.library} ${this.line}:${this.column}`; - } - static caller(level) { - if (level === void 0) level = 1; - if (dart.notNull(level) < 0) { - dart.throw(new core.ArgumentError("Argument [level] must be greater than or equal " + "to 0.")); - } - return src__trace.Trace.current(dart.notNull(level) + 1).frames[dartx.first]; - } - static parseVM(frame) { - return src__frame.Frame._catchFormatException(frame, dart.fn(() => { - if (frame == '...') { - return new src__frame.Frame(core.Uri.new(), null, null, '...'); - } - let match = src__frame._vmFrame.firstMatch(frame); - if (match == null) return new src__unparsed_frame.UnparsedFrame(frame); - let member = match.get(1)[dartx.replaceAll](src__frame._asyncBody, "")[dartx.replaceAll]("", ""); - let uri = core.Uri.parse(match.get(2)); - let lineAndColumn = match.get(3)[dartx.split](':'); - let line = dart.notNull(lineAndColumn[dartx.length]) > 1 ? core.int.parse(lineAndColumn[dartx.get](1)) : null; - let column = dart.notNull(lineAndColumn[dartx.length]) > 2 ? core.int.parse(lineAndColumn[dartx.get](2)) : null; - return new src__frame.Frame(uri, line, column, member); - }, VoidToFrame())); - } - static parseV8(frame) { - return src__frame.Frame._catchFormatException(frame, dart.fn(() => { - let match = src__frame._v8Frame.firstMatch(frame); - if (match == null) return new src__unparsed_frame.UnparsedFrame(frame); - function parseLocation(location, member) { - let evalMatch = src__frame._v8EvalLocation.firstMatch(core.String._check(location)); - while (evalMatch != null) { - location = evalMatch.get(1); - evalMatch = src__frame._v8EvalLocation.firstMatch(core.String._check(location)); - } - if (dart.equals(location, 'native')) { - return new src__frame.Frame(core.Uri.parse('native'), null, null, core.String._check(member)); - } - let urlMatch = src__frame._v8UrlLocation.firstMatch(core.String._check(location)); - if (urlMatch == null) return new src__unparsed_frame.UnparsedFrame(frame); - return new src__frame.Frame(src__frame.Frame._uriOrPathToUri(urlMatch.get(1)), core.int.parse(urlMatch.get(2)), core.int.parse(urlMatch.get(3)), core.String._check(member)); - } - dart.fn(parseLocation, dynamicAnddynamicToFrame()); - if (match.get(2) != null) { - return parseLocation(match.get(2), match.get(1)[dartx.replaceAll]("", "")[dartx.replaceAll]("Anonymous function", "")); - } else { - return parseLocation(match.get(3), ""); - } - }, VoidToFrame())); - } - static parseJSCore(frame) { - return src__frame.Frame.parseV8(frame); - } - static parseIE(frame) { - return src__frame.Frame.parseV8(frame); - } - static parseFirefox(frame) { - return src__frame.Frame._catchFormatException(frame, dart.fn(() => { - let match = src__frame._firefoxSafariFrame.firstMatch(frame); - if (match == null) return new src__unparsed_frame.UnparsedFrame(frame); - let uri = src__frame.Frame._uriOrPathToUri(match.get(3)); - let member = null; - if (match.get(1) != null) { - member = match.get(1); - member = dart.dsend(member, '+', ListOfString().filled('/'[dartx.allMatches](match.get(2))[dartx.length], ".")[dartx.join]()); - if (dart.equals(member, '')) member = ''; - member = dart.dsend(member, 'replaceFirst', src__frame._initialDot, ''); - } else { - member = ''; - } - let line = match.get(4) == '' ? null : core.int.parse(match.get(4)); - let column = match.get(5) == null || match.get(5) == '' ? null : core.int.parse(match.get(5)); - return new src__frame.Frame(uri, line, column, core.String._check(member)); - }, VoidToFrame())); - } - static parseSafari6_0(frame) { - return src__frame.Frame.parseFirefox(frame); - } - static parseSafari6_1(frame) { - return src__frame.Frame.parseFirefox(frame); - } - static parseSafari(frame) { - return src__frame.Frame.parseFirefox(frame); - } - static parseFriendly(frame) { - return src__frame.Frame._catchFormatException(frame, dart.fn(() => { - let match = src__frame._friendlyFrame.firstMatch(frame); - if (match == null) { - dart.throw(new core.FormatException(dart.str`Couldn't parse package:stack_trace stack trace line '${frame}'.`)); - } - let uri = core.Uri.parse(match.get(1)); - if (uri.scheme == '') { - uri = path$.toUri(path$.absolute(path$.fromUri(uri))); - } - let line = match.get(2) == null ? null : core.int.parse(match.get(2)); - let column = match.get(3) == null ? null : core.int.parse(match.get(3)); - return new src__frame.Frame(uri, line, column, match.get(4)); - }, VoidToFrame())); - } - static _uriOrPathToUri(uriOrPath) { - if (dart.test(uriOrPath[dartx.contains](src__frame.Frame._uriRegExp))) { - return core.Uri.parse(uriOrPath); - } else if (dart.test(uriOrPath[dartx.contains](src__frame.Frame._windowsRegExp))) { - return core.Uri.file(uriOrPath, {windows: true}); - } else if (dart.test(uriOrPath[dartx.startsWith]('/'))) { - return core.Uri.file(uriOrPath, {windows: false}); - } - if (dart.test(uriOrPath[dartx.contains]('\\'))) return path$.windows.toUri(uriOrPath); - return core.Uri.parse(uriOrPath); - } - static _catchFormatException(text, body) { - try { - return body(); - } catch (_) { - if (core.FormatException.is(_)) { - return new src__unparsed_frame.UnparsedFrame(text); - } else - throw _; - } - - } - new(uri, line, column, member) { - this.uri = uri; - this.line = line; - this.column = column; - this.member = member; - } - toString() { - return dart.str`${this.location} in ${this.member}`; - } - }; - dart.setSignature(src__frame.Frame, { - constructors: () => ({ - caller: dart.definiteFunctionType(src__frame.Frame, [], [core.int]), - parseVM: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseV8: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseJSCore: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseIE: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseFirefox: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseSafari6_0: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseSafari6_1: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseSafari: dart.definiteFunctionType(src__frame.Frame, [core.String]), - parseFriendly: dart.definiteFunctionType(src__frame.Frame, [core.String]), - new: dart.definiteFunctionType(src__frame.Frame, [core.Uri, core.int, core.int, core.String]) - }), - statics: () => ({ - _uriOrPathToUri: dart.definiteFunctionType(core.Uri, [core.String]), - _catchFormatException: dart.definiteFunctionType(src__frame.Frame, [core.String, dart.functionType(src__frame.Frame, [])]) - }), - names: ['_uriOrPathToUri', '_catchFormatException'] - }); - dart.defineLazy(src__frame.Frame, { - get _uriRegExp() { - return core.RegExp.new('^[a-zA-Z][-+.a-zA-Z\\d]*://'); - }, - get _windowsRegExp() { - return core.RegExp.new('^([a-zA-Z]:[\\\\/]|\\\\\\\\)'); - } - }); - src__lazy_trace.TraceThunk = dart.typedef('TraceThunk', () => dart.functionType(src__trace.Trace, [])); - const _thunk = Symbol('_thunk'); - const _inner = Symbol('_inner'); - const _trace = Symbol('_trace'); - src__lazy_trace.LazyTrace = class LazyTrace extends core.Object { - new(thunk) { - this[_thunk] = thunk; - this[_inner] = null; - } - get [_trace]() { - if (this[_inner] == null) this[_inner] = this[_thunk](); - return this[_inner]; - } - get frames() { - return this[_trace].frames; - } - get vmTrace() { - return this[_trace].vmTrace; - } - get terse() { - return new src__lazy_trace.LazyTrace(dart.fn(() => this[_trace].terse, VoidToTrace())); - } - foldFrames(predicate, opts) { - let terse = opts && 'terse' in opts ? opts.terse : false; - return new src__lazy_trace.LazyTrace(dart.fn(() => this[_trace].foldFrames(predicate, {terse: terse}), VoidToTrace())); - } - toString() { - return dart.toString(this[_trace]); - } - set frames(_) { - return dart.throw(new core.UnimplementedError()); - } - }; - src__lazy_trace.LazyTrace[dart.implements] = () => [src__trace.Trace]; - dart.setSignature(src__lazy_trace.LazyTrace, { - constructors: () => ({new: dart.definiteFunctionType(src__lazy_trace.LazyTrace, [src__lazy_trace.TraceThunk])}), - methods: () => ({foldFrames: dart.definiteFunctionType(src__trace.Trace, [dart.functionType(core.bool, [src__frame.Frame])], {terse: core.bool})}) - }); - src__stack_zone_specification._ChainHandler = dart.typedef('_ChainHandler', () => dart.functionType(dart.void, [dart.dynamic, src__chain.Chain])); - const _chains = Symbol('_chains'); - const _onError = Symbol('_onError'); - const _currentNode = Symbol('_currentNode'); - const _createNode = Symbol('_createNode'); - const _run = Symbol('_run'); - src__stack_zone_specification.StackZoneSpecification = class StackZoneSpecification extends core.Object { - new(onError) { - if (onError === void 0) onError = null; - this[_chains] = new (ExpandoOf_Node())("stack chains"); - this[_onError] = onError; - this[_currentNode] = null; - } - toSpec() { - return async.ZoneSpecification.new({handleUncaughtError: dart.bind(this, 'handleUncaughtError'), registerCallback: dart.bind(this, 'registerCallback'), registerUnaryCallback: dart.bind(this, 'registerUnaryCallback'), registerBinaryCallback: dart.bind(this, 'registerBinaryCallback'), errorCallback: dart.bind(this, 'errorCallback')}); - } - currentChain(level) { - if (level === void 0) level = 0; - return this[_createNode](dart.notNull(level) + 1).toChain(); - } - chainFor(trace) { - if (src__chain.Chain.is(trace)) return trace; - let previous = trace == null ? null : this[_chains].get(trace); - return new src__stack_zone_specification._Node(trace, previous).toChain(); - } - trackFuture(future, level) { - if (level === void 0) level = 0; - let completer = async.Completer.sync(); - let node = this[_createNode](dart.notNull(level) + 1); - future.then(dart.dynamic)(dart.bind(completer, 'complete')).catchError(dart.fn((e, stackTrace) => { - if (stackTrace == null) stackTrace = src__trace.Trace.current(); - if (!src__chain.Chain.is(stackTrace) && this[_chains].get(stackTrace) == null) { - this[_chains].set(stackTrace, node); - } - completer.completeError(e, core.StackTrace._check(stackTrace)); - }, dynamicAnddynamicTodynamic())); - return completer.future; - } - trackStream(stream, level) { - if (level === void 0) level = 0; - let node = this[_createNode](dart.notNull(level) + 1); - return stream.transform(dart.dynamic)(async.StreamTransformer.fromHandlers({handleError: dart.fn((error, stackTrace, sink) => { - if (stackTrace == null) stackTrace = src__trace.Trace.current(); - if (!src__chain.Chain.is(stackTrace) && this[_chains].get(stackTrace) == null) { - this[_chains].set(stackTrace, node); - } - sink.addError(error, stackTrace); - }, ObjectAndStackTraceAndEventSinkTovoid())})); - } - registerCallback(self, parent, zone, f) { - if (f == null) return parent.registerCallback(dart.dynamic)(zone, null); - let node = this[_createNode](1); - return parent.registerCallback(dart.dynamic)(zone, dart.fn(() => this[_run](f, node), VoidTodynamic())); - } - registerUnaryCallback(self, parent, zone, f) { - if (f == null) return parent.registerUnaryCallback(dart.dynamic, dart.dynamic)(zone, null); - let node = this[_createNode](1); - return parent.registerUnaryCallback(dart.dynamic, dart.dynamic)(zone, dart.fn(arg => this[_run](dart.fn(() => dart.dcall(f, arg), VoidTodynamic()), node), dynamicTodynamic())); - } - registerBinaryCallback(self, parent, zone, f) { - if (f == null) return parent.registerBinaryCallback(dart.dynamic, dart.dynamic, dart.dynamic)(zone, null); - let node = this[_createNode](1); - return parent.registerBinaryCallback(dart.dynamic, dart.dynamic, dart.dynamic)(zone, dart.fn((arg1, arg2) => this[_run](dart.fn(() => dart.dcall(f, arg1, arg2), VoidTodynamic()), node), dynamicAnddynamicTodynamic())); - } - handleUncaughtError(self, parent, zone, error, stackTrace) { - let stackChain = this.chainFor(stackTrace); - if (this[_onError] == null) { - return parent.handleUncaughtError(dart.dynamic)(zone, error, stackChain); - } - try { - return parent.runBinary(dart.dynamic, dart.dynamic, src__chain.Chain)(zone, this[_onError], error, stackChain); - } catch (newError) { - let newStackTrace = dart.stackTrace(newError); - if (core.identical(newError, error)) { - return parent.handleUncaughtError(dart.dynamic)(zone, error, stackChain); - } else { - return parent.handleUncaughtError(dart.dynamic)(zone, newError, newStackTrace); - } - } - - } - errorCallback(self, parent, zone, error, stackTrace) { - if (stackTrace == null) { - stackTrace = this[_createNode](2).toChain(); - } else { - if (this[_chains].get(stackTrace) == null) this[_chains].set(stackTrace, this[_createNode](2)); - } - let asyncError = parent.errorCallback(zone, error, stackTrace); - return asyncError == null ? new async.AsyncError(error, stackTrace) : asyncError; - } - [_createNode](level) { - if (level === void 0) level = 0; - return new src__stack_zone_specification._Node(src__trace.Trace.current(dart.notNull(level) + 1), this[_currentNode]); - } - [_run](f, node) { - let previousNode = this[_currentNode]; - this[_currentNode] = node; - try { - return dart.dcall(f); - } catch (e) { - let stackTrace = dart.stackTrace(e); - this[_chains].set(stackTrace, node); - throw e; - } - finally { - this[_currentNode] = previousNode; - } - } - }; - dart.setSignature(src__stack_zone_specification.StackZoneSpecification, { - constructors: () => ({new: dart.definiteFunctionType(src__stack_zone_specification.StackZoneSpecification, [], [src__stack_zone_specification._ChainHandler])}), - methods: () => ({ - toSpec: dart.definiteFunctionType(async.ZoneSpecification, []), - currentChain: dart.definiteFunctionType(src__chain.Chain, [], [core.int]), - chainFor: dart.definiteFunctionType(src__chain.Chain, [core.StackTrace]), - trackFuture: dart.definiteFunctionType(async.Future, [async.Future], [core.int]), - trackStream: dart.definiteFunctionType(async.Stream, [async.Stream], [core.int]), - registerCallback: dart.definiteFunctionType(async.ZoneCallback, [async.Zone, async.ZoneDelegate, async.Zone, core.Function]), - registerUnaryCallback: dart.definiteFunctionType(async.ZoneUnaryCallback, [async.Zone, async.ZoneDelegate, async.Zone, core.Function]), - registerBinaryCallback: dart.definiteFunctionType(async.ZoneBinaryCallback, [async.Zone, async.ZoneDelegate, async.Zone, core.Function]), - handleUncaughtError: dart.definiteFunctionType(dart.dynamic, [async.Zone, async.ZoneDelegate, async.Zone, dart.dynamic, core.StackTrace]), - errorCallback: dart.definiteFunctionType(async.AsyncError, [async.Zone, async.ZoneDelegate, async.Zone, core.Object, core.StackTrace]), - [_createNode]: dart.definiteFunctionType(src__stack_zone_specification._Node, [], [core.int]), - [_run]: dart.definiteFunctionType(dart.dynamic, [core.Function, src__stack_zone_specification._Node]) - }) - }); - src__stack_zone_specification._Node = class _Node extends core.Object { - new(trace, previous) { - if (previous === void 0) previous = null; - this.previous = previous; - this.trace = trace == null ? src__trace.Trace.current() : src__trace.Trace.from(trace); - } - toChain() { - let nodes = JSArrayOfTrace().of([]); - let node = this; - while (node != null) { - nodes[dartx.add](node.trace); - node = node.previous; - } - return new src__chain.Chain(nodes); - } - }; - dart.setSignature(src__stack_zone_specification._Node, { - constructors: () => ({new: dart.definiteFunctionType(src__stack_zone_specification._Node, [core.StackTrace], [src__stack_zone_specification._Node])}), - methods: () => ({toChain: dart.definiteFunctionType(src__chain.Chain, [])}) - }); - dart.defineLazy(src__trace, { - get _terseRegExp() { - return core.RegExp.new("(-patch)?([/\\\\].*)?$"); - } - }); - dart.defineLazy(src__trace, { - get _v8Trace() { - return core.RegExp.new("\\n ?at "); - } - }); - dart.defineLazy(src__trace, { - get _v8TraceLine() { - return core.RegExp.new(" ?at "); - } - }); - dart.defineLazy(src__trace, { - get _firefoxSafariTrace() { - return core.RegExp.new("^" + "(" + "([.0-9A-Za-z_$/<]|\\(.*\\))*" + "@" + ")?" + "[^\\s]*" + ":\\d*" + "$", {multiLine: true}); - } - }); - dart.defineLazy(src__trace, { - get _friendlyTrace() { - return core.RegExp.new("^[^\\s]+( \\d+(:\\d+)?)?[ \\t]+[^\\s]+$", {multiLine: true}); - } - }); - src__trace.Trace = class Trace extends core.Object { - static format(stackTrace, opts) { - let terse = opts && 'terse' in opts ? opts.terse : true; - let trace = src__trace.Trace.from(stackTrace); - if (dart.test(terse)) trace = trace.terse; - return dart.toString(trace); - } - static current(level) { - if (level === void 0) level = 0; - if (dart.notNull(level) < 0) { - dart.throw(new core.ArgumentError("Argument [level] must be greater than or equal " + "to 0.")); - } - let trace = src__trace.Trace.from(core.StackTrace.current); - return new src__lazy_trace.LazyTrace(dart.fn(() => new src__trace.Trace(trace.frames[dartx.skip](dart.notNull(level) + (dart.test(src__utils.inJS) ? 2 : 1))), VoidToTrace())); - } - static from(trace) { - if (trace == null) { - dart.throw(new core.ArgumentError("Cannot create a Trace from null.")); - } - if (src__trace.Trace.is(trace)) return trace; - if (src__chain.Chain.is(trace)) return trace.toTrace(); - return new src__lazy_trace.LazyTrace(dart.fn(() => src__trace.Trace.parse(dart.toString(trace)), VoidToTrace())); - } - static parse(trace) { - try { - if (dart.test(trace[dartx.isEmpty])) return new src__trace.Trace(JSArrayOfFrame().of([])); - if (dart.test(trace[dartx.contains](src__trace._v8Trace))) return new src__trace.Trace.parseV8(trace); - if (dart.test(trace[dartx.contains]("\tat "))) return new src__trace.Trace.parseJSCore(trace); - if (dart.test(trace[dartx.contains](src__trace._firefoxSafariTrace))) { - return new src__trace.Trace.parseFirefox(trace); - } - if (dart.test(trace[dartx.contains](src__utils.chainGap))) return src__chain.Chain.parse(trace).toTrace(); - if (dart.test(trace[dartx.contains](src__trace._friendlyTrace))) { - return new src__trace.Trace.parseFriendly(trace); - } - return new src__trace.Trace.parseVM(trace); - } catch (error) { - if (core.FormatException.is(error)) { - dart.throw(new core.FormatException(dart.str`${error.message}\nStack trace:\n${trace}`)); - } else - throw error; - } - - } - parseVM(trace) { - Trace.prototype.new.call(this, src__trace.Trace._parseVM(trace)); - } - static _parseVM(trace) { - let lines = trace[dartx.trim]()[dartx.split]("\n"); - let frames = lines[dartx.take](dart.notNull(lines[dartx.length]) - 1)[dartx.map](src__frame.Frame)(dart.fn(line => src__frame.Frame.parseVM(line), StringToFrame()))[dartx.toList](); - if (!dart.test(lines[dartx.last][dartx.endsWith](".da"))) { - frames[dartx.add](src__frame.Frame.parseVM(lines[dartx.last])); - } - return frames; - } - parseV8(trace) { - Trace.prototype.new.call(this, trace[dartx.split]("\n")[dartx.skip](1)[dartx.skipWhile](dart.fn(line => !dart.test(line[dartx.startsWith](src__trace._v8TraceLine)), StringTobool()))[dartx.map](src__frame.Frame)(dart.fn(line => src__frame.Frame.parseV8(line), StringToFrame()))); - } - parseJSCore(trace) { - Trace.prototype.new.call(this, trace[dartx.split]("\n")[dartx.where](dart.fn(line => line != "\tat ", StringTobool()))[dartx.map](src__frame.Frame)(dart.fn(line => src__frame.Frame.parseV8(line), StringToFrame()))); - } - parseIE(trace) { - Trace.prototype.parseV8.call(this, trace); - } - parseFirefox(trace) { - Trace.prototype.new.call(this, trace[dartx.trim]()[dartx.split]("\n")[dartx.where](dart.fn(line => dart.test(line[dartx.isNotEmpty]) && line != '[native code]', StringTobool()))[dartx.map](src__frame.Frame)(dart.fn(line => src__frame.Frame.parseFirefox(line), StringToFrame()))); - } - parseSafari(trace) { - Trace.prototype.parseFirefox.call(this, trace); - } - parseSafari6_1(trace) { - Trace.prototype.parseSafari.call(this, trace); - } - parseSafari6_0(trace) { - Trace.prototype.new.call(this, trace[dartx.trim]()[dartx.split]("\n")[dartx.where](dart.fn(line => line != '[native code]', StringTobool()))[dartx.map](src__frame.Frame)(dart.fn(line => src__frame.Frame.parseFirefox(line), StringToFrame()))); - } - parseFriendly(trace) { - Trace.prototype.new.call(this, dart.test(trace[dartx.isEmpty]) ? JSArrayOfFrame().of([]) : trace[dartx.trim]()[dartx.split]("\n")[dartx.where](dart.fn(line => !dart.test(line[dartx.startsWith]('=====')), StringTobool()))[dartx.map](src__frame.Frame)(dart.fn(line => src__frame.Frame.parseFriendly(line), StringToFrame()))); - } - new(frames) { - this.frames = ListOfFrame().unmodifiable(frames); - } - get vmTrace() { - return new src__vm_trace.VMTrace(this.frames); - } - get terse() { - return this.foldFrames(dart.fn(_ => false, FrameTobool()), {terse: true}); - } - foldFrames(predicate, opts) { - let terse = opts && 'terse' in opts ? opts.terse : false; - if (dart.test(terse)) { - let oldPredicate = predicate; - predicate = dart.fn(frame => { - if (dart.test(oldPredicate(frame))) return true; - if (dart.test(frame.isCore)) return true; - if (frame.package == 'stack_trace') return true; - if (!dart.test(frame.member[dartx.contains](''))) return false; - return frame.line == null; - }, FrameTobool()); - } - let newFrames = JSArrayOfFrame().of([]); - for (let frame of this.frames[dartx.reversed]) { - if (src__unparsed_frame.UnparsedFrame.is(frame) || !dart.test(predicate(frame))) { - newFrames[dartx.add](frame); - } else if (dart.test(newFrames[dartx.isEmpty]) || !dart.test(predicate(newFrames[dartx.last]))) { - newFrames[dartx.add](new src__frame.Frame(frame.uri, frame.line, frame.column, frame.member)); - } - } - if (dart.test(terse)) { - newFrames = newFrames[dartx.map](src__frame.Frame)(dart.fn(frame => { - if (src__unparsed_frame.UnparsedFrame.is(frame) || !dart.test(predicate(frame))) return frame; - let library = frame.library[dartx.replaceAll](src__trace._terseRegExp, ''); - return new src__frame.Frame(core.Uri.parse(library), null, null, frame.member); - }, FrameToFrame()))[dartx.toList](); - if (dart.notNull(newFrames[dartx.length]) > 1 && dart.test(newFrames[dartx.first].isCore)) newFrames[dartx.removeAt](0); - } - return new src__trace.Trace(newFrames[dartx.reversed]); - } - toString() { - let longest = this.frames[dartx.map](core.int)(dart.fn(frame => frame.location[dartx.length], FrameToint()))[dartx.fold](core.int)(0, dart.gbind(math.max, core.int)); - return this.frames[dartx.map](core.String)(dart.fn(frame => { - if (src__unparsed_frame.UnparsedFrame.is(frame)) return dart.str`${frame}\n`; - return dart.str`${src__utils.padRight(frame.location, longest)} ${frame.member}\n`; - }, FrameToString()))[dartx.join](); - } - }; - dart.defineNamedConstructor(src__trace.Trace, 'parseVM'); - dart.defineNamedConstructor(src__trace.Trace, 'parseV8'); - dart.defineNamedConstructor(src__trace.Trace, 'parseJSCore'); - dart.defineNamedConstructor(src__trace.Trace, 'parseIE'); - dart.defineNamedConstructor(src__trace.Trace, 'parseFirefox'); - dart.defineNamedConstructor(src__trace.Trace, 'parseSafari'); - dart.defineNamedConstructor(src__trace.Trace, 'parseSafari6_1'); - dart.defineNamedConstructor(src__trace.Trace, 'parseSafari6_0'); - dart.defineNamedConstructor(src__trace.Trace, 'parseFriendly'); - src__trace.Trace[dart.implements] = () => [core.StackTrace]; - dart.setSignature(src__trace.Trace, { - constructors: () => ({ - current: dart.definiteFunctionType(src__trace.Trace, [], [core.int]), - from: dart.definiteFunctionType(src__trace.Trace, [core.StackTrace]), - parse: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseVM: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseV8: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseJSCore: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseIE: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseFirefox: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseSafari: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseSafari6_1: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseSafari6_0: dart.definiteFunctionType(src__trace.Trace, [core.String]), - parseFriendly: dart.definiteFunctionType(src__trace.Trace, [core.String]), - new: dart.definiteFunctionType(src__trace.Trace, [core.Iterable$(src__frame.Frame)]) - }), - methods: () => ({foldFrames: dart.definiteFunctionType(src__trace.Trace, [dart.functionType(core.bool, [src__frame.Frame])], {terse: core.bool})}), - statics: () => ({ - format: dart.definiteFunctionType(core.String, [core.StackTrace], {terse: core.bool}), - _parseVM: dart.definiteFunctionType(core.List$(src__frame.Frame), [core.String]) - }), - names: ['format', '_parseVM'] - }); - src__unparsed_frame.UnparsedFrame = class UnparsedFrame extends core.Object { - new(member) { - this.uri = core.Uri.new({path: "unparsed"}); - this.member = member; - this.line = null; - this.column = null; - this.isCore = false; - this.library = "unparsed"; - this.package = null; - this.location = "unparsed"; - } - toString() { - return this.member; - } - }; - src__unparsed_frame.UnparsedFrame[dart.implements] = () => [src__frame.Frame]; - dart.setSignature(src__unparsed_frame.UnparsedFrame, { - constructors: () => ({new: dart.definiteFunctionType(src__unparsed_frame.UnparsedFrame, [core.String])}) - }); - src__utils.chainGap = '===== asynchronous gap ===========================\n'; - dart.defineLazy(src__utils, { - get inJS() { - return dart.equals(path$.style, src__style.Style.url); - } - }); - src__utils.padRight = function(string, length) { - if (dart.notNull(string[dartx.length]) >= dart.notNull(length)) return string; - let result = new core.StringBuffer(); - result.write(string); - for (let i = 0; i < dart.notNull(length) - dart.notNull(string[dartx.length]); i++) { - result.write(' '); - } - return result.toString(); - }; - dart.fn(src__utils.padRight, StringAndintToString()); - src__vm_trace.VMTrace = class VMTrace extends core.Object { - new(frames) { - this.frames = frames; - } - toString() { - let i = 1; - return this.frames[dartx.map](core.String)(dart.fn(frame => { - let number = src__utils.padRight(dart.str`#${i++}`, 8); - let member = frame.member[dartx.replaceAllMapped](core.RegExp.new("[^.]+\\."), dart.fn(match => dart.str`${match.get(1)}.<${match.get(1)}_async_body>`, MatchToString()))[dartx.replaceAll]("", ""); - let line = frame.line == null ? 0 : frame.line; - let column = frame.column == null ? 0 : frame.column; - return dart.str`${number}${member} (${frame.uri}:${line}:${column})\n`; - }, FrameToString()))[dartx.join](); - } - }; - src__vm_trace.VMTrace[dart.implements] = () => [core.StackTrace]; - dart.setSignature(src__vm_trace.VMTrace, { - constructors: () => ({new: dart.definiteFunctionType(src__vm_trace.VMTrace, [core.List$(src__frame.Frame)])}) - }); - stack_trace.ChainHandler = src__chain.ChainHandler; - stack_trace.Chain = src__chain.Chain; - stack_trace.Frame = src__frame.Frame; - stack_trace.Trace = src__trace.Trace; - stack_trace.UnparsedFrame = src__unparsed_frame.UnparsedFrame; - // Exports: - exports.src__chain = src__chain; - exports.src__frame = src__frame; - exports.src__lazy_trace = src__lazy_trace; - exports.src__stack_zone_specification = src__stack_zone_specification; - exports.src__trace = src__trace; - exports.src__unparsed_frame = src__unparsed_frame; - exports.src__utils = src__utils; - exports.src__vm_trace = src__vm_trace; - exports.stack_trace = stack_trace; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/unittest/unittest.js b/pkg/dev_compiler/test/codegen_expected/unittest/unittest.js deleted file mode 100644 index 3b124843a9d8..000000000000 --- a/pkg/dev_compiler/test/codegen_expected/unittest/unittest.js +++ /dev/null @@ -1,3740 +0,0 @@ -dart_library.library('unittest', null, /* Imports */[ - 'dart_sdk', - 'stack_trace' -], function load__unittest(exports, dart_sdk, stack_trace) { - 'use strict'; - const core = dart_sdk.core; - const collection = dart_sdk.collection; - const async = dart_sdk.async; - const _interceptors = dart_sdk._interceptors; - const isolate = dart_sdk.isolate; - const html = dart_sdk.html; - const convert = dart_sdk.convert; - const js = dart_sdk.js; - const dart = dart_sdk.dart; - const dartx = dart_sdk.dartx; - const src__trace = stack_trace.src__trace; - const src__frame = stack_trace.src__frame; - const unittest = Object.create(null); - const src__configuration = Object.create(null); - const src__simple_configuration = Object.create(null); - const src__matcher = Object.create(null); - const src__matcher__core_matchers = Object.create(null); - const src__matcher__description = Object.create(null); - const src__matcher__interfaces = Object.create(null); - const src__matcher__pretty_print = Object.create(null); - const src__matcher__util = Object.create(null); - const src__matcher__error_matchers = Object.create(null); - const src__matcher__expect = Object.create(null); - const src__matcher__future_matchers = Object.create(null); - const src__matcher__iterable_matchers = Object.create(null); - const src__matcher__map_matchers = Object.create(null); - const src__matcher__numeric_matchers = Object.create(null); - const src__matcher__operator_matchers = Object.create(null); - const src__matcher__prints_matcher = Object.create(null); - const src__matcher__string_matchers = Object.create(null); - const src__matcher__throws_matcher = Object.create(null); - const src__matcher__throws_matchers = Object.create(null); - const src__internal_test_case = Object.create(null); - const src__test_environment = Object.create(null); - const src__group_context = Object.create(null); - const src__utils = Object.create(null); - const src__test_case = Object.create(null); - const src__expected_function = Object.create(null); - const html_config = Object.create(null); - const html_individual_config = Object.create(null); - const html_enhanced_config = Object.create(null); - let UnmodifiableListViewOfTestCase = () => (UnmodifiableListViewOfTestCase = dart.constFn(collection.UnmodifiableListView$(src__test_case.TestCase)))(); - let VoidTobool = () => (VoidTobool = dart.constFn(dart.functionType(core.bool, [])))(); - let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void, [])))(); - let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))(); - let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(dart.functionType(core.bool, [dart.dynamic, dart.dynamic])))(); - let isInstanceOf = () => (isInstanceOf = dart.constFn(src__matcher__core_matchers.isInstanceOf$()))(); - let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.functionType(core.bool, [dart.dynamic])))(); - let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))(); - let PairOfString$StackTrace = () => (PairOfString$StackTrace = dart.constFn(src__utils.Pair$(core.String, core.StackTrace)))(); - let JSArrayOfPairOfString$StackTrace = () => (JSArrayOfPairOfString$StackTrace = dart.constFn(_interceptors.JSArray$(PairOfString$StackTrace())))(); - let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))(); - let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))(); - let ListOfMatcher = () => (ListOfMatcher = dart.constFn(core.List$(src__matcher__interfaces.Matcher)))(); - let ListOfInternalTestCase = () => (ListOfInternalTestCase = dart.constFn(core.List$(src__internal_test_case.InternalTestCase)))(); - let Pair = () => (Pair = dart.constFn(src__utils.Pair$()))(); - let ListOfTestCase = () => (ListOfTestCase = dart.constFn(core.List$(src__test_case.TestCase)))(); - let LinkedHashMapOfString$ListOfTestCase = () => (LinkedHashMapOfString$ListOfTestCase = dart.constFn(collection.LinkedHashMap$(core.String, ListOfTestCase())))(); - let StringTovoid = () => (StringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))(); - let StringAndTestFunctionTovoid = () => (StringAndTestFunctionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, unittest.TestFunction])))(); - let StringToString = () => (StringToString = dart.constFn(dart.definiteFunctionType(core.String, [core.String])))(); - let Function__ToFunction = () => (Function__ToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function], {count: core.int, max: core.int, id: core.String, reason: core.String})))(); - let FunctionAndFn__ToFunction = () => (FunctionAndFn__ToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function, VoidTobool()], {id: core.String, reason: core.String})))(); - let StringAndFnTovoid = () => (StringAndFnTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, VoidTovoid()])))(); - let FunctionTovoid = () => (FunctionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Function])))(); - let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [])))(); - let dynamicAndString__Tovoid = () => (dynamicAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.String], [dart.dynamic])))(); - let InternalTestCaseTobool = () => (InternalTestCaseTobool = dart.constFn(dart.definiteFunctionType(core.bool, [src__internal_test_case.InternalTestCase])))(); - let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic])))(); - let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))(); - let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); - let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); - let dynamic__ToFunction = () => (dynamic__ToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [dart.dynamic], [dart.dynamic])))(); - let boolTovoid = () => (boolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.bool])))(); - let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))(); - let int__Tovoid = () => (int__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int], {enable: core.bool})))(); - let FnTodynamic = () => (FnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic()])))(); - let __ToErrorFormatter = () => (__ToErrorFormatter = dart.constFn(dart.definiteFunctionType(src__matcher__expect.ErrorFormatter, [], [src__matcher__expect.ErrorFormatter])))(); - let dynamic__ToMatcher = () => (dynamic__ToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [dart.dynamic], [core.int])))(); - let IterableAndFnAndStringToMatcher = () => (IterableAndFnAndStringToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [core.Iterable, dynamicAnddynamicTobool(), core.String])))(); - let dynamicToMatcher = () => (dynamicToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [dart.dynamic])))(); - let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], {reason: core.String, failureHandler: src__matcher__expect.FailureHandler, verbose: core.bool})))(); - let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {failureHandler: src__matcher__expect.FailureHandler})))(); - let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))(); - let numAndnumToMatcher = () => (numAndnumToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [core.num, core.num])))(); - let StringToMatcher = () => (StringToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [core.String])))(); - let IterableToMatcher = () => (IterableToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [core.Iterable])))(); - let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Match])))(); - let Function__ToFunction$ = () => (Function__ToFunction$ = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function], [dart.dynamic])))(); - let Fn__ToMatcher = () => (Fn__ToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [dynamicTobool()], [core.String])))(); - let MapAndMapTovoid = () => (MapAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Map, core.Map])))(); - let dynamic__ToMatcher$ = () => (dynamic__ToMatcher$ = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [dart.dynamic], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))(); - let VoidToFailureHandler = () => (VoidToFailureHandler = dart.constFn(dart.definiteFunctionType(src__matcher__expect.FailureHandler, [])))(); - let __Tovoid = () => (__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [], [src__matcher__expect.FailureHandler])))(); - let dynamic__ToMatcher$0 = () => (dynamic__ToMatcher$0 = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [dart.dynamic], [core.String])))(); - let dynamicAnddynamicToMatcher = () => (dynamicAnddynamicToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [dart.dynamic, dart.dynamic])))(); - let ListOfStringToMatcher = () => (ListOfStringToMatcher = dart.constFn(dart.definiteFunctionType(src__matcher__interfaces.Matcher, [ListOfString()])))(); - let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))(); - let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))(); - let dynamicAndintAndSet__ToString = () => (dynamicAndintAndSet__ToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, core.int, core.Set, core.bool])))(); - let dynamic__ToString = () => (dynamic__ToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic], {maxLineLength: core.int, maxItems: core.int})))(); - let intToString = () => (intToString = dart.constFn(dart.definiteFunctionType(core.String, [core.int])))(); - let dynamicAndMatcherAndString__ToString = () => (dynamicAndMatcherAndString__ToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, src__matcher__interfaces.Matcher, core.String, core.Map, core.bool])))(); - let dynamicAnddynamicAnddynamic__ToListOfMatcher = () => (dynamicAnddynamicAnddynamic__ToListOfMatcher = dart.constFn(dart.definiteFunctionType(ListOfMatcher(), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))(); - let ZoneAndZoneDelegateAndZone__Tovoid = () => (ZoneAndZoneDelegateAndZone__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.Zone, async.ZoneDelegate, async.Zone, core.String])))(); - let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))(); - let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))(); - let FrameTobool = () => (FrameTobool = dart.constFn(dart.definiteFunctionType(core.bool, [src__frame.Frame])))(); - let dynamicAndboolAndboolToTrace = () => (dynamicAndboolAndboolToTrace = dart.constFn(dart.definiteFunctionType(src__trace.Trace, [dart.dynamic, core.bool, core.bool])))(); - let EventTovoid = () => (EventTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Event])))(); - let intAndintAndint__Tovoid = () => (intAndintAndint__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int, ListOfTestCase(), core.bool, core.String])))(); - let TestCaseToString = () => (TestCaseToString = dart.constFn(dart.definiteFunctionType(core.String, [src__test_case.TestCase])))(); - let MessageEventTovoid = () => (MessageEventTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.MessageEvent])))(); - let __Tovoid$ = () => (__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [], [core.bool])))(); - let TestCaseTobool = () => (TestCaseTobool = dart.constFn(dart.definiteFunctionType(core.bool, [src__test_case.TestCase])))(); - let ElementToString = () => (ElementToString = dart.constFn(dart.definiteFunctionType(core.String, [html.Element])))(); - let MouseEventTovoid = () => (MouseEventTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.MouseEvent])))(); - let TestCaseAndTestCaseToint = () => (TestCaseAndTestCaseToint = dart.constFn(dart.definiteFunctionType(core.int, [src__test_case.TestCase, src__test_case.TestCase])))(); - let ListOfTestCaseTovoid = () => (ListOfTestCaseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfTestCase()])))(); - let dynamicAnddynamicAnddynamicTodynamic = () => (dynamicAnddynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic])))(); - unittest.TestFunction = dart.typedef('TestFunction', () => dart.functionType(dart.dynamic, [])); - dart.copyProperties(unittest, { - get unittestConfiguration() { - if (src__test_environment.config == null) src__test_environment.environment.config = src__configuration.Configuration.new(); - return src__test_environment.config; - }, - set unittestConfiguration(value) { - if (core.identical(src__test_environment.config, value)) return; - if (src__test_environment.config != null) { - unittest.logMessage('Warning: The unittestConfiguration has already been set. New ' + 'unittestConfiguration ignored.'); - } else { - src__test_environment.environment.config = value; - } - } - }); - unittest.formatStacks = true; - unittest.filterStacks = true; - unittest.groupSep = ' '; - unittest.logMessage = function(message) { - return src__test_environment.config.onLogMessage(unittest.currentTestCase, message); - }; - dart.fn(unittest.logMessage, StringTovoid()); - dart.copyProperties(unittest, { - get testCases() { - return new (UnmodifiableListViewOfTestCase())(src__test_environment.environment.testCases); - } - }); - unittest.BREATH_INTERVAL = 200; - dart.copyProperties(unittest, { - get currentTestCase() { - return dart.notNull(src__test_environment.environment.currentTestCaseIndex) >= 0 && dart.notNull(src__test_environment.environment.currentTestCaseIndex) < dart.notNull(unittest.testCases[dartx.length]) ? unittest.testCases[dartx.get](src__test_environment.environment.currentTestCaseIndex) : null; - } - }); - dart.copyProperties(unittest, { - get _currentTestCase() { - return src__internal_test_case.InternalTestCase.as(unittest.currentTestCase); - } - }); - unittest.PASS = 'pass'; - unittest.FAIL = 'fail'; - unittest.ERROR = 'error'; - unittest.test = function(description, body) { - unittest._requireNotRunning(); - unittest.ensureInitialized(); - if (dart.test(src__test_environment.environment.soloTestSeen) && src__test_environment.environment.soloNestingLevel == 0) return; - let testCase = new src__internal_test_case.InternalTestCase(dart.notNull(unittest.testCases[dartx.length]) + 1, unittest._fullDescription(description), body); - src__test_environment.environment.testCases[dartx.add](testCase); - }; - dart.fn(unittest.test, StringAndTestFunctionTovoid()); - unittest._fullDescription = function(description) { - let group = src__test_environment.environment.currentContext.fullName; - if (description == null) return group; - return group != '' ? dart.str`${group}${unittest.groupSep}${description}` : description; - }; - dart.fn(unittest._fullDescription, StringToString()); - unittest.skip_test = function(spec, body) { - }; - dart.fn(unittest.skip_test, StringAndTestFunctionTovoid()); - unittest.solo_test = function(spec, body) { - unittest._requireNotRunning(); - unittest.ensureInitialized(); - if (!dart.test(src__test_environment.environment.soloTestSeen)) { - src__test_environment.environment.soloTestSeen = true; - src__test_environment.environment.testCases[dartx.clear](); - } - let o = src__test_environment.environment; - o.soloNestingLevel = dart.notNull(o.soloNestingLevel) + 1; - try { - unittest.test(spec, body); - } finally { - let o$ = src__test_environment.environment; - o$.soloNestingLevel = dart.notNull(o$.soloNestingLevel) - 1; - } - }; - dart.fn(unittest.solo_test, StringAndTestFunctionTovoid()); - unittest.expectAsync = function(callback, opts) { - let count = opts && 'count' in opts ? opts.count : 1; - let max = opts && 'max' in opts ? opts.max : 0; - let id = opts && 'id' in opts ? opts.id : null; - let reason = opts && 'reason' in opts ? opts.reason : null; - return new src__expected_function.ExpectedFunction(callback, count, max, {id: id, reason: reason}).func; - }; - dart.fn(unittest.expectAsync, Function__ToFunction()); - unittest.expectAsyncUntil = function(callback, isDone, opts) { - let id = opts && 'id' in opts ? opts.id : null; - let reason = opts && 'reason' in opts ? opts.reason : null; - return new src__expected_function.ExpectedFunction(callback, 0, -1, {id: id, reason: reason, isDone: isDone}).func; - }; - dart.fn(unittest.expectAsyncUntil, FunctionAndFn__ToFunction()); - unittest.group = function(description, body) { - unittest.ensureInitialized(); - unittest._requireNotRunning(); - src__test_environment.environment.currentContext = new src__group_context.GroupContext(src__test_environment.environment.currentContext, description); - try { - body(); - } catch (e) { - let trace = dart.stackTrace(e); - let stack = trace == null ? '' : dart.str`: ${trace.toString()}`; - src__test_environment.environment.uncaughtErrorMessage = dart.str`${dart.toString(e)}${stack}`; - } - finally { - src__test_environment.environment.currentContext = src__test_environment.environment.currentContext.parent; - } - }; - dart.fn(unittest.group, StringAndFnTovoid()); - unittest.skip_group = function(description, body) { - }; - dart.fn(unittest.skip_group, StringAndFnTovoid()); - unittest.solo_group = function(description, body) { - unittest._requireNotRunning(); - unittest.ensureInitialized(); - if (!dart.test(src__test_environment.environment.soloTestSeen)) { - src__test_environment.environment.soloTestSeen = true; - src__test_environment.environment.testCases[dartx.clear](); - } - let o = src__test_environment.environment; - o.soloNestingLevel = dart.notNull(o.soloNestingLevel) + 1; - try { - unittest.group(description, body); - } finally { - let o$ = src__test_environment.environment; - o$.soloNestingLevel = dart.notNull(o$.soloNestingLevel) - 1; - } - }; - dart.fn(unittest.solo_group, StringAndFnTovoid()); - unittest.setUp = function(callback) { - unittest._requireNotRunning(); - src__test_environment.environment.currentContext.testSetUp = callback; - }; - dart.fn(unittest.setUp, FunctionTovoid()); - unittest.tearDown = function(callback) { - unittest._requireNotRunning(); - src__test_environment.environment.currentContext.testTearDown = callback; - }; - dart.fn(unittest.tearDown, FunctionTovoid()); - unittest._nextTestCase = function() { - let o = src__test_environment.environment; - o.currentTestCaseIndex = dart.notNull(o.currentTestCaseIndex) + 1; - unittest._runTest(); - }; - dart.fn(unittest._nextTestCase, VoidTovoid$()); - unittest.handleExternalError = function(e, message, stackTrace) { - if (stackTrace === void 0) stackTrace = null; - let msg = dart.str`${message}\nCaught ${e}`; - if (unittest.currentTestCase != null) { - unittest._currentTestCase.error(msg, core.StackTrace._check(stackTrace)); - } else { - src__test_environment.environment.uncaughtErrorMessage = dart.str`${msg}: ${stackTrace}`; - } - }; - dart.fn(unittest.handleExternalError, dynamicAndString__Tovoid()); - unittest._TestFilter = dart.typedef('_TestFilter', () => dart.functionType(core.bool, [src__internal_test_case.InternalTestCase])); - unittest.filterTests = function(testFilter) { - let filterFunction = null; - if (typeof testFilter == 'string') { - let re = core.RegExp.new(testFilter); - filterFunction = dart.fn(t => re.hasMatch(t.description), InternalTestCaseTobool()); - } else if (core.RegExp.is(testFilter)) { - filterFunction = dart.fn(t => testFilter.hasMatch(t.description), InternalTestCaseTobool()); - } else if (unittest._TestFilter.is(testFilter)) { - filterFunction = testFilter; - } - src__test_environment.environment.testCases[dartx.retainWhere](filterFunction); - }; - dart.fn(unittest.filterTests, dynamicTovoid()); - unittest.runTests = function() { - unittest._requireNotRunning(); - unittest._ensureInitialized(false); - src__test_environment.environment.currentTestCaseIndex = 0; - src__test_environment.config.onStart(); - unittest._runTest(); - }; - dart.fn(unittest.runTests, VoidTovoid$()); - unittest.registerException = function(error, stackTrace) { - if (stackTrace === void 0) stackTrace = null; - return unittest._currentTestCase.registerException(error, stackTrace); - }; - dart.fn(unittest.registerException, dynamic__Tovoid()); - unittest._runTest = function() { - if (dart.notNull(src__test_environment.environment.currentTestCaseIndex) >= dart.notNull(unittest.testCases[dartx.length])) { - dart.assert(src__test_environment.environment.currentTestCaseIndex == unittest.testCases[dartx.length]); - unittest._completeTests(); - return; - } - let testCase = unittest._currentTestCase; - let f = async.runZoned(async.Future)(dart.bind(testCase, 'run'), {onError: dart.fn((error, stack) => { - testCase.registerException(error, core.StackTrace._check(stack)); - }, dynamicAnddynamicTodynamic())}); - let timer = null; - let timeout = unittest.unittestConfiguration.timeout; - if (timeout != null) { - try { - timer = async.Timer.new(timeout, dart.fn(() => { - testCase.error(dart.str`Test timed out after ${timeout.inSeconds} seconds.`); - unittest._nextTestCase(); - }, VoidTovoid$())); - } catch (e) { - if (core.UnsupportedError.is(e)) { - if (e.message != "Timer greater than 0.") throw e; - } else - throw e; - } - - } - f.whenComplete(dart.fn(() => { - if (timer != null) dart.dsend(timer, 'cancel'); - let now = new core.DateTime.now().millisecondsSinceEpoch; - if (dart.notNull(now) - dart.notNull(src__test_environment.environment.lastBreath) >= unittest.BREATH_INTERVAL) { - src__test_environment.environment.lastBreath = now; - async.Timer.run(unittest._nextTestCase); - } else { - async.scheduleMicrotask(unittest._nextTestCase); - } - }, VoidTodynamic$())); - }; - dart.fn(unittest._runTest, VoidTovoid$()); - unittest._completeTests = function() { - if (!dart.test(src__test_environment.environment.initialized)) return; - let passed = 0; - let failed = 0; - let errors = 0; - for (let testCase of unittest.testCases) { - switch (testCase.result) { - case unittest.PASS: - { - passed++; - break; - } - case unittest.FAIL: - { - failed++; - break; - } - case unittest.ERROR: - { - errors++; - break; - } - } - } - src__test_environment.config.onSummary(passed, failed, errors, unittest.testCases, src__test_environment.environment.uncaughtErrorMessage); - src__test_environment.config.onDone(passed > 0 && failed == 0 && errors == 0 && src__test_environment.environment.uncaughtErrorMessage == null); - src__test_environment.environment.initialized = false; - src__test_environment.environment.currentTestCaseIndex = -1; - }; - dart.fn(unittest._completeTests, VoidTovoid$()); - unittest.ensureInitialized = function() { - unittest._ensureInitialized(true); - }; - dart.fn(unittest.ensureInitialized, VoidTovoid$()); - unittest._ensureInitialized = function(configAutoStart) { - if (dart.test(src__test_environment.environment.initialized)) return; - src__test_environment.environment.initialized = true; - src__matcher__expect.wrapAsync = dart.fn((f, id) => { - if (id === void 0) id = null; - return unittest.expectAsync(core.Function._check(f), {id: core.String._check(id)}); - }, dynamic__ToFunction()); - src__test_environment.environment.uncaughtErrorMessage = null; - unittest.unittestConfiguration.onInit(); - if (dart.test(configAutoStart) && dart.test(src__test_environment.config.autoStart)) async.scheduleMicrotask(unittest.runTests); - }; - dart.fn(unittest._ensureInitialized, boolTovoid()); - unittest.setSoloTest = function(id) { - return src__test_environment.environment.testCases[dartx.retainWhere](dart.fn(t => t.id == id, InternalTestCaseTobool())); - }; - dart.fn(unittest.setSoloTest, intTovoid()); - unittest.enableTest = function(id) { - return unittest._setTestEnabledState(id, {enable: true}); - }; - dart.fn(unittest.enableTest, intTovoid()); - unittest.disableTest = function(id) { - return unittest._setTestEnabledState(id, {enable: false}); - }; - dart.fn(unittest.disableTest, intTovoid()); - unittest._setTestEnabledState = function(id, opts) { - let enable = opts && 'enable' in opts ? opts.enable : true; - if (dart.notNull(unittest.testCases[dartx.length]) > dart.notNull(id) && unittest.testCases[dartx.get](id).id == id) { - src__test_environment.environment.testCases[dartx.get](id).enabled = enable; - } else { - for (let i = 0; i < dart.notNull(unittest.testCases[dartx.length]); i++) { - if (unittest.testCases[dartx.get](i).id != id) continue; - src__test_environment.environment.testCases[dartx.get](i).enabled = enable; - break; - } - } - }; - dart.fn(unittest._setTestEnabledState, int__Tovoid()); - unittest._requireNotRunning = function() { - if (src__test_environment.environment.currentTestCaseIndex == -1) return; - dart.throw(new core.StateError('Not allowed when tests are running.')); - }; - dart.fn(unittest._requireNotRunning, VoidTovoid$()); - let const$; - unittest.withTestEnvironment = function(callback) { - return async.runZoned(dart.dynamic)(callback, {zoneValues: dart.map([const$ || (const$ = dart.const(core.Symbol.new('unittest.environment'))), new src__test_environment.TestEnvironment()], core.Symbol, src__test_environment.TestEnvironment)}); - }; - dart.fn(unittest.withTestEnvironment, FnTodynamic()); - let const$0; - src__configuration.Configuration = class Configuration extends core.Object { - static new() { - return new src__simple_configuration.SimpleConfiguration(); - } - blank() { - this.autoStart = true; - this.timeout = const$0 || (const$0 = dart.const(new core.Duration({minutes: 2}))); - } - onInit() {} - onStart() {} - onTestStart(testCase) {} - onTestResult(testCase) {} - onTestResultChanged(testCase) {} - onLogMessage(testCase, message) {} - onDone(success) {} - onSummary(passed, failed, errors, results, uncaughtError) {} - }; - dart.defineNamedConstructor(src__configuration.Configuration, 'blank'); - dart.setSignature(src__configuration.Configuration, { - constructors: () => ({ - new: dart.definiteFunctionType(src__configuration.Configuration, []), - blank: dart.definiteFunctionType(src__configuration.Configuration, []) - }), - methods: () => ({ - onInit: dart.definiteFunctionType(dart.void, []), - onStart: dart.definiteFunctionType(dart.void, []), - onTestStart: dart.definiteFunctionType(dart.void, [src__test_case.TestCase]), - onTestResult: dart.definiteFunctionType(dart.void, [src__test_case.TestCase]), - onTestResultChanged: dart.definiteFunctionType(dart.void, [src__test_case.TestCase]), - onLogMessage: dart.definiteFunctionType(dart.void, [src__test_case.TestCase, core.String]), - onDone: dart.definiteFunctionType(dart.void, [core.bool]), - onSummary: dart.definiteFunctionType(dart.void, [core.int, core.int, core.int, core.List$(src__test_case.TestCase), core.String]) - }) - }); - unittest.Configuration = src__configuration.Configuration; - src__matcher__expect.configureExpectFormatter = function(formatter) { - if (formatter === void 0) formatter = null; - if (formatter == null) { - formatter = src__matcher__expect._defaultErrorFormatter; - } - return src__matcher__expect._assertErrorFormatter = formatter; - }; - dart.lazyFn(src__matcher__expect.configureExpectFormatter, () => __ToErrorFormatter()); - unittest.configureExpectFormatter = src__matcher__expect.configureExpectFormatter; - const _name = Symbol('_name'); - src__matcher__interfaces.Matcher = class Matcher extends core.Object { - new() { - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - return mismatchDescription; - } - }; - dart.setSignature(src__matcher__interfaces.Matcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__interfaces.Matcher, [])}), - methods: () => ({describeMismatch: dart.definiteFunctionType(src__matcher__interfaces.Description, [dart.dynamic, src__matcher__interfaces.Description, core.Map, core.bool])}) - }); - src__matcher__core_matchers.TypeMatcher = class TypeMatcher extends src__matcher__interfaces.Matcher { - new(name) { - this[_name] = name; - super.new(); - } - describe(description) { - return description.add(this[_name]); - } - }; - dart.setSignature(src__matcher__core_matchers.TypeMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers.TypeMatcher, [core.String])}), - methods: () => ({describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description])}) - }); - src__matcher__error_matchers._RangeError = class _RangeError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("RangeError"); - } - matches(item, matchState) { - return core.RangeError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._RangeError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._RangeError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isRangeError = dart.const(new src__matcher__error_matchers._RangeError()); - unittest.isRangeError = src__matcher__error_matchers.isRangeError; - src__matcher__error_matchers._StateError = class _StateError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("StateError"); - } - matches(item, matchState) { - return core.StateError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._StateError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._StateError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isStateError = dart.const(new src__matcher__error_matchers._StateError()); - unittest.isStateError = src__matcher__error_matchers.isStateError; - src__matcher__core_matchers.equals = function(expected, limit) { - if (limit === void 0) limit = 100; - return typeof expected == 'string' ? new src__matcher__core_matchers._StringEqualsMatcher(expected) : new src__matcher__core_matchers._DeepMatcher(expected, limit); - }; - dart.fn(src__matcher__core_matchers.equals, dynamic__ToMatcher()); - unittest.equals = src__matcher__core_matchers.equals; - const _featureDescription = Symbol('_featureDescription'); - const _featureName = Symbol('_featureName'); - const _matcher = Symbol('_matcher'); - src__matcher__core_matchers.CustomMatcher = class CustomMatcher extends src__matcher__interfaces.Matcher { - new(featureDescription, featureName, matcher) { - this[_featureDescription] = featureDescription; - this[_featureName] = featureName; - this[_matcher] = src__matcher__util.wrapMatcher(matcher); - super.new(); - } - featureValueOf(actual) { - return actual; - } - matches(item, matchState) { - let f = this.featureValueOf(item); - if (dart.test(this[_matcher].matches(f, matchState))) return true; - src__matcher__util.addStateInfo(matchState, dart.map({feature: f}, core.String, dart.dynamic)); - return false; - } - describe(description) { - return description.add(this[_featureDescription]).add(' ').addDescriptionOf(this[_matcher]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - mismatchDescription.add('has ').add(this[_featureName]).add(' with value ').addDescriptionOf(matchState[dartx.get]('feature')); - let innerDescription = new src__matcher__description.StringDescription(); - this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDescription, core.Map._check(matchState[dartx.get]('state')), verbose); - if (dart.notNull(innerDescription.length) > 0) { - mismatchDescription.add(' which ').add(innerDescription.toString()); - } - return mismatchDescription; - } - }; - dart.setSignature(src__matcher__core_matchers.CustomMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers.CustomMatcher, [core.String, core.String, dart.dynamic])}), - methods: () => ({ - featureValueOf: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]), - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - unittest.CustomMatcher = src__matcher__core_matchers.CustomMatcher; - src__matcher__iterable_matchers.pairwiseCompare = function(expected, comparator, description) { - return new src__matcher__iterable_matchers._PairwiseCompare(expected, comparator, description); - }; - dart.fn(src__matcher__iterable_matchers.pairwiseCompare, IterableAndFnAndStringToMatcher()); - unittest.pairwiseCompare = src__matcher__iterable_matchers.pairwiseCompare; - src__matcher__error_matchers._UnimplementedError = class _UnimplementedError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("UnimplementedError"); - } - matches(item, matchState) { - return core.UnimplementedError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._UnimplementedError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._UnimplementedError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isUnimplementedError = dart.const(new src__matcher__error_matchers._UnimplementedError()); - unittest.isUnimplementedError = src__matcher__error_matchers.isUnimplementedError; - src__matcher__core_matchers.hasLength = function(matcher) { - return new src__matcher__core_matchers._HasLength(src__matcher__util.wrapMatcher(matcher)); - }; - dart.fn(src__matcher__core_matchers.hasLength, dynamicToMatcher()); - unittest.hasLength = src__matcher__core_matchers.hasLength; - src__matcher__expect.expect = function(actual, matcher, opts) { - let reason = opts && 'reason' in opts ? opts.reason : null; - let failureHandler = opts && 'failureHandler' in opts ? opts.failureHandler : null; - let verbose = opts && 'verbose' in opts ? opts.verbose : false; - matcher = src__matcher__util.wrapMatcher(matcher); - let doesMatch = null; - let matchState = dart.map(); - try { - doesMatch = core.bool._check(dart.dsend(matcher, 'matches', actual, matchState)); - } catch (e) { - let trace = dart.stackTrace(e); - doesMatch = false; - if (reason == null) { - reason = dart.str`${typeof e == 'string' ? e : dart.toString(e)} at ${trace}`; - } - } - - if (!dart.test(doesMatch)) { - if (failureHandler == null) { - failureHandler = src__matcher__expect.getOrCreateExpectFailureHandler(); - } - failureHandler.failMatch(actual, src__matcher__interfaces.Matcher._check(matcher), reason, matchState, verbose); - } - }; - dart.lazyFn(src__matcher__expect.expect, () => dynamicAnddynamic__Tovoid()); - unittest.expect = src__matcher__expect.expect; - const _out = Symbol('_out'); - src__matcher__description.StringDescription = class StringDescription extends core.Object { - new(init) { - if (init === void 0) init = ''; - this[_out] = new core.StringBuffer(); - this[_out].write(init); - } - get length() { - return this[_out].length; - } - toString() { - return dart.toString(this[_out]); - } - add(text) { - this[_out].write(text); - return this; - } - replace(text) { - this[_out].clear(); - return this.add(text); - } - addDescriptionOf(value) { - if (src__matcher__interfaces.Matcher.is(value)) { - value.describe(this); - } else { - this.add(src__matcher__pretty_print.prettyPrint(value, {maxLineLength: 80, maxItems: 25})); - } - return this; - } - addAll(start, separator, end, list) { - let separate = false; - this.add(start); - for (let item of list) { - if (separate) { - this.add(separator); - } - this.addDescriptionOf(item); - separate = true; - } - this.add(end); - return this; - } - }; - src__matcher__description.StringDescription[dart.implements] = () => [src__matcher__interfaces.Description]; - dart.setSignature(src__matcher__description.StringDescription, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__description.StringDescription, [], [core.String])}), - methods: () => ({ - add: dart.definiteFunctionType(src__matcher__interfaces.Description, [core.String]), - replace: dart.definiteFunctionType(src__matcher__interfaces.Description, [core.String]), - addDescriptionOf: dart.definiteFunctionType(src__matcher__interfaces.Description, [dart.dynamic]), - addAll: dart.definiteFunctionType(src__matcher__interfaces.Description, [core.String, core.String, core.String, core.Iterable]) - }) - }); - unittest.StringDescription = src__matcher__description.StringDescription; - src__matcher__expect.fail = function(message, opts) { - let failureHandler = opts && 'failureHandler' in opts ? opts.failureHandler : null; - if (failureHandler == null) { - failureHandler = src__matcher__expect.getOrCreateExpectFailureHandler(); - } - failureHandler.fail(message); - }; - dart.lazyFn(src__matcher__expect.fail, () => String__Tovoid()); - unittest.fail = src__matcher__expect.fail; - src__matcher__core_matchers._IsNaN = class _IsNaN extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.double.NAN[dartx.compareTo](core.num._check(item)) == 0; - } - describe(description) { - return description.add('NaN'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsNaN, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsNaN, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isNaN = dart.const(new src__matcher__core_matchers._IsNaN()); - unittest.isNaN = src__matcher__core_matchers.isNaN; - src__matcher__core_matchers.isInstanceOf$ = dart.generic(T => { - class isInstanceOf extends src__matcher__interfaces.Matcher { - new(name) { - if (name === void 0) name = null; - super.new(); - } - matches(obj, matchState) { - return T.is(obj); - } - describe(description) { - return description.add(dart.str`an instance of ${dart.wrapType(T)}`); - } - } - dart.addTypeTests(isInstanceOf); - dart.setSignature(isInstanceOf, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers.isInstanceOf$(T), [], [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - return isInstanceOf; - }); - src__matcher__core_matchers.isInstanceOf = isInstanceOf(); - unittest.isInstanceOf$ = src__matcher__core_matchers.isInstanceOf$; - unittest.isInstanceOf = src__matcher__core_matchers.isInstanceOf; - const _matcher$ = Symbol('_matcher'); - src__matcher__throws_matcher.Throws = class Throws extends src__matcher__interfaces.Matcher { - new(matcher) { - if (matcher === void 0) matcher = null; - this[_matcher$] = matcher; - super.new(); - } - matches(item, matchState) { - if (!core.Function.is(item) && !async.Future.is(item)) return false; - if (async.Future.is(item)) { - let done = dart.dcall(src__matcher__expect.wrapAsync, dart.fn(fn => dart.dcall(fn), dynamicTodynamic())); - item.then(dart.dynamic)(dart.fn(value => { - dart.dcall(done, dart.fn(() => { - src__matcher__expect.fail(dart.str`Expected future to fail, but succeeded with '${value}'.`); - }, VoidTodynamic$())); - }, dynamicTodynamic()), {onError: dart.fn((error, trace) => { - dart.dcall(done, dart.fn(() => { - if (this[_matcher$] == null) return; - let reason = null; - if (trace != null) { - let stackTrace = dart.toString(trace); - stackTrace = dart.str` ${stackTrace[dartx.replaceAll]("\n", "\n ")}`; - reason = dart.str`Actual exception trace:\n${stackTrace}`; - } - src__matcher__expect.expect(error, this[_matcher$], {reason: core.String._check(reason)}); - }, VoidTodynamic$())); - }, dynamicAnddynamicTodynamic())}); - return true; - } - try { - dart.dcall(item); - return false; - } catch (e) { - let s = dart.stackTrace(e); - if (this[_matcher$] == null || dart.test(this[_matcher$].matches(e, matchState))) { - return true; - } else { - src__matcher__util.addStateInfo(matchState, dart.map({exception: e, stack: s}, core.String, dart.dynamic)); - return false; - } - } - - } - describe(description) { - if (this[_matcher$] == null) { - return description.add("throws"); - } else { - return description.add('throws ').addDescriptionOf(this[_matcher$]); - } - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Function.is(item) && !async.Future.is(item)) { - return mismatchDescription.add('is not a Function or Future'); - } else if (this[_matcher$] == null || matchState[dartx.get]('exception') == null) { - return mismatchDescription.add('did not throw'); - } else { - mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('exception')); - if (dart.test(verbose)) { - mismatchDescription.add(' at ').add(dart.toString(matchState[dartx.get]('stack'))); - } - return mismatchDescription; - } - } - }; - dart.setSignature(src__matcher__throws_matcher.Throws, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__throws_matcher.Throws, [], [src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__error_matchers._CyclicInitializationError = class _CyclicInitializationError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("CyclicInitializationError"); - } - matches(item, matchState) { - return core.CyclicInitializationError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._CyclicInitializationError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._CyclicInitializationError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isCyclicInitializationError = dart.const(new src__matcher__error_matchers._CyclicInitializationError()); - src__matcher__throws_matchers.throwsCyclicInitializationError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isCyclicInitializationError)); - unittest.throwsCyclicInitializationError = src__matcher__throws_matchers.throwsCyclicInitializationError; - const _matcher$0 = Symbol('_matcher'); - const _id = Symbol('_id'); - src__matcher__future_matchers._Completes = class _Completes extends src__matcher__interfaces.Matcher { - new(matcher, id) { - this[_matcher$0] = matcher; - this[_id] = id; - super.new(); - } - matches(item, matchState) { - if (!async.Future.is(item)) return false; - let done = dart.dcall(src__matcher__expect.wrapAsync, dart.fn(fn => dart.dcall(fn), dynamicTodynamic()), this[_id]); - dart.dsend(item, 'then', dart.fn(value => { - dart.dcall(done, dart.fn(() => { - if (this[_matcher$0] != null) src__matcher__expect.expect(value, this[_matcher$0]); - }, VoidTodynamic$())); - }, dynamicTodynamic()), {onError: dart.fn((error, trace) => { - let id = this[_id] == '' ? '' : dart.str`${this[_id]} `; - let reason = dart.str`Expected future ${id}to complete successfully, ` + dart.str`but it failed with ${error}`; - if (trace != null) { - let stackTrace = dart.toString(trace); - stackTrace = dart.str` ${stackTrace[dartx.replaceAll]('\n', '\n ')}`; - reason = dart.str`${reason}\nStack trace:\n${stackTrace}`; - } - dart.dcall(done, dart.fn(() => src__matcher__expect.fail(reason), VoidTovoid$())); - }, dynamicAnddynamicTodynamic())}); - return true; - } - describe(description) { - if (this[_matcher$0] == null) { - description.add('completes successfully'); - } else { - description.add('completes to a value that ').addDescriptionOf(this[_matcher$0]); - } - return description; - } - }; - dart.setSignature(src__matcher__future_matchers._Completes, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__future_matchers._Completes, [src__matcher__interfaces.Matcher, core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__future_matchers.completes = dart.const(new src__matcher__future_matchers._Completes(null, '')); - unittest.completes = src__matcher__future_matchers.completes; - src__matcher__core_matchers._NotEmpty = class _NotEmpty extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dload(item, 'isNotEmpty')); - } - describe(description) { - return description.add('non-empty'); - } - }; - dart.setSignature(src__matcher__core_matchers._NotEmpty, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._NotEmpty, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isNotEmpty = dart.const(new src__matcher__core_matchers._NotEmpty()); - unittest.isNotEmpty = src__matcher__core_matchers.isNotEmpty; - src__matcher__error_matchers._ConcurrentModificationError = class _ConcurrentModificationError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("ConcurrentModificationError"); - } - matches(item, matchState) { - return core.ConcurrentModificationError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._ConcurrentModificationError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._ConcurrentModificationError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isConcurrentModificationError = dart.const(new src__matcher__error_matchers._ConcurrentModificationError()); - unittest.isConcurrentModificationError = src__matcher__error_matchers.isConcurrentModificationError; - src__matcher__throws_matcher.throwsA = function(matcher) { - return new src__matcher__throws_matcher.Throws(src__matcher__util.wrapMatcher(matcher)); - }; - dart.fn(src__matcher__throws_matcher.throwsA, dynamicToMatcher()); - unittest.throwsA = src__matcher__throws_matcher.throwsA; - src__matcher__core_matchers._IsTrue = class _IsTrue extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return dart.equals(item, true); - } - describe(description) { - return description.add('true'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsTrue, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsTrue, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isTrue = dart.const(new src__matcher__core_matchers._IsTrue()); - unittest.isTrue = src__matcher__core_matchers.isTrue; - src__matcher__throws_matchers.throwsRangeError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isRangeError)); - unittest.throwsRangeError = src__matcher__throws_matchers.throwsRangeError; - src__matcher__expect.ErrorFormatter = dart.typedef('ErrorFormatter', () => dart.functionType(core.String, [dart.dynamic, src__matcher__interfaces.Matcher, core.String, core.Map, core.bool])); - unittest.ErrorFormatter = src__matcher__expect.ErrorFormatter; - src__matcher__error_matchers._FormatException = class _FormatException extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("FormatException"); - } - matches(item, matchState) { - return core.FormatException.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._FormatException, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._FormatException, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isFormatException = dart.const(new src__matcher__error_matchers._FormatException()); - src__matcher__throws_matchers.throwsFormatException = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isFormatException)); - unittest.throwsFormatException = src__matcher__throws_matchers.throwsFormatException; - src__matcher__core_matchers._ReturnsNormally = class _ReturnsNormally extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(f, matchState) { - try { - dart.dcall(f); - return true; - } catch (e) { - let s = dart.stackTrace(e); - src__matcher__util.addStateInfo(matchState, dart.map({exception: e, stack: s}, core.String, dart.dynamic)); - return false; - } - - } - describe(description) { - return description.add("return normally"); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('exception')); - if (dart.test(verbose)) { - mismatchDescription.add(' at ').add(dart.toString(matchState[dartx.get]('stack'))); - } - return mismatchDescription; - } - }; - dart.setSignature(src__matcher__core_matchers._ReturnsNormally, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._ReturnsNormally, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.returnsNormally = dart.const(new src__matcher__core_matchers._ReturnsNormally()); - unittest.returnsNormally = src__matcher__core_matchers.returnsNormally; - src__matcher__numeric_matchers.inExclusiveRange = function(low, high) { - return new src__matcher__numeric_matchers._InRange(low, high, false, false); - }; - dart.fn(src__matcher__numeric_matchers.inExclusiveRange, numAndnumToMatcher()); - unittest.inExclusiveRange = src__matcher__numeric_matchers.inExclusiveRange; - src__matcher__core_matchers.isIn = function(expected) { - return new src__matcher__core_matchers._In(expected); - }; - dart.fn(src__matcher__core_matchers.isIn, dynamicToMatcher()); - unittest.isIn = src__matcher__core_matchers.isIn; - src__matcher__string_matchers.equalsIgnoringWhitespace = function(value) { - return new src__matcher__string_matchers._IsEqualIgnoringWhitespace(value); - }; - dart.fn(src__matcher__string_matchers.equalsIgnoringWhitespace, StringToMatcher()); - unittest.equalsIgnoringWhitespace = src__matcher__string_matchers.equalsIgnoringWhitespace; - src__matcher__string_matchers.startsWith = function(prefixString) { - return new src__matcher__string_matchers._StringStartsWith(prefixString); - }; - dart.fn(src__matcher__string_matchers.startsWith, StringToMatcher()); - unittest.startsWith = src__matcher__string_matchers.startsWith; - src__matcher__iterable_matchers.unorderedMatches = function(expected) { - return new src__matcher__iterable_matchers._UnorderedMatches(expected); - }; - dart.fn(src__matcher__iterable_matchers.unorderedMatches, IterableToMatcher()); - unittest.unorderedMatches = src__matcher__iterable_matchers.unorderedMatches; - const _value = Symbol('_value'); - const _equalValue = Symbol('_equalValue'); - const _lessThanValue = Symbol('_lessThanValue'); - const _greaterThanValue = Symbol('_greaterThanValue'); - const _comparisonDescription = Symbol('_comparisonDescription'); - const _valueInDescription = Symbol('_valueInDescription'); - src__matcher__numeric_matchers._OrderingComparison = class _OrderingComparison extends src__matcher__interfaces.Matcher { - new(value, equalValue, lessThanValue, greaterThanValue, comparisonDescription, valueInDescription) { - if (valueInDescription === void 0) valueInDescription = true; - this[_value] = value; - this[_equalValue] = equalValue; - this[_lessThanValue] = lessThanValue; - this[_greaterThanValue] = greaterThanValue; - this[_comparisonDescription] = comparisonDescription; - this[_valueInDescription] = valueInDescription; - super.new(); - } - matches(item, matchState) { - if (dart.equals(item, this[_value])) { - return this[_equalValue]; - } else if (dart.test(dart.dsend(item, '<', this[_value]))) { - return this[_lessThanValue]; - } else { - return this[_greaterThanValue]; - } - } - describe(description) { - if (dart.test(this[_valueInDescription])) { - return description.add(this[_comparisonDescription]).add(' ').addDescriptionOf(this[_value]); - } else { - return description.add(this[_comparisonDescription]); - } - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - mismatchDescription.add('is not '); - return this.describe(mismatchDescription); - } - }; - dart.setSignature(src__matcher__numeric_matchers._OrderingComparison, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__numeric_matchers._OrderingComparison, [dart.dynamic, core.bool, core.bool, core.bool, core.String], [core.bool])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__numeric_matchers.isZero = dart.const(new src__matcher__numeric_matchers._OrderingComparison(0, true, false, false, 'a value equal to')); - unittest.isZero = src__matcher__numeric_matchers.isZero; - src__matcher__core_matchers._IsList = class _IsList extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("List"); - } - matches(item, matchState) { - return core.List.is(item); - } - }; - dart.setSignature(src__matcher__core_matchers._IsList, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsList, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__core_matchers.isList = dart.const(new src__matcher__core_matchers._IsList()); - unittest.isList = src__matcher__core_matchers.isList; - src__matcher__prints_matcher.prints = function(matcher) { - return new src__matcher__prints_matcher._Prints(src__matcher__util.wrapMatcher(matcher)); - }; - dart.fn(src__matcher__prints_matcher.prints, dynamicToMatcher()); - unittest.prints = src__matcher__prints_matcher.prints; - src__matcher__util.escape = function(str) { - str = str[dartx.replaceAll]('\\', '\\\\'); - return str[dartx.replaceAllMapped](src__matcher__util._escapeRegExp, dart.fn(match => { - let mapped = src__matcher__util._escapeMap[dartx.get](match.get(0)); - if (mapped != null) return mapped; - return src__matcher__util._getHexLiteral(match.get(0)); - }, MatchToString())); - }; - dart.fn(src__matcher__util.escape, StringToString()); - unittest.escape = src__matcher__util.escape; - src__matcher__iterable_matchers.anyElement = function(matcher) { - return new src__matcher__iterable_matchers._AnyElement(src__matcher__util.wrapMatcher(matcher)); - }; - dart.fn(src__matcher__iterable_matchers.anyElement, dynamicToMatcher()); - unittest.anyElement = src__matcher__iterable_matchers.anyElement; - src__matcher__error_matchers._Exception = class _Exception extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("Exception"); - } - matches(item, matchState) { - return core.Exception.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._Exception, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._Exception, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isException = dart.const(new src__matcher__error_matchers._Exception()); - src__matcher__throws_matchers.throwsException = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isException)); - unittest.throwsException = src__matcher__throws_matchers.throwsException; - src__matcher__core_matchers._IsAnything = class _IsAnything extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return true; - } - describe(description) { - return description.add('anything'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsAnything, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsAnything, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.anything = dart.const(new src__matcher__core_matchers._IsAnything()); - unittest.anything = src__matcher__core_matchers.anything; - src__matcher__core_matchers.contains = function(expected) { - return new src__matcher__core_matchers._Contains(expected); - }; - dart.fn(src__matcher__core_matchers.contains, dynamicToMatcher()); - unittest.contains = src__matcher__core_matchers.contains; - src__matcher__operator_matchers.isNot = function(matcher) { - return new src__matcher__operator_matchers._IsNot(src__matcher__util.wrapMatcher(matcher)); - }; - dart.fn(src__matcher__operator_matchers.isNot, dynamicToMatcher()); - unittest.isNot = src__matcher__operator_matchers.isNot; - dart.defineLazy(src__matcher__expect, { - get wrapAsync() { - return dart.fn((f, id) => { - if (id === void 0) id = null; - return f; - }, Function__ToFunction$()); - }, - set wrapAsync(_) {} - }); - dart.export(unittest, src__matcher__expect, 'wrapAsync'); - src__matcher__core_matchers.same = function(expected) { - return new src__matcher__core_matchers._IsSameAs(expected); - }; - dart.fn(src__matcher__core_matchers.same, dynamicToMatcher()); - unittest.same = src__matcher__core_matchers.same; - src__matcher__numeric_matchers.inClosedOpenRange = function(low, high) { - return new src__matcher__numeric_matchers._InRange(low, high, true, false); - }; - dart.fn(src__matcher__numeric_matchers.inClosedOpenRange, numAndnumToMatcher()); - unittest.inClosedOpenRange = src__matcher__numeric_matchers.inClosedOpenRange; - src__matcher__core_matchers.predicate = function(f, description) { - if (description === void 0) description = 'satisfies function'; - return new src__matcher__core_matchers._Predicate(f, description); - }; - dart.fn(src__matcher__core_matchers.predicate, Fn__ToMatcher()); - unittest.predicate = src__matcher__core_matchers.predicate; - src__matcher__util.wrapMatcher = function(x) { - if (src__matcher__interfaces.Matcher.is(x)) { - return x; - } else if (src__matcher__util._Predicate.is(x)) { - return src__matcher__core_matchers.predicate(x); - } else { - return src__matcher__core_matchers.equals(x); - } - }; - dart.fn(src__matcher__util.wrapMatcher, dynamicToMatcher()); - unittest.wrapMatcher = src__matcher__util.wrapMatcher; - src__matcher__iterable_matchers.unorderedEquals = function(expected) { - return new src__matcher__iterable_matchers._UnorderedEquals(expected); - }; - dart.fn(src__matcher__iterable_matchers.unorderedEquals, IterableToMatcher()); - unittest.unorderedEquals = src__matcher__iterable_matchers.unorderedEquals; - src__matcher__expect.TestFailure = class TestFailure extends core.Error { - new(message) { - this.message = message; - super.new(); - } - toString() { - return this.message; - } - }; - dart.setSignature(src__matcher__expect.TestFailure, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__expect.TestFailure, [core.String])}) - }); - unittest.TestFailure = src__matcher__expect.TestFailure; - unittest.isException = src__matcher__error_matchers.isException; - src__matcher__util.addStateInfo = function(matchState, values) { - let innerState = core.Map.from(matchState); - matchState[dartx.clear](); - matchState[dartx.set]('state', innerState); - matchState[dartx.addAll](values); - }; - dart.fn(src__matcher__util.addStateInfo, MapAndMapTovoid()); - unittest.addStateInfo = src__matcher__util.addStateInfo; - src__matcher__throws_matchers.throwsConcurrentModificationError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isConcurrentModificationError)); - unittest.throwsConcurrentModificationError = src__matcher__throws_matchers.throwsConcurrentModificationError; - src__matcher__numeric_matchers.closeTo = function(value, delta) { - return new src__matcher__numeric_matchers._IsCloseTo(value, delta); - }; - dart.fn(src__matcher__numeric_matchers.closeTo, numAndnumToMatcher()); - unittest.closeTo = src__matcher__numeric_matchers.closeTo; - src__matcher__numeric_matchers.isPositive = dart.const(new src__matcher__numeric_matchers._OrderingComparison(0, false, false, true, 'a positive value', false)); - unittest.isPositive = src__matcher__numeric_matchers.isPositive; - src__matcher__numeric_matchers.inOpenClosedRange = function(low, high) { - return new src__matcher__numeric_matchers._InRange(low, high, false, true); - }; - dart.fn(src__matcher__numeric_matchers.inOpenClosedRange, numAndnumToMatcher()); - unittest.inOpenClosedRange = src__matcher__numeric_matchers.inOpenClosedRange; - src__matcher__string_matchers.equalsIgnoringCase = function(value) { - return new src__matcher__string_matchers._IsEqualIgnoringCase(value); - }; - dart.fn(src__matcher__string_matchers.equalsIgnoringCase, StringToMatcher()); - unittest.equalsIgnoringCase = src__matcher__string_matchers.equalsIgnoringCase; - src__matcher__numeric_matchers.isNegative = dart.const(new src__matcher__numeric_matchers._OrderingComparison(0, false, true, false, 'a negative value', false)); - unittest.isNegative = src__matcher__numeric_matchers.isNegative; - src__matcher__operator_matchers.allOf = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - if (arg1 === void 0) arg1 = null; - if (arg2 === void 0) arg2 = null; - if (arg3 === void 0) arg3 = null; - if (arg4 === void 0) arg4 = null; - if (arg5 === void 0) arg5 = null; - if (arg6 === void 0) arg6 = null; - return new src__matcher__operator_matchers._AllOf(src__matcher__operator_matchers._wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6)); - }; - dart.fn(src__matcher__operator_matchers.allOf, dynamic__ToMatcher$()); - unittest.allOf = src__matcher__operator_matchers.allOf; - src__matcher__error_matchers._ArgumentError = class _ArgumentError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("ArgumentError"); - } - matches(item, matchState) { - return core.ArgumentError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._ArgumentError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._ArgumentError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isArgumentError = dart.const(new src__matcher__error_matchers._ArgumentError()); - src__matcher__throws_matchers.throwsArgumentError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isArgumentError)); - unittest.throwsArgumentError = src__matcher__throws_matchers.throwsArgumentError; - src__matcher__numeric_matchers.lessThan = function(value) { - return new src__matcher__numeric_matchers._OrderingComparison(value, false, true, false, 'a value less than'); - }; - dart.fn(src__matcher__numeric_matchers.lessThan, dynamicToMatcher()); - unittest.lessThan = src__matcher__numeric_matchers.lessThan; - src__matcher__throws_matchers.throwsStateError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isStateError)); - unittest.throwsStateError = src__matcher__throws_matchers.throwsStateError; - src__matcher__numeric_matchers.greaterThanOrEqualTo = function(value) { - return new src__matcher__numeric_matchers._OrderingComparison(value, true, false, true, 'a value greater than or equal to'); - }; - dart.fn(src__matcher__numeric_matchers.greaterThanOrEqualTo, dynamicToMatcher()); - unittest.greaterThanOrEqualTo = src__matcher__numeric_matchers.greaterThanOrEqualTo; - unittest.Throws = src__matcher__throws_matcher.Throws; - src__matcher__map_matchers.containsValue = function(value) { - return new src__matcher__map_matchers._ContainsValue(value); - }; - dart.fn(src__matcher__map_matchers.containsValue, dynamicToMatcher()); - unittest.containsValue = src__matcher__map_matchers.containsValue; - src__matcher__string_matchers.endsWith = function(suffixString) { - return new src__matcher__string_matchers._StringEndsWith(suffixString); - }; - dart.fn(src__matcher__string_matchers.endsWith, StringToMatcher()); - unittest.endsWith = src__matcher__string_matchers.endsWith; - src__matcher__core_matchers._IsFalse = class _IsFalse extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return dart.equals(item, false); - } - describe(description) { - return description.add('false'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsFalse, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsFalse, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isFalse = dart.const(new src__matcher__core_matchers._IsFalse()); - unittest.isFalse = src__matcher__core_matchers.isFalse; - unittest.Matcher = src__matcher__interfaces.Matcher; - src__matcher__numeric_matchers.lessThanOrEqualTo = function(value) { - return new src__matcher__numeric_matchers._OrderingComparison(value, true, true, false, 'a value less than or equal to'); - }; - dart.fn(src__matcher__numeric_matchers.lessThanOrEqualTo, dynamicToMatcher()); - unittest.lessThanOrEqualTo = src__matcher__numeric_matchers.lessThanOrEqualTo; - src__matcher__expect.getOrCreateExpectFailureHandler = function() { - if (src__matcher__expect._assertFailureHandler == null) { - src__matcher__expect.configureExpectFailureHandler(); - } - return src__matcher__expect._assertFailureHandler; - }; - dart.lazyFn(src__matcher__expect.getOrCreateExpectFailureHandler, () => VoidToFailureHandler()); - unittest.getOrCreateExpectFailureHandler = src__matcher__expect.getOrCreateExpectFailureHandler; - src__matcher__string_matchers.matches = function(re) { - return new src__matcher__string_matchers._MatchesRegExp(re); - }; - dart.fn(src__matcher__string_matchers.matches, dynamicToMatcher()); - unittest.matches = src__matcher__string_matchers.matches; - src__matcher__error_matchers._UnsupportedError = class _UnsupportedError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("UnsupportedError"); - } - matches(item, matchState) { - return core.UnsupportedError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._UnsupportedError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._UnsupportedError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isUnsupportedError = dart.const(new src__matcher__error_matchers._UnsupportedError()); - src__matcher__throws_matchers.throwsUnsupportedError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isUnsupportedError)); - unittest.throwsUnsupportedError = src__matcher__throws_matchers.throwsUnsupportedError; - unittest.TypeMatcher = src__matcher__core_matchers.TypeMatcher; - src__matcher__expect.configureExpectFailureHandler = function(handler) { - if (handler === void 0) handler = null; - if (handler == null) { - handler = new src__matcher__expect.DefaultFailureHandler(); - } - src__matcher__expect._assertFailureHandler = handler; - }; - dart.lazyFn(src__matcher__expect.configureExpectFailureHandler, () => __Tovoid()); - unittest.configureExpectFailureHandler = src__matcher__expect.configureExpectFailureHandler; - src__matcher__expect.FailureHandler = class FailureHandler extends core.Object {}; - unittest.FailureHandler = src__matcher__expect.FailureHandler; - src__matcher__core_matchers._IsNotNaN = class _IsNotNaN extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.double.NAN[dartx.compareTo](core.num._check(item)) != 0; - } - describe(description) { - return description.add('not NaN'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsNotNaN, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsNotNaN, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isNotNaN = dart.const(new src__matcher__core_matchers._IsNotNaN()); - unittest.isNotNaN = src__matcher__core_matchers.isNotNaN; - src__matcher__numeric_matchers.isNonZero = dart.const(new src__matcher__numeric_matchers._OrderingComparison(0, false, true, true, 'a value not equal to')); - unittest.isNonZero = src__matcher__numeric_matchers.isNonZero; - src__matcher__throws_matcher.throws = dart.const(new src__matcher__throws_matcher.Throws()); - unittest.throws = src__matcher__throws_matcher.throws; - src__matcher__error_matchers._NullThrownError = class _NullThrownError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("NullThrownError"); - } - matches(item, matchState) { - return core.NullThrownError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._NullThrownError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._NullThrownError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isNullThrownError = dart.const(new src__matcher__error_matchers._NullThrownError()); - unittest.isNullThrownError = src__matcher__error_matchers.isNullThrownError; - src__matcher__expect.DefaultFailureHandler = class DefaultFailureHandler extends core.Object { - new() { - if (src__matcher__expect._assertErrorFormatter == null) { - src__matcher__expect._assertErrorFormatter = src__matcher__expect._defaultErrorFormatter; - } - } - fail(reason) { - dart.throw(new src__matcher__expect.TestFailure(reason)); - } - failMatch(actual, matcher, reason, matchState, verbose) { - this.fail(dart.dcall(src__matcher__expect._assertErrorFormatter, actual, matcher, reason, matchState, verbose)); - } - }; - src__matcher__expect.DefaultFailureHandler[dart.implements] = () => [src__matcher__expect.FailureHandler]; - dart.setSignature(src__matcher__expect.DefaultFailureHandler, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__expect.DefaultFailureHandler, [])}), - methods: () => ({ - fail: dart.definiteFunctionType(dart.void, [core.String]), - failMatch: dart.definiteFunctionType(dart.void, [dart.dynamic, src__matcher__interfaces.Matcher, core.String, core.Map, core.bool]) - }) - }); - unittest.DefaultFailureHandler = src__matcher__expect.DefaultFailureHandler; - src__matcher__core_matchers._Empty = class _Empty extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dload(item, 'isEmpty')); - } - describe(description) { - return description.add('empty'); - } - }; - dart.setSignature(src__matcher__core_matchers._Empty, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._Empty, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isEmpty = dart.const(new src__matcher__core_matchers._Empty()); - unittest.isEmpty = src__matcher__core_matchers.isEmpty; - src__matcher__operator_matchers.anyOf = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - if (arg1 === void 0) arg1 = null; - if (arg2 === void 0) arg2 = null; - if (arg3 === void 0) arg3 = null; - if (arg4 === void 0) arg4 = null; - if (arg5 === void 0) arg5 = null; - if (arg6 === void 0) arg6 = null; - return new src__matcher__operator_matchers._AnyOf(src__matcher__operator_matchers._wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6)); - }; - dart.fn(src__matcher__operator_matchers.anyOf, dynamic__ToMatcher$()); - unittest.anyOf = src__matcher__operator_matchers.anyOf; - unittest.isCyclicInitializationError = src__matcher__error_matchers.isCyclicInitializationError; - src__matcher__error_matchers._NoSuchMethodError = class _NoSuchMethodError extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("NoSuchMethodError"); - } - matches(item, matchState) { - return core.NoSuchMethodError.is(item); - } - }; - dart.setSignature(src__matcher__error_matchers._NoSuchMethodError, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__error_matchers._NoSuchMethodError, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__error_matchers.isNoSuchMethodError = dart.const(new src__matcher__error_matchers._NoSuchMethodError()); - src__matcher__throws_matchers.throwsNoSuchMethodError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isNoSuchMethodError)); - unittest.throwsNoSuchMethodError = src__matcher__throws_matchers.throwsNoSuchMethodError; - src__matcher__future_matchers.completion = function(matcher, id) { - if (id === void 0) id = ''; - return new src__matcher__future_matchers._Completes(src__matcher__util.wrapMatcher(matcher), id); - }; - dart.fn(src__matcher__future_matchers.completion, dynamic__ToMatcher$0()); - unittest.completion = src__matcher__future_matchers.completion; - unittest.isUnsupportedError = src__matcher__error_matchers.isUnsupportedError; - src__matcher__numeric_matchers.isNonPositive = dart.const(new src__matcher__numeric_matchers._OrderingComparison(0, true, true, false, 'a non-positive value', false)); - unittest.isNonPositive = src__matcher__numeric_matchers.isNonPositive; - dart.export(unittest, src__matcher__expect, 'wrapAsync'); - src__matcher__core_matchers._IsNotNull = class _IsNotNull extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return item != null; - } - describe(description) { - return description.add('not null'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsNotNull, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsNotNull, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isNotNull = dart.const(new src__matcher__core_matchers._IsNotNull()); - unittest.isNotNull = src__matcher__core_matchers.isNotNull; - unittest.isNoSuchMethodError = src__matcher__error_matchers.isNoSuchMethodError; - src__matcher__throws_matchers.throwsNullThrownError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isNullThrownError)); - unittest.throwsNullThrownError = src__matcher__throws_matchers.throwsNullThrownError; - src__matcher__throws_matchers.throwsUnimplementedError = dart.const(new src__matcher__throws_matcher.Throws(src__matcher__error_matchers.isUnimplementedError)); - unittest.throwsUnimplementedError = src__matcher__throws_matchers.throwsUnimplementedError; - src__matcher__iterable_matchers.everyElement = function(matcher) { - return new src__matcher__iterable_matchers._EveryElement(src__matcher__util.wrapMatcher(matcher)); - }; - dart.fn(src__matcher__iterable_matchers.everyElement, dynamicToMatcher()); - unittest.everyElement = src__matcher__iterable_matchers.everyElement; - unittest.isArgumentError = src__matcher__error_matchers.isArgumentError; - src__matcher__map_matchers.containsPair = function(key, value) { - return new src__matcher__map_matchers._ContainsMapping(key, src__matcher__util.wrapMatcher(value)); - }; - dart.fn(src__matcher__map_matchers.containsPair, dynamicAnddynamicToMatcher()); - unittest.containsPair = src__matcher__map_matchers.containsPair; - src__matcher__numeric_matchers.inInclusiveRange = function(low, high) { - return new src__matcher__numeric_matchers._InRange(low, high, true, true); - }; - dart.fn(src__matcher__numeric_matchers.inInclusiveRange, numAndnumToMatcher()); - unittest.inInclusiveRange = src__matcher__numeric_matchers.inInclusiveRange; - unittest.isFormatException = src__matcher__error_matchers.isFormatException; - src__matcher__iterable_matchers.orderedEquals = function(expected) { - return new src__matcher__iterable_matchers._OrderedEquals(expected); - }; - dart.fn(src__matcher__iterable_matchers.orderedEquals, IterableToMatcher()); - unittest.orderedEquals = src__matcher__iterable_matchers.orderedEquals; - src__matcher__string_matchers.collapseWhitespace = function(string) { - let result = new core.StringBuffer(); - let skipSpace = true; - for (let i = 0; i < dart.notNull(string[dartx.length]); i++) { - let character = string[dartx.get](i); - if (dart.test(src__matcher__string_matchers._isWhitespace(character))) { - if (!skipSpace) { - result.write(' '); - skipSpace = true; - } - } else { - result.write(character); - skipSpace = false; - } - } - return result.toString()[dartx.trim](); - }; - dart.fn(src__matcher__string_matchers.collapseWhitespace, StringToString()); - unittest.collapseWhitespace = src__matcher__string_matchers.collapseWhitespace; - src__matcher__numeric_matchers.greaterThan = function(value) { - return new src__matcher__numeric_matchers._OrderingComparison(value, false, false, true, 'a value greater than'); - }; - dart.fn(src__matcher__numeric_matchers.greaterThan, dynamicToMatcher()); - unittest.greaterThan = src__matcher__numeric_matchers.greaterThan; - src__matcher__numeric_matchers.isNonNegative = dart.const(new src__matcher__numeric_matchers._OrderingComparison(0, true, false, true, 'a non-negative value', false)); - unittest.isNonNegative = src__matcher__numeric_matchers.isNonNegative; - src__matcher__core_matchers._IsNull = class _IsNull extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - matches(item, matchState) { - return item == null; - } - describe(description) { - return description.add('null'); - } - }; - dart.setSignature(src__matcher__core_matchers._IsNull, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsNull, [])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers.isNull = dart.const(new src__matcher__core_matchers._IsNull()); - unittest.isNull = src__matcher__core_matchers.isNull; - src__matcher__core_matchers._IsMap = class _IsMap extends src__matcher__core_matchers.TypeMatcher { - new() { - super.new("Map"); - } - matches(item, matchState) { - return core.Map.is(item); - } - }; - dart.setSignature(src__matcher__core_matchers._IsMap, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsMap, [])}), - methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map])}) - }); - src__matcher__core_matchers.isMap = dart.const(new src__matcher__core_matchers._IsMap()); - unittest.isMap = src__matcher__core_matchers.isMap; - src__matcher__interfaces.Description = class Description extends core.Object {}; - unittest.Description = src__matcher__interfaces.Description; - src__matcher__string_matchers.stringContainsInOrder = function(substrings) { - return new src__matcher__string_matchers._StringContainsInOrder(substrings); - }; - dart.fn(src__matcher__string_matchers.stringContainsInOrder, ListOfStringToMatcher()); - unittest.stringContainsInOrder = src__matcher__string_matchers.stringContainsInOrder; - const _testLogBuffer = Symbol('_testLogBuffer'); - const _receivePort = Symbol('_receivePort'); - const _postMessage = Symbol('_postMessage'); - src__simple_configuration.SimpleConfiguration = class SimpleConfiguration extends src__configuration.Configuration { - new() { - this[_testLogBuffer] = JSArrayOfPairOfString$StackTrace().of([]); - this[_receivePort] = null; - this.name = 'Configuration'; - this.throwOnTestFailures = true; - this.stopTestOnExpectFailure = true; - super.blank(); - src__matcher__expect.configureExpectFailureHandler(new src__simple_configuration._ExpectFailureHandler(this)); - } - onInit() { - unittest.filterStacks = false; - this[_receivePort] = isolate.ReceivePort.new(); - this[_postMessage]('unittest-suite-wait-for-done'); - } - onTestStart(testCase) { - return this[_testLogBuffer][dartx.clear](); - } - onTestResult(externalTestCase) { - if (dart.test(this.stopTestOnExpectFailure) || dart.test(this[_testLogBuffer][dartx.isEmpty])) return; - let testCase = src__internal_test_case.InternalTestCase.as(externalTestCase); - let reason = new core.StringBuffer(); - for (let reasonAndTrace of this[_testLogBuffer][dartx.take](dart.notNull(this[_testLogBuffer][dartx.length]) - 1)) { - reason.write(reasonAndTrace.first); - reason.write('\n'); - reason.write(reasonAndTrace.last); - reason.write('\n'); - } - let lastReasonAndTrace = this[_testLogBuffer][dartx.last]; - reason.write(lastReasonAndTrace.first); - if (testCase.result == unittest.PASS) { - testCase.result = unittest.FAIL; - testCase.message = reason.toString(); - testCase.stackTrace = lastReasonAndTrace.last; - } else { - reason.write(lastReasonAndTrace.last); - reason.write('\n'); - testCase.message = dart.str`${reason.toString()}\n${testCase.message}`; - } - } - onLogMessage(testCase, message) { - core.print(message); - } - onExpectFailure(reason) { - if (dart.test(this.stopTestOnExpectFailure)) dart.throw(new src__matcher__expect.TestFailure(reason)); - try { - dart.throw(''); - } catch (_) { - let stack = dart.stackTrace(_); - let trace = src__utils.getTrace(stack, unittest.formatStacks, unittest.filterStacks); - if (trace == null) trace = src__trace.Trace._check(stack); - this[_testLogBuffer][dartx.add](new (PairOfString$StackTrace())(reason, trace)); - } - - } - formatResult(testCase) { - let result = new core.StringBuffer(); - result.write(testCase.result[dartx.toUpperCase]()); - result.write(": "); - result.write(testCase.description); - result.write("\n"); - if (testCase.message != '') { - result.write(src__utils.indent(testCase.message)); - result.write("\n"); - } - if (testCase.stackTrace != null) { - result.write(src__utils.indent(dart.toString(testCase.stackTrace))); - result.write("\n"); - } - return result.toString(); - } - onSummary(passed, failed, errors, results, uncaughtError) { - for (let test of results) { - core.print(this.formatResult(test)[dartx.trim]()); - } - core.print(''); - if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) { - core.print('No tests found.'); - } else if (failed == 0 && errors == 0 && uncaughtError == null) { - core.print(dart.str`All ${passed} tests passed.`); - } else { - if (uncaughtError != null) { - core.print(dart.str`Top-level uncaught error: ${uncaughtError}`); - } - core.print(dart.str`${passed} PASSED, ${failed} FAILED, ${errors} ERRORS`); - } - } - onDone(success) { - if (dart.test(success)) { - this[_postMessage]('unittest-suite-success'); - this[_receivePort].close(); - } else { - this[_receivePort].close(); - if (dart.test(this.throwOnTestFailures)) { - dart.throw(core.Exception.new('Some tests failed.')); - } - } - } - [_postMessage](message) { - core.print(message); - } - }; - dart.setSignature(src__simple_configuration.SimpleConfiguration, { - constructors: () => ({new: dart.definiteFunctionType(src__simple_configuration.SimpleConfiguration, [])}), - methods: () => ({ - onExpectFailure: dart.definiteFunctionType(dart.void, [core.String]), - formatResult: dart.definiteFunctionType(core.String, [src__test_case.TestCase]), - [_postMessage]: dart.definiteFunctionType(dart.void, [core.String]) - }) - }); - unittest.SimpleConfiguration = src__simple_configuration.SimpleConfiguration; - src__test_case.TestCase = class TestCase extends core.Object { - get isComplete() { - return !dart.test(this.enabled) || this.result != null; - } - }; - unittest.TestCase = src__test_case.TestCase; - const _config = Symbol('_config'); - src__simple_configuration._ExpectFailureHandler = class _ExpectFailureHandler extends src__matcher__expect.DefaultFailureHandler { - new(config) { - this[_config] = config; - super.new(); - } - fail(reason) { - this[_config].onExpectFailure(reason); - } - }; - dart.setSignature(src__simple_configuration._ExpectFailureHandler, { - constructors: () => ({new: dart.definiteFunctionType(src__simple_configuration._ExpectFailureHandler, [src__simple_configuration.SimpleConfiguration])}) - }); - src__matcher.isTrue = src__matcher__core_matchers.isTrue; - src__matcher.isFalse = src__matcher__core_matchers.isFalse; - src__matcher.isEmpty = src__matcher__core_matchers.isEmpty; - src__matcher.same = src__matcher__core_matchers.same; - src__matcher.equals = src__matcher__core_matchers.equals; - src__matcher.CustomMatcher = src__matcher__core_matchers.CustomMatcher; - src__matcher.isList = src__matcher__core_matchers.isList; - src__matcher.predicate = src__matcher__core_matchers.predicate; - src__matcher.isNotNull = src__matcher__core_matchers.isNotNull; - src__matcher.hasLength = src__matcher__core_matchers.hasLength; - src__matcher.isInstanceOf$ = src__matcher__core_matchers.isInstanceOf$; - src__matcher.isInstanceOf = src__matcher__core_matchers.isInstanceOf; - src__matcher.isNaN = src__matcher__core_matchers.isNaN; - src__matcher.returnsNormally = src__matcher__core_matchers.returnsNormally; - src__matcher.anything = src__matcher__core_matchers.anything; - src__matcher.TypeMatcher = src__matcher__core_matchers.TypeMatcher; - src__matcher.contains = src__matcher__core_matchers.contains; - src__matcher.isNotEmpty = src__matcher__core_matchers.isNotEmpty; - src__matcher.isNull = src__matcher__core_matchers.isNull; - src__matcher.isMap = src__matcher__core_matchers.isMap; - src__matcher.isNotNaN = src__matcher__core_matchers.isNotNaN; - src__matcher.isIn = src__matcher__core_matchers.isIn; - src__matcher.StringDescription = src__matcher__description.StringDescription; - src__matcher.isConcurrentModificationError = src__matcher__error_matchers.isConcurrentModificationError; - src__matcher.isCyclicInitializationError = src__matcher__error_matchers.isCyclicInitializationError; - src__matcher.isArgumentError = src__matcher__error_matchers.isArgumentError; - src__matcher.isException = src__matcher__error_matchers.isException; - src__matcher.isNullThrownError = src__matcher__error_matchers.isNullThrownError; - src__matcher.isRangeError = src__matcher__error_matchers.isRangeError; - src__matcher.isFormatException = src__matcher__error_matchers.isFormatException; - src__matcher.isStateError = src__matcher__error_matchers.isStateError; - src__matcher.isNoSuchMethodError = src__matcher__error_matchers.isNoSuchMethodError; - src__matcher.isUnimplementedError = src__matcher__error_matchers.isUnimplementedError; - src__matcher.isUnsupportedError = src__matcher__error_matchers.isUnsupportedError; - src__matcher.TestFailure = src__matcher__expect.TestFailure; - src__matcher.configureExpectFormatter = src__matcher__expect.configureExpectFormatter; - src__matcher.DefaultFailureHandler = src__matcher__expect.DefaultFailureHandler; - src__matcher.fail = src__matcher__expect.fail; - src__matcher.ErrorFormatter = src__matcher__expect.ErrorFormatter; - dart.export(src__matcher, src__matcher__expect, 'wrapAsync'); - dart.export(src__matcher, src__matcher__expect, 'wrapAsync'); - src__matcher.configureExpectFailureHandler = src__matcher__expect.configureExpectFailureHandler; - src__matcher.FailureHandler = src__matcher__expect.FailureHandler; - src__matcher.expect = src__matcher__expect.expect; - src__matcher.getOrCreateExpectFailureHandler = src__matcher__expect.getOrCreateExpectFailureHandler; - src__matcher.completes = src__matcher__future_matchers.completes; - src__matcher.completion = src__matcher__future_matchers.completion; - src__matcher.Matcher = src__matcher__interfaces.Matcher; - src__matcher.Description = src__matcher__interfaces.Description; - src__matcher.pairwiseCompare = src__matcher__iterable_matchers.pairwiseCompare; - src__matcher.anyElement = src__matcher__iterable_matchers.anyElement; - src__matcher.orderedEquals = src__matcher__iterable_matchers.orderedEquals; - src__matcher.unorderedEquals = src__matcher__iterable_matchers.unorderedEquals; - src__matcher.unorderedMatches = src__matcher__iterable_matchers.unorderedMatches; - src__matcher.everyElement = src__matcher__iterable_matchers.everyElement; - src__matcher.containsValue = src__matcher__map_matchers.containsValue; - src__matcher.containsPair = src__matcher__map_matchers.containsPair; - src__matcher.isPositive = src__matcher__numeric_matchers.isPositive; - src__matcher.isZero = src__matcher__numeric_matchers.isZero; - src__matcher.inOpenClosedRange = src__matcher__numeric_matchers.inOpenClosedRange; - src__matcher.inClosedOpenRange = src__matcher__numeric_matchers.inClosedOpenRange; - src__matcher.lessThanOrEqualTo = src__matcher__numeric_matchers.lessThanOrEqualTo; - src__matcher.isNegative = src__matcher__numeric_matchers.isNegative; - src__matcher.inInclusiveRange = src__matcher__numeric_matchers.inInclusiveRange; - src__matcher.lessThan = src__matcher__numeric_matchers.lessThan; - src__matcher.greaterThan = src__matcher__numeric_matchers.greaterThan; - src__matcher.isNonNegative = src__matcher__numeric_matchers.isNonNegative; - src__matcher.inExclusiveRange = src__matcher__numeric_matchers.inExclusiveRange; - src__matcher.closeTo = src__matcher__numeric_matchers.closeTo; - src__matcher.greaterThanOrEqualTo = src__matcher__numeric_matchers.greaterThanOrEqualTo; - src__matcher.isNonZero = src__matcher__numeric_matchers.isNonZero; - src__matcher.isNonPositive = src__matcher__numeric_matchers.isNonPositive; - src__matcher.allOf = src__matcher__operator_matchers.allOf; - src__matcher.isNot = src__matcher__operator_matchers.isNot; - src__matcher.anyOf = src__matcher__operator_matchers.anyOf; - src__matcher.prints = src__matcher__prints_matcher.prints; - src__matcher.endsWith = src__matcher__string_matchers.endsWith; - src__matcher.startsWith = src__matcher__string_matchers.startsWith; - src__matcher.matches = src__matcher__string_matchers.matches; - src__matcher.collapseWhitespace = src__matcher__string_matchers.collapseWhitespace; - src__matcher.equalsIgnoringCase = src__matcher__string_matchers.equalsIgnoringCase; - src__matcher.equalsIgnoringWhitespace = src__matcher__string_matchers.equalsIgnoringWhitespace; - src__matcher.stringContainsInOrder = src__matcher__string_matchers.stringContainsInOrder; - src__matcher.throwsA = src__matcher__throws_matcher.throwsA; - src__matcher.throws = src__matcher__throws_matcher.throws; - src__matcher.Throws = src__matcher__throws_matcher.Throws; - src__matcher.throwsArgumentError = src__matcher__throws_matchers.throwsArgumentError; - src__matcher.throwsRangeError = src__matcher__throws_matchers.throwsRangeError; - src__matcher.throwsUnsupportedError = src__matcher__throws_matchers.throwsUnsupportedError; - src__matcher.throwsCyclicInitializationError = src__matcher__throws_matchers.throwsCyclicInitializationError; - src__matcher.throwsException = src__matcher__throws_matchers.throwsException; - src__matcher.throwsNoSuchMethodError = src__matcher__throws_matchers.throwsNoSuchMethodError; - src__matcher.throwsFormatException = src__matcher__throws_matchers.throwsFormatException; - src__matcher.throwsStateError = src__matcher__throws_matchers.throwsStateError; - src__matcher.throwsConcurrentModificationError = src__matcher__throws_matchers.throwsConcurrentModificationError; - src__matcher.throwsNullThrownError = src__matcher__throws_matchers.throwsNullThrownError; - src__matcher.throwsUnimplementedError = src__matcher__throws_matchers.throwsUnimplementedError; - src__matcher.addStateInfo = src__matcher__util.addStateInfo; - src__matcher.wrapMatcher = src__matcher__util.wrapMatcher; - src__matcher.escape = src__matcher__util.escape; - const _expected = Symbol('_expected'); - src__matcher__core_matchers._IsSameAs = class _IsSameAs extends src__matcher__interfaces.Matcher { - new(expected) { - this[_expected] = expected; - super.new(); - } - matches(item, matchState) { - return core.identical(item, this[_expected]); - } - describe(description) { - return description.add('same instance as ').addDescriptionOf(this[_expected]); - } - }; - dart.setSignature(src__matcher__core_matchers._IsSameAs, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._IsSameAs, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _limit = Symbol('_limit'); - const _compareIterables = Symbol('_compareIterables'); - const _compareSets = Symbol('_compareSets'); - const _recursiveMatch = Symbol('_recursiveMatch'); - const _match = Symbol('_match'); - src__matcher__core_matchers._DeepMatcher = class _DeepMatcher extends src__matcher__interfaces.Matcher { - new(expected, limit) { - if (limit === void 0) limit = 1000; - this[_expected] = expected; - this[_limit] = limit; - this.count = null; - super.new(); - } - [_compareIterables](expected, actual, matcher, depth, location) { - if (!core.Iterable.is(actual)) return ['is not Iterable', location]; - let expectedIterator = dart.dload(expected, 'iterator'); - let actualIterator = dart.dload(actual, 'iterator'); - for (let index = 0;; index++) { - let expectedNext = dart.dsend(expectedIterator, 'moveNext'); - let actualNext = dart.dsend(actualIterator, 'moveNext'); - if (!dart.test(expectedNext) && !dart.test(actualNext)) return null; - let newLocation = dart.str`${location}[${index}]`; - if (!dart.test(expectedNext)) return JSArrayOfString().of(['longer than expected', newLocation]); - if (!dart.test(actualNext)) return JSArrayOfString().of(['shorter than expected', newLocation]); - let rp = dart.dcall(matcher, dart.dload(expectedIterator, 'current'), dart.dload(actualIterator, 'current'), newLocation, depth); - if (rp != null) return core.List._check(rp); - } - } - [_compareSets](expected, actual, matcher, depth, location) { - if (!core.Iterable.is(actual)) return ['is not Iterable', location]; - actual = dart.dsend(actual, 'toSet'); - for (let expectedElement of expected) { - if (dart.test(dart.dsend(actual, 'every', dart.fn(actualElement => dart.dcall(matcher, expectedElement, actualElement, location, depth) != null, dynamicTobool$())))) { - return [dart.str`does not contain ${expectedElement}`, location]; - } - } - if (dart.test(dart.dsend(dart.dload(actual, 'length'), '>', expected.length))) { - return ['larger than expected', location]; - } else if (dart.test(dart.dsend(dart.dload(actual, 'length'), '<', expected.length))) { - return ['smaller than expected', location]; - } else { - return null; - } - } - [_recursiveMatch](expected, actual, location, depth) { - if (src__matcher__interfaces.Matcher.is(expected)) { - let matchState = dart.map(); - if (dart.test(expected.matches(actual, matchState))) return null; - let description = new src__matcher__description.StringDescription(); - expected.describe(description); - return JSArrayOfString().of([dart.str`does not match ${description}`, location]); - } else { - try { - if (dart.equals(expected, actual)) return null; - } catch (e) { - return JSArrayOfString().of([dart.str`== threw "${e}"`, location]); - } - - } - if (dart.notNull(depth) > dart.notNull(this[_limit])) return JSArrayOfString().of(['recursion depth limit exceeded', location]); - if (depth == 0 || dart.notNull(this[_limit]) > 1) { - if (core.Set.is(expected)) { - return this[_compareSets](expected, actual, dart.bind(this, _recursiveMatch), dart.notNull(depth) + 1, location); - } else if (core.Iterable.is(expected)) { - return this[_compareIterables](expected, actual, dart.bind(this, _recursiveMatch), dart.notNull(depth) + 1, location); - } else if (core.Map.is(expected)) { - if (!core.Map.is(actual)) return JSArrayOfString().of(['expected a map', location]); - let err = dart.equals(expected[dartx.length], dart.dload(actual, 'length')) ? '' : 'has different length and '; - for (let key of expected[dartx.keys]) { - if (!dart.test(dart.dsend(actual, 'containsKey', key))) { - return JSArrayOfString().of([dart.str`${err}is missing map key '${key}'`, location]); - } - } - for (let key of core.Iterable._check(dart.dload(actual, 'keys'))) { - if (!dart.test(expected[dartx.containsKey](key))) { - return JSArrayOfString().of([dart.str`${err}has extra map key '${key}'`, location]); - } - } - for (let key of expected[dartx.keys]) { - let rp = this[_recursiveMatch](expected[dartx.get](key), dart.dindex(actual, key), dart.str`${location}['${key}']`, dart.notNull(depth) + 1); - if (rp != null) return rp; - } - return null; - } - } - let description = new src__matcher__description.StringDescription(); - if (dart.notNull(depth) > 0) { - description.add('was ').addDescriptionOf(actual).add(' instead of ').addDescriptionOf(expected); - return JSArrayOfString().of([description.toString(), location]); - } - return JSArrayOfString().of(["", location]); - } - [_match](expected, actual, matchState) { - let rp = this[_recursiveMatch](expected, actual, '', 0); - if (rp == null) return null; - let reason = null; - if (dart.test(dart.dsend(dart.dload(rp[dartx.get](0), 'length'), '>', 0))) { - if (dart.test(dart.dsend(dart.dload(rp[dartx.get](1), 'length'), '>', 0))) { - reason = dart.str`${rp[dartx.get](0)} at location ${rp[dartx.get](1)}`; - } else { - reason = rp[dartx.get](0); - } - } else { - reason = ''; - } - src__matcher__util.addStateInfo(matchState, dart.map({reason: reason}, core.String, dart.dynamic)); - return core.String._check(reason); - } - matches(item, matchState) { - return this[_match](this[_expected], item, matchState) == null; - } - describe(description) { - return description.addDescriptionOf(this[_expected]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - let reason = matchState[dartx.get]('reason'); - if (dart.equals(dart.dload(reason, 'length'), 0) && dart.notNull(mismatchDescription.length) > 0) { - mismatchDescription.add('is ').addDescriptionOf(item); - } else { - mismatchDescription.add(core.String._check(reason)); - } - return mismatchDescription; - } - }; - dart.setSignature(src__matcher__core_matchers._DeepMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._DeepMatcher, [dart.dynamic], [core.int])}), - methods: () => ({ - [_compareIterables]: dart.definiteFunctionType(core.List, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_compareSets]: dart.definiteFunctionType(core.List, [core.Set, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_recursiveMatch]: dart.definiteFunctionType(core.List, [dart.dynamic, dart.dynamic, core.String, core.int]), - [_match]: dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic, core.Map]), - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _value$ = Symbol('_value'); - src__matcher__core_matchers._StringEqualsMatcher = class _StringEqualsMatcher extends src__matcher__interfaces.Matcher { - new(value) { - this[_value$] = value; - super.new(); - } - get showActualValue() { - return true; - } - matches(item, matchState) { - return dart.equals(this[_value$], item); - } - describe(description) { - return description.addDescriptionOf(this[_value$]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'string')) { - return mismatchDescription.addDescriptionOf(item).add('is not a string'); - } else { - let buff = new core.StringBuffer(); - buff.write('is different.'); - let escapedItem = src__matcher__util.escape(core.String._check(item)); - let escapedValue = src__matcher__util.escape(this[_value$]); - let minLength = dart.notNull(escapedItem[dartx.length]) < dart.notNull(escapedValue[dartx.length]) ? escapedItem[dartx.length] : escapedValue[dartx.length]; - let start = null; - for (start = 0; dart.notNull(start) < dart.notNull(minLength); start = dart.notNull(start) + 1) { - if (escapedValue[dartx.codeUnitAt](start) != escapedItem[dartx.codeUnitAt](start)) { - break; - } - } - if (start == minLength) { - if (dart.notNull(escapedValue[dartx.length]) < dart.notNull(escapedItem[dartx.length])) { - buff.write(' Both strings start the same, but the given value also' + ' has the following trailing characters: '); - src__matcher__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedItem, escapedValue[dartx.length]); - } else { - buff.write(' Both strings start the same, but the given value is' + ' missing the following trailing characters: '); - src__matcher__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedValue, escapedItem[dartx.length]); - } - } else { - buff.write('\nExpected: '); - src__matcher__core_matchers._StringEqualsMatcher._writeLeading(buff, escapedValue, start); - src__matcher__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedValue, start); - buff.write('\n Actual: '); - src__matcher__core_matchers._StringEqualsMatcher._writeLeading(buff, escapedItem, start); - src__matcher__core_matchers._StringEqualsMatcher._writeTrailing(buff, escapedItem, start); - buff.write('\n '); - for (let i = dart.notNull(start) > 10 ? 14 : start; dart.notNull(i) > 0; i = dart.notNull(i) - 1) - buff.write(' '); - buff.write(dart.str`^\n Differ at offset ${start}`); - } - return mismatchDescription.replace(buff.toString()); - } - } - static _writeLeading(buff, s, start) { - if (dart.notNull(start) > 10) { - buff.write('... '); - buff.write(s[dartx.substring](dart.notNull(start) - 10, start)); - } else { - buff.write(s[dartx.substring](0, start)); - } - } - static _writeTrailing(buff, s, start) { - if (dart.notNull(start) + 10 > dart.notNull(s[dartx.length])) { - buff.write(s[dartx.substring](start)); - } else { - buff.write(s[dartx.substring](start, dart.notNull(start) + 10)); - buff.write(' ...'); - } - } - }; - dart.setSignature(src__matcher__core_matchers._StringEqualsMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._StringEqualsMatcher, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }), - statics: () => ({ - _writeLeading: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.int]), - _writeTrailing: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.int]) - }), - names: ['_writeLeading', '_writeTrailing'] - }); - src__matcher__core_matchers._HasLength = class _HasLength extends src__matcher__interfaces.Matcher { - new(matcher) { - if (matcher === void 0) matcher = null; - this[_matcher] = matcher; - super.new(); - } - matches(item, matchState) { - try { - if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dart.dload(item, 'length')), '>=', 0))) { - return this[_matcher].matches(dart.dload(item, 'length'), matchState); - } - } catch (e) { - } - - return false; - } - describe(description) { - return description.add('an object with length of ').addDescriptionOf(this[_matcher]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - try { - if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dart.dload(item, 'length')), '>=', 0))) { - return mismatchDescription.add('has length of ').addDescriptionOf(dart.dload(item, 'length')); - } - } catch (e) { - } - - return mismatchDescription.add('has no length property'); - } - }; - dart.setSignature(src__matcher__core_matchers._HasLength, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._HasLength, [], [src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers._Contains = class _Contains extends src__matcher__interfaces.Matcher { - new(expected) { - this[_expected] = expected; - super.new(); - } - matches(item, matchState) { - if (typeof item == 'string') { - return dart.notNull(item[dartx.indexOf](core.Pattern._check(this[_expected]))) >= 0; - } else if (core.Iterable.is(item)) { - if (src__matcher__interfaces.Matcher.is(this[_expected])) { - return item[dartx.any](dart.fn(e => core.bool._check(dart.dsend(this[_expected], 'matches', e, matchState)), dynamicTobool$())); - } else { - return item[dartx.contains](this[_expected]); - } - } else if (core.Map.is(item)) { - return item[dartx.containsKey](this[_expected]); - } - return false; - } - describe(description) { - return description.add('contains ').addDescriptionOf(this[_expected]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (typeof item == 'string' || core.Iterable.is(item) || core.Map.is(item)) { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } else { - return mismatchDescription.add('is not a string, map or iterable'); - } - } - }; - dart.setSignature(src__matcher__core_matchers._Contains, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._Contains, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers._In = class _In extends src__matcher__interfaces.Matcher { - new(expected) { - this[_expected] = expected; - super.new(); - } - matches(item, matchState) { - if (typeof this[_expected] == 'string') { - return core.bool._check(dart.dsend(dart.dsend(this[_expected], 'indexOf', item), '>=', 0)); - } else if (core.Iterable.is(this[_expected])) { - return core.bool._check(dart.dsend(this[_expected], 'any', dart.fn(e => dart.equals(e, item), dynamicTobool$()))); - } else if (core.Map.is(this[_expected])) { - return core.bool._check(dart.dsend(this[_expected], 'containsKey', item)); - } - return false; - } - describe(description) { - return description.add('is in ').addDescriptionOf(this[_expected]); - } - }; - dart.setSignature(src__matcher__core_matchers._In, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._In, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__core_matchers._PredicateFunction = dart.typedef('_PredicateFunction', () => dart.functionType(core.bool, [dart.dynamic])); - const _description = Symbol('_description'); - src__matcher__core_matchers._Predicate = class _Predicate extends src__matcher__interfaces.Matcher { - new(matcher, description) { - this[_matcher] = matcher; - this[_description] = description; - super.new(); - } - matches(item, matchState) { - return dart.dcall(this[_matcher], item); - } - describe(description) { - return description.add(this[_description]); - } - }; - dart.setSignature(src__matcher__core_matchers._Predicate, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__core_matchers._Predicate, [src__matcher__core_matchers._PredicateFunction, core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__pretty_print.prettyPrint = function(object, opts) { - let maxLineLength = opts && 'maxLineLength' in opts ? opts.maxLineLength : null; - let maxItems = opts && 'maxItems' in opts ? opts.maxItems : null; - function _prettyPrint(object, indent, seen, top) { - if (src__matcher__interfaces.Matcher.is(object)) { - let description = new src__matcher__description.StringDescription(); - object.describe(description); - return dart.str`<${description}>`; - } - if (dart.test(seen.contains(object))) return "(recursive)"; - seen = seen.union(core.Set.from([object])); - function pp(child) { - return _prettyPrint(child, dart.notNull(indent) + 2, seen, false); - } - dart.fn(pp, dynamicToString()); - if (core.Iterable.is(object)) { - let type = core.List.is(object) ? "" : dart.notNull(src__matcher__pretty_print._typeName(object)) + ":"; - let strings = object[dartx.map](core.String)(pp)[dartx.toList](); - if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNull(maxItems)) { - strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.length], JSArrayOfString().of(['...'])); - } - let singleLine = dart.str`${type}[${strings[dartx.join](', ')}]`; - if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + dart.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dartx.contains]("\n"))) { - return singleLine; - } - return dart.str`${type}[\n` + dart.notNull(strings[dartx.map](core.String)(dart.fn(string => dart.notNull(src__matcher__pretty_print._indent(dart.notNull(indent) + 2)) + dart.notNull(string), StringToString()))[dartx.join](",\n")) + "\n" + dart.notNull(src__matcher__pretty_print._indent(indent)) + "]"; - } else if (core.Map.is(object)) { - let strings = object[dartx.keys][dartx.map](core.String)(dart.fn(key => dart.str`${pp(key)}: ${pp(object[dartx.get](key))}`, dynamicToString()))[dartx.toList](); - if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNull(maxItems)) { - strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.length], JSArrayOfString().of(['...'])); - } - let singleLine = dart.str`{${strings[dartx.join](", ")}}`; - if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + dart.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dartx.contains]("\n"))) { - return singleLine; - } - return "{\n" + dart.notNull(strings[dartx.map](core.String)(dart.fn(string => dart.notNull(src__matcher__pretty_print._indent(dart.notNull(indent) + 2)) + dart.notNull(string), StringToString()))[dartx.join](",\n")) + "\n" + dart.notNull(src__matcher__pretty_print._indent(indent)) + "}"; - } else if (typeof object == 'string') { - let lines = object[dartx.split]("\n"); - return "'" + dart.notNull(lines[dartx.map](core.String)(src__matcher__pretty_print._escapeString)[dartx.join](dart.str`\\n'\n${src__matcher__pretty_print._indent(dart.notNull(indent) + 2)}'`)) + "'"; - } else { - let value = dart.toString(object)[dartx.replaceAll]("\n", dart.notNull(src__matcher__pretty_print._indent(indent)) + "\n"); - let defaultToString = value[dartx.startsWith]("Instance of "); - if (dart.test(top)) value = dart.str`<${value}>`; - if (typeof object == 'number' || typeof object == 'boolean' || core.Function.is(object) || object == null || dart.test(defaultToString)) { - return value; - } else { - return dart.str`${src__matcher__pretty_print._typeName(object)}:${value}`; - } - } - } - dart.fn(_prettyPrint, dynamicAndintAndSet__ToString()); - return _prettyPrint(object, 0, core.Set.new(), true); - }; - dart.fn(src__matcher__pretty_print.prettyPrint, dynamic__ToString()); - src__matcher__pretty_print._indent = function(length) { - return ListOfString().filled(length, ' ')[dartx.join](''); - }; - dart.fn(src__matcher__pretty_print._indent, intToString()); - src__matcher__pretty_print._typeName = function(x) { - try { - if (x == null) return "null"; - let type = dart.toString(dart.runtimeType(x)); - return dart.test(type[dartx.startsWith]("_")) ? "?" : type; - } catch (e) { - return "?"; - } - - }; - dart.fn(src__matcher__pretty_print._typeName, dynamicToString()); - src__matcher__pretty_print._escapeString = function(source) { - return src__matcher__util.escape(source)[dartx.replaceAll]("'", "\\'"); - }; - dart.fn(src__matcher__pretty_print._escapeString, StringToString()); - src__matcher__util._Predicate = dart.typedef('_Predicate', () => dart.functionType(core.bool, [dart.dynamic])); - src__matcher__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'}, core.String, core.String)); - dart.defineLazy(src__matcher__util, { - get _escapeRegExp() { - return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__matcher__util._escapeMap[dartx.keys][dartx.map](core.String)(src__matcher__util._getHexLiteral)[dartx.join]()}]`); - } - }); - src__matcher__util._getHexLiteral = function(input) { - let rune = input[dartx.runes].single; - return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase]()[dartx.padLeft](2, '0')); - }; - dart.fn(src__matcher__util._getHexLiteral, StringToString()); - src__matcher__expect._assertFailureHandler = null; - src__matcher__expect._assertErrorFormatter = null; - src__matcher__expect._defaultErrorFormatter = function(actual, matcher, reason, matchState, verbose) { - let description = new src__matcher__description.StringDescription(); - description.add('Expected: ').addDescriptionOf(matcher).add('\n'); - description.add(' Actual: ').addDescriptionOf(actual).add('\n'); - let mismatchDescription = new src__matcher__description.StringDescription(); - matcher.describeMismatch(actual, mismatchDescription, matchState, verbose); - if (dart.notNull(mismatchDescription.length) > 0) { - description.add(dart.str` Which: ${mismatchDescription}\n`); - } - if (reason != null) { - description.add(reason).add('\n'); - } - return description.toString(); - }; - dart.fn(src__matcher__expect._defaultErrorFormatter, dynamicAndMatcherAndString__ToString()); - const _matcher$1 = Symbol('_matcher'); - src__matcher__iterable_matchers._IterableMatcher = class _IterableMatcher extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Iterable.is(item)) { - return mismatchDescription.addDescriptionOf(item).add(' not an Iterable'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__matcher__iterable_matchers._IterableMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._IterableMatcher, [])}) - }); - src__matcher__iterable_matchers._EveryElement = class _EveryElement extends src__matcher__iterable_matchers._IterableMatcher { - new(matcher) { - this[_matcher$1] = matcher; - super.new(); - } - matches(item, matchState) { - if (!core.Iterable.is(item)) { - return false; - } - let i = 0; - for (let element of core.Iterable._check(item)) { - if (!dart.test(this[_matcher$1].matches(element, matchState))) { - src__matcher__util.addStateInfo(matchState, dart.map({index: i, element: element}, core.String, dart.dynamic)); - return false; - } - ++i; - } - return true; - } - describe(description) { - return description.add('every element(').addDescriptionOf(this[_matcher$1]).add(')'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (matchState[dartx.get]('index') != null) { - let index = matchState[dartx.get]('index'); - let element = matchState[dartx.get]('element'); - mismatchDescription.add('has value ').addDescriptionOf(element).add(' which '); - let subDescription = new src__matcher__description.StringDescription(); - this[_matcher$1].describeMismatch(element, subDescription, core.Map._check(matchState[dartx.get]('state')), verbose); - if (dart.notNull(subDescription.length) > 0) { - mismatchDescription.add(subDescription.toString()); - } else { - mismatchDescription.add("doesn't match "); - this[_matcher$1].describe(mismatchDescription); - } - mismatchDescription.add(dart.str` at index ${index}`); - return mismatchDescription; - } - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - }; - dart.setSignature(src__matcher__iterable_matchers._EveryElement, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._EveryElement, [src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__iterable_matchers._AnyElement = class _AnyElement extends src__matcher__iterable_matchers._IterableMatcher { - new(matcher) { - this[_matcher$1] = matcher; - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dsend(item, 'any', dart.fn(e => this[_matcher$1].matches(e, matchState), dynamicTobool$()))); - } - describe(description) { - return description.add('some element ').addDescriptionOf(this[_matcher$1]); - } - }; - dart.setSignature(src__matcher__iterable_matchers._AnyElement, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._AnyElement, [src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _expected$ = Symbol('_expected'); - src__matcher__iterable_matchers._OrderedEquals = class _OrderedEquals extends src__matcher__interfaces.Matcher { - new(expected) { - this[_expected$] = expected; - this[_matcher$1] = null; - super.new(); - this[_matcher$1] = src__matcher__core_matchers.equals(this[_expected$], 1); - } - matches(item, matchState) { - return core.Iterable.is(item) && dart.test(this[_matcher$1].matches(item, matchState)); - } - describe(description) { - return description.add('equals ').addDescriptionOf(this[_expected$]).add(' ordered'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Iterable.is(item)) { - return mismatchDescription.add('is not an Iterable'); - } else { - return this[_matcher$1].describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__matcher__iterable_matchers._OrderedEquals, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._OrderedEquals, [core.Iterable])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _expectedValues = Symbol('_expectedValues'); - const _test = Symbol('_test'); - src__matcher__iterable_matchers._UnorderedMatches = class _UnorderedMatches extends src__matcher__interfaces.Matcher { - new(expected) { - this[_expected$] = expected[dartx.map](src__matcher__interfaces.Matcher)(src__matcher__util.wrapMatcher)[dartx.toList](); - super.new(); - } - [_test](item) { - if (!core.Iterable.is(item)) return 'not iterable'; - item = dart.dsend(item, 'toList'); - if (dart.notNull(this[_expected$][dartx.length]) > dart.notNull(core.num._check(dart.dload(item, 'length')))) { - return dart.str`has too few elements (${dart.dload(item, 'length')} < ${this[_expected$][dartx.length]})`; - } else if (dart.notNull(this[_expected$][dartx.length]) < dart.notNull(core.num._check(dart.dload(item, 'length')))) { - return dart.str`has too many elements (${dart.dload(item, 'length')} > ${this[_expected$][dartx.length]})`; - } - let matched = ListOfbool().filled(core.int._check(dart.dload(item, 'length')), false); - let expectedPosition = 0; - for (let expectedMatcher of this[_expected$]) { - let actualPosition = 0; - let gotMatch = false; - for (let actualElement of core.Iterable._check(item)) { - if (!dart.test(matched[dartx.get](actualPosition))) { - if (dart.test(expectedMatcher.matches(actualElement, dart.map()))) { - matched[dartx.set](actualPosition, gotMatch = true); - break; - } - } - ++actualPosition; - } - if (!gotMatch) { - return dart.toString(new src__matcher__description.StringDescription().add('has no match for ').addDescriptionOf(expectedMatcher).add(dart.str` at index ${expectedPosition}`)); - } - ++expectedPosition; - } - return null; - } - matches(item, mismatchState) { - return this[_test](item) == null; - } - describe(description) { - return description.add('matches ').addAll('[', ', ', ']', this[_expected$]).add(' unordered'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - return mismatchDescription.add(this[_test](item)); - } - }; - dart.setSignature(src__matcher__iterable_matchers._UnorderedMatches, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._UnorderedMatches, [core.Iterable])}), - methods: () => ({ - [_test]: dart.definiteFunctionType(core.String, [dart.dynamic]), - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__iterable_matchers._UnorderedEquals = class _UnorderedEquals extends src__matcher__iterable_matchers._UnorderedMatches { - new(expected) { - this[_expectedValues] = expected[dartx.toList](); - super.new(expected[dartx.map](src__matcher__interfaces.Matcher)(src__matcher__core_matchers.equals)); - } - describe(description) { - return description.add('equals ').addDescriptionOf(this[_expectedValues]).add(' unordered'); - } - }; - dart.setSignature(src__matcher__iterable_matchers._UnorderedEquals, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._UnorderedEquals, [core.Iterable])}) - }); - src__matcher__iterable_matchers._Comparator = dart.typedef('_Comparator', () => dart.functionType(core.bool, [dart.dynamic, dart.dynamic])); - const _comparator = Symbol('_comparator'); - const _description$ = Symbol('_description'); - src__matcher__iterable_matchers._PairwiseCompare = class _PairwiseCompare extends src__matcher__iterable_matchers._IterableMatcher { - new(expected, comparator, description) { - this[_expected$] = expected; - this[_comparator] = comparator; - this[_description$] = description; - super.new(); - } - matches(item, matchState) { - if (!core.Iterable.is(item)) return false; - if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length])) return false; - let iterator = dart.dload(item, 'iterator'); - let i = 0; - for (let e of this[_expected$]) { - dart.dsend(iterator, 'moveNext'); - if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'current')))) { - src__matcher__util.addStateInfo(matchState, dart.map({index: i, expected: e, actual: dart.dload(iterator, 'current')}, core.String, dart.dynamic)); - return false; - } - i++; - } - return true; - } - describe(description) { - return description.add(dart.str`pairwise ${this[_description$]} `).addDescriptionOf(this[_expected$]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!core.Iterable.is(item)) { - return mismatchDescription.add('is not an Iterable'); - } else if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length])) { - return mismatchDescription.add(dart.str`has length ${dart.dload(item, 'length')} instead of ${this[_expected$][dartx.length]}`); - } else { - return mismatchDescription.add('has ').addDescriptionOf(matchState[dartx.get]("actual")).add(dart.str` which is not ${this[_description$]} `).addDescriptionOf(matchState[dartx.get]("expected")).add(dart.str` at index ${matchState[dartx.get]("index")}`); - } - } - }; - dart.setSignature(src__matcher__iterable_matchers._PairwiseCompare, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__iterable_matchers._PairwiseCompare, [core.Iterable, src__matcher__iterable_matchers._Comparator, core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _value$0 = Symbol('_value'); - src__matcher__map_matchers._ContainsValue = class _ContainsValue extends src__matcher__interfaces.Matcher { - new(value) { - this[_value$0] = value; - super.new(); - } - matches(item, matchState) { - return core.bool._check(dart.dsend(item, 'containsValue', this[_value$0])); - } - describe(description) { - return description.add('contains value ').addDescriptionOf(this[_value$0]); - } - }; - dart.setSignature(src__matcher__map_matchers._ContainsValue, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__map_matchers._ContainsValue, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _key = Symbol('_key'); - const _valueMatcher = Symbol('_valueMatcher'); - src__matcher__map_matchers._ContainsMapping = class _ContainsMapping extends src__matcher__interfaces.Matcher { - new(key, valueMatcher) { - this[_key] = key; - this[_valueMatcher] = valueMatcher; - super.new(); - } - matches(item, matchState) { - return dart.test(dart.dsend(item, 'containsKey', this[_key])) && dart.test(this[_valueMatcher].matches(dart.dindex(item, this[_key]), matchState)); - } - describe(description) { - return description.add('contains pair ').addDescriptionOf(this[_key]).add(' => ').addDescriptionOf(this[_valueMatcher]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!dart.test(dart.dsend(item, 'containsKey', this[_key]))) { - return mismatchDescription.add(" doesn't contain key ").addDescriptionOf(this[_key]); - } else { - mismatchDescription.add(' contains key ').addDescriptionOf(this[_key]).add(' but with value '); - this[_valueMatcher].describeMismatch(dart.dindex(item, this[_key]), mismatchDescription, matchState, verbose); - return mismatchDescription; - } - } - }; - dart.setSignature(src__matcher__map_matchers._ContainsMapping, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__map_matchers._ContainsMapping, [dart.dynamic, src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__numeric_matchers._isNumeric = function(value) { - return typeof value == 'number'; - }; - dart.fn(src__matcher__numeric_matchers._isNumeric, dynamicTobool$()); - const _delta = Symbol('_delta'); - src__matcher__numeric_matchers._IsCloseTo = class _IsCloseTo extends src__matcher__interfaces.Matcher { - new(value, delta) { - this[_value] = value; - this[_delta] = delta; - super.new(); - } - matches(item, matchState) { - if (!dart.test(src__matcher__numeric_matchers._isNumeric(item))) { - return false; - } - let diff = dart.dsend(item, '-', this[_value]); - if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-'); - return core.bool._check(dart.dsend(diff, '<=', this[_delta])); - } - describe(description) { - return description.add('a numeric value within ').addDescriptionOf(this[_delta]).add(' of ').addDescriptionOf(this[_value]); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'number')) { - return mismatchDescription.add(' not numeric'); - } else { - let diff = dart.dsend(item, '-', this[_value]); - if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-'); - return mismatchDescription.add(' differs by ').addDescriptionOf(diff); - } - } - }; - dart.setSignature(src__matcher__numeric_matchers._IsCloseTo, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__numeric_matchers._IsCloseTo, [core.num, core.num])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _low = Symbol('_low'); - const _high = Symbol('_high'); - const _lowMatchValue = Symbol('_lowMatchValue'); - const _highMatchValue = Symbol('_highMatchValue'); - src__matcher__numeric_matchers._InRange = class _InRange extends src__matcher__interfaces.Matcher { - new(low, high, lowMatchValue, highMatchValue) { - this[_low] = low; - this[_high] = high; - this[_lowMatchValue] = lowMatchValue; - this[_highMatchValue] = highMatchValue; - super.new(); - } - matches(value, matchState) { - if (!(typeof value == 'number')) { - return false; - } - if (dart.test(dart.dsend(value, '<', this[_low])) || dart.test(dart.dsend(value, '>', this[_high]))) { - return false; - } - if (dart.equals(value, this[_low])) { - return this[_lowMatchValue]; - } - if (dart.equals(value, this[_high])) { - return this[_highMatchValue]; - } - return true; - } - describe(description) { - return description.add("be in range from " + dart.str`${this[_low]} (${dart.test(this[_lowMatchValue]) ? 'inclusive' : 'exclusive'}) to ` + dart.str`${this[_high]} (${dart.test(this[_highMatchValue]) ? 'inclusive' : 'exclusive'})`); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'number')) { - return mismatchDescription.addDescriptionOf(item).add(' not numeric'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__matcher__numeric_matchers._InRange, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__numeric_matchers._InRange, [core.num, core.num, core.bool, core.bool])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _matcher$2 = Symbol('_matcher'); - src__matcher__operator_matchers._IsNot = class _IsNot extends src__matcher__interfaces.Matcher { - new(matcher) { - this[_matcher$2] = matcher; - super.new(); - } - matches(item, matchState) { - return !dart.test(this[_matcher$2].matches(item, matchState)); - } - describe(description) { - return description.add('not ').addDescriptionOf(this[_matcher$2]); - } - }; - dart.setSignature(src__matcher__operator_matchers._IsNot, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__operator_matchers._IsNot, [src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _matchers = Symbol('_matchers'); - src__matcher__operator_matchers._AllOf = class _AllOf extends src__matcher__interfaces.Matcher { - new(matchers) { - this[_matchers] = matchers; - super.new(); - } - matches(item, matchState) { - for (let matcher of this[_matchers]) { - if (!dart.test(matcher.matches(item, matchState))) { - src__matcher__util.addStateInfo(matchState, dart.map({matcher: matcher}, core.String, src__matcher__interfaces.Matcher)); - return false; - } - } - return true; - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - let matcher = matchState[dartx.get]('matcher'); - dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchState[dartx.get]('state'), verbose); - return mismatchDescription; - } - describe(description) { - return description.addAll('(', ' and ', ')', this[_matchers]); - } - }; - dart.setSignature(src__matcher__operator_matchers._AllOf, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__operator_matchers._AllOf, [core.List$(src__matcher__interfaces.Matcher)])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__operator_matchers._AnyOf = class _AnyOf extends src__matcher__interfaces.Matcher { - new(matchers) { - this[_matchers] = matchers; - super.new(); - } - matches(item, matchState) { - for (let matcher of this[_matchers]) { - if (dart.test(matcher.matches(item, matchState))) { - return true; - } - } - return false; - } - describe(description) { - return description.addAll('(', ' or ', ')', this[_matchers]); - } - }; - dart.setSignature(src__matcher__operator_matchers._AnyOf, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__operator_matchers._AnyOf, [core.List$(src__matcher__interfaces.Matcher)])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__operator_matchers._wrapArgs = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - let args = null; - if (core.List.is(arg0)) { - if (arg1 != null || arg2 != null || arg3 != null || arg4 != null || arg5 != null || arg6 != null) { - dart.throw(new core.ArgumentError('If arg0 is a List, all other arguments must be' + ' null.')); - } - args = arg0; - } else { - args = [arg0, arg1, arg2, arg3, arg4, arg5, arg6][dartx.where](dart.fn(e => e != null, dynamicTobool$())); - } - return args[dartx.map](src__matcher__interfaces.Matcher)(dart.fn(e => src__matcher__util.wrapMatcher(e), dynamicToMatcher()))[dartx.toList](); - }; - dart.fn(src__matcher__operator_matchers._wrapArgs, dynamicAnddynamicAnddynamic__ToListOfMatcher()); - const _matcher$3 = Symbol('_matcher'); - src__matcher__prints_matcher._Prints = class _Prints extends src__matcher__interfaces.Matcher { - new(matcher) { - this[_matcher$3] = matcher; - super.new(); - } - matches(item, matchState) { - if (!core.Function.is(item)) return false; - let buffer = new core.StringBuffer(); - let result = async.runZoned(dart.dynamic)(VoidTodynamic()._check(item), {zoneSpecification: async.ZoneSpecification.new({print: dart.fn((_, __, ____, line) => { - buffer.writeln(line); - }, ZoneAndZoneDelegateAndZone__Tovoid())})}); - if (!async.Future.is(result)) { - let actual = buffer.toString(); - matchState[dartx.set]('prints.actual', actual); - return this[_matcher$3].matches(actual, matchState); - } - return src__matcher__future_matchers.completes.matches(dart.dsend(result, 'then', dart.dcall(src__matcher__expect.wrapAsync, dart.fn(_ => { - src__matcher__expect.expect(buffer.toString(), this[_matcher$3]); - }, dynamicTodynamic()), 'prints')), matchState); - } - describe(description) { - return description.add('prints ').addDescriptionOf(this[_matcher$3]); - } - describeMismatch(item, description, matchState, verbose) { - let actual = matchState[dartx.remove]('prints.actual'); - if (actual == null) return description; - if (dart.test(dart.dload(actual, 'isEmpty'))) return description.add("printed nothing."); - description.add('printed ').addDescriptionOf(actual); - let innerMismatch = dart.toString(this[_matcher$3].describeMismatch(actual, new src__matcher__description.StringDescription(), matchState, verbose)); - if (dart.test(innerMismatch[dartx.isNotEmpty])) { - description.add('\n Which: ').add(dart.toString(innerMismatch)); - } - return description; - } - }; - dart.setSignature(src__matcher__prints_matcher._Prints, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__prints_matcher._Prints, [src__matcher__interfaces.Matcher])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _value$1 = Symbol('_value'); - const _matchValue = Symbol('_matchValue'); - src__matcher__string_matchers._StringMatcher = class _StringMatcher extends src__matcher__interfaces.Matcher { - new() { - super.new(); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (!(typeof item == 'string')) { - return mismatchDescription.addDescriptionOf(item).add(' not a string'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__matcher__string_matchers._StringMatcher, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._StringMatcher, [])}) - }); - src__matcher__string_matchers._IsEqualIgnoringCase = class _IsEqualIgnoringCase extends src__matcher__string_matchers._StringMatcher { - new(value) { - this[_value$1] = value; - this[_matchValue] = value[dartx.toLowerCase](); - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && this[_matchValue] == item[dartx.toLowerCase](); - } - describe(description) { - return description.addDescriptionOf(this[_value$1]).add(' ignoring case'); - } - }; - dart.setSignature(src__matcher__string_matchers._IsEqualIgnoringCase, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._IsEqualIgnoringCase, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__string_matchers._IsEqualIgnoringWhitespace = class _IsEqualIgnoringWhitespace extends src__matcher__string_matchers._StringMatcher { - new(value) { - this[_value$1] = value; - this[_matchValue] = src__matcher__string_matchers.collapseWhitespace(value); - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && this[_matchValue] == src__matcher__string_matchers.collapseWhitespace(item); - } - describe(description) { - return description.addDescriptionOf(this[_matchValue]).add(' ignoring whitespace'); - } - describeMismatch(item, mismatchDescription, matchState, verbose) { - if (typeof item == 'string') { - return mismatchDescription.add('is ').addDescriptionOf(src__matcher__string_matchers.collapseWhitespace(item)).add(' with whitespace compressed'); - } else { - return super.describeMismatch(item, mismatchDescription, matchState, verbose); - } - } - }; - dart.setSignature(src__matcher__string_matchers._IsEqualIgnoringWhitespace, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._IsEqualIgnoringWhitespace, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _prefix = Symbol('_prefix'); - src__matcher__string_matchers._StringStartsWith = class _StringStartsWith extends src__matcher__string_matchers._StringMatcher { - new(prefix) { - this[_prefix] = prefix; - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && dart.test(item[dartx.startsWith](this[_prefix])); - } - describe(description) { - return description.add('a string starting with ').addDescriptionOf(this[_prefix]); - } - }; - dart.setSignature(src__matcher__string_matchers._StringStartsWith, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._StringStartsWith, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _suffix = Symbol('_suffix'); - src__matcher__string_matchers._StringEndsWith = class _StringEndsWith extends src__matcher__string_matchers._StringMatcher { - new(suffix) { - this[_suffix] = suffix; - super.new(); - } - matches(item, matchState) { - return typeof item == 'string' && dart.test(item[dartx.endsWith](this[_suffix])); - } - describe(description) { - return description.add('a string ending with ').addDescriptionOf(this[_suffix]); - } - }; - dart.setSignature(src__matcher__string_matchers._StringEndsWith, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._StringEndsWith, [core.String])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _substrings = Symbol('_substrings'); - src__matcher__string_matchers._StringContainsInOrder = class _StringContainsInOrder extends src__matcher__string_matchers._StringMatcher { - new(substrings) { - this[_substrings] = substrings; - super.new(); - } - matches(item, matchState) { - if (!(typeof item == 'string')) { - return false; - } - let from_index = 0; - for (let s of this[_substrings]) { - from_index = core.int._check(dart.dsend(item, 'indexOf', s, from_index)); - if (dart.notNull(from_index) < 0) return false; - } - return true; - } - describe(description) { - return description.addAll('a string containing ', ', ', ' in order', this[_substrings]); - } - }; - dart.setSignature(src__matcher__string_matchers._StringContainsInOrder, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._StringContainsInOrder, [core.List$(core.String)])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - const _regexp = Symbol('_regexp'); - src__matcher__string_matchers._MatchesRegExp = class _MatchesRegExp extends src__matcher__string_matchers._StringMatcher { - new(re) { - this[_regexp] = null; - super.new(); - if (typeof re == 'string') { - this[_regexp] = core.RegExp.new(re); - } else if (core.RegExp.is(re)) { - this[_regexp] = re; - } else { - dart.throw(new core.ArgumentError('matches requires a regexp or string')); - } - } - matches(item, matchState) { - return typeof item == 'string' ? this[_regexp].hasMatch(item) : false; - } - describe(description) { - return description.add(dart.str`match '${this[_regexp].pattern}'`); - } - }; - dart.setSignature(src__matcher__string_matchers._MatchesRegExp, { - constructors: () => ({new: dart.definiteFunctionType(src__matcher__string_matchers._MatchesRegExp, [dart.dynamic])}), - methods: () => ({ - matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), - describe: dart.definiteFunctionType(src__matcher__interfaces.Description, [src__matcher__interfaces.Description]) - }) - }); - src__matcher__string_matchers._isWhitespace = function(ch) { - return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; - }; - dart.fn(src__matcher__string_matchers._isWhitespace, StringTobool()); - const _startTime = Symbol('_startTime'); - const _runningTime = Symbol('_runningTime'); - const _testFunction = Symbol('_testFunction'); - const _setUp = Symbol('_setUp'); - const _tearDown = Symbol('_tearDown'); - const _testComplete = Symbol('_testComplete'); - const _errorHandler = Symbol('_errorHandler'); - let const$1; - const _setResult = Symbol('_setResult'); - const _complete = Symbol('_complete'); - src__internal_test_case.InternalTestCase = class InternalTestCase extends core.Object { - get passed() { - return this.result == unittest.PASS; - } - get startTime() { - return this[_startTime]; - } - get runningTime() { - return this[_runningTime]; - } - get isComplete() { - return !dart.test(this.enabled) || this.result != null; - } - new(id, description, testFunction) { - this.id = id; - this.description = description; - this[_testFunction] = testFunction; - this.currentGroup = src__test_environment.environment.currentContext.fullName; - this[_setUp] = src__test_environment.environment.currentContext.testSetUp; - this[_tearDown] = src__test_environment.environment.currentContext.testTearDown; - this.callbackFunctionsOutstanding = 0; - this.message = ''; - this.result = null; - this.stackTrace = null; - this[_startTime] = null; - this[_runningTime] = null; - this.enabled = true; - this[_testComplete] = null; - } - [_errorHandler](stage) { - return dart.fn((e, stack) => { - if (stack == null && core.Error.is(e)) { - stack = e.stackTrace; - } - if (this.result == null || this.result == unittest.PASS) { - if (src__matcher__expect.TestFailure.is(e)) { - this.fail(dart.str`${e}`, core.StackTrace._check(stack)); - } else { - this.error(dart.str`${stage} failed: Caught ${e}`, core.StackTrace._check(stack)); - } - } - }, dynamicAnddynamicTodynamic()); - } - run() { - if (!dart.test(this.enabled)) return async.Future.value(); - this.result = this.stackTrace = null; - this.message = ''; - return async.Future.value().then(dart.dynamic)(dart.fn(_ => { - if (this[_setUp] != null) return dart.dcall(this[_setUp]); - }, dynamicTodynamic())).catchError(this[_errorHandler]('Setup')).then(async.Future)(dart.fn(_ => { - if (this.result != null) return async.Future.value(); - src__test_environment.config.onTestStart(this); - this[_startTime] = new core.DateTime.now(); - this[_runningTime] = null; - this.callbackFunctionsOutstanding = dart.notNull(this.callbackFunctionsOutstanding) + 1; - let testReturn = this[_testFunction](); - if (async.Future.is(testReturn)) { - this.callbackFunctionsOutstanding = dart.notNull(this.callbackFunctionsOutstanding) + 1; - testReturn.catchError(this[_errorHandler]('Test')).whenComplete(dart.bind(this, 'markCallbackComplete')); - } - }, dynamicToFuture())).catchError(this[_errorHandler]('Test')).then(dart.dynamic)(dart.fn(_ => { - this.markCallbackComplete(); - if (this.result == null) { - this[_testComplete] = async.Completer.new(); - return this[_testComplete].future.whenComplete(dart.fn(() => { - if (this[_tearDown] != null) { - return dart.dcall(this[_tearDown]); - } - }, VoidTodynamic$())).catchError(this[_errorHandler]('Teardown')); - } else if (this[_tearDown] != null) { - return dart.dcall(this[_tearDown]); - } - }, dynamicTodynamic())).catchError(this[_errorHandler]('Teardown')).whenComplete(dart.fn(() => { - this[_setUp] = null; - this[_tearDown] = null; - this[_testFunction] = null; - }, VoidTodynamic$())); - } - [_complete](testResult, messageText, stack) { - if (messageText === void 0) messageText = ''; - if (stack === void 0) stack = null; - if (this.runningTime == null) { - if (this.startTime != null) { - this[_runningTime] = new core.DateTime.now().difference(this.startTime); - } else { - this[_runningTime] = const$1 || (const$1 = dart.const(new core.Duration({seconds: 0}))); - } - } - this[_setResult](testResult, messageText, stack); - if (this[_testComplete] != null) { - let t = this[_testComplete]; - this[_testComplete] = null; - t.complete(this); - } - } - [_setResult](testResult, messageText, stack) { - this.message = messageText; - this.stackTrace = src__utils.getTrace(stack, unittest.formatStacks, unittest.filterStacks); - if (this.stackTrace == null) this.stackTrace = stack; - if (this.result == null) { - this.result = testResult; - src__test_environment.config.onTestResult(this); - } else { - this.result = testResult; - src__test_environment.config.onTestResultChanged(this); - } - } - pass() { - this[_complete](unittest.PASS); - } - registerException(error, stackTrace) { - if (stackTrace === void 0) stackTrace = null; - let message = src__matcher__expect.TestFailure.is(error) ? error.message : dart.str`Caught ${error}`; - if (this.result == null) { - this.fail(message, stackTrace); - } else { - this.error(message, stackTrace); - } - } - fail(messageText, stack) { - if (stack === void 0) stack = null; - if (this.result != null) { - let newMessage = this.result == unittest.PASS ? dart.str`Test failed after initially passing: ${messageText}` : dart.str`Test failed more than once: ${messageText}`; - this[_complete](unittest.ERROR, newMessage, stack); - } else { - this[_complete](unittest.FAIL, messageText, stack); - } - } - error(messageText, stack) { - if (stack === void 0) stack = null; - this[_complete](unittest.ERROR, messageText, stack); - } - markCallbackComplete() { - this.callbackFunctionsOutstanding = dart.notNull(this.callbackFunctionsOutstanding) - 1; - if (this.callbackFunctionsOutstanding == 0 && !dart.test(this.isComplete)) this.pass(); - } - toString() { - return this.result != null ? dart.str`${this.description}: ${this.result}` : this.description; - } - }; - src__internal_test_case.InternalTestCase[dart.implements] = () => [src__test_case.TestCase]; - dart.setSignature(src__internal_test_case.InternalTestCase, { - constructors: () => ({new: dart.definiteFunctionType(src__internal_test_case.InternalTestCase, [core.int, core.String, unittest.TestFunction])}), - methods: () => ({ - [_errorHandler]: dart.definiteFunctionType(core.Function, [core.String]), - run: dart.definiteFunctionType(async.Future, []), - [_complete]: dart.definiteFunctionType(dart.void, [core.String], [core.String, core.StackTrace]), - [_setResult]: dart.definiteFunctionType(dart.void, [core.String, core.String, core.StackTrace]), - pass: dart.definiteFunctionType(dart.void, []), - registerException: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]), - fail: dart.definiteFunctionType(dart.void, [core.String], [core.StackTrace]), - error: dart.definiteFunctionType(dart.void, [core.String], [core.StackTrace]), - markCallbackComplete: dart.definiteFunctionType(dart.void, []) - }) - }); - dart.defineLazy(src__test_environment, { - get _defaultEnvironment() { - return new src__test_environment.TestEnvironment(); - } - }); - let const$2; - dart.copyProperties(src__test_environment, { - get environment() { - let environment = async.Zone.current.get(const$2 || (const$2 = dart.const(core.Symbol.new('unittest.environment')))); - return src__test_environment.TestEnvironment._check(environment == null ? src__test_environment._defaultEnvironment : environment); - } - }); - dart.copyProperties(src__test_environment, { - get config() { - return src__test_environment.environment.config; - } - }); - src__test_environment.TestEnvironment = class TestEnvironment extends core.Object { - new() { - this.rootContext = new src__group_context.GroupContext.root(); - this.lastBreath = new core.DateTime.now().millisecondsSinceEpoch; - this.testCases = ListOfInternalTestCase().new(); - this.config = null; - this.currentContext = null; - this.currentTestCaseIndex = -1; - this.initialized = false; - this.soloNestingLevel = 0; - this.soloTestSeen = false; - this.uncaughtErrorMessage = null; - this.currentContext = this.rootContext; - } - }; - dart.setSignature(src__test_environment.TestEnvironment, { - constructors: () => ({new: dart.definiteFunctionType(src__test_environment.TestEnvironment, [])}) - }); - const _testSetUp = Symbol('_testSetUp'); - const _testTearDown = Symbol('_testTearDown'); - const _name$ = Symbol('_name'); - src__group_context.GroupContext = class GroupContext extends core.Object { - get isRoot() { - return this.parent == null; - } - get testSetUp() { - return this[_testSetUp]; - } - set testSetUp(setUp) { - if (this.parent == null || this.parent.testSetUp == null) { - this[_testSetUp] = setUp; - return; - } - this[_testSetUp] = dart.fn(() => { - let f = dart.dsend(this.parent, 'testSetUp'); - if (async.Future.is(f)) { - return f.then(dart.dynamic)(dart.fn(_ => dart.dcall(setUp), dynamicTodynamic())); - } else { - return dart.dcall(setUp); - } - }, VoidTodynamic$()); - } - get testTearDown() { - return this[_testTearDown]; - } - set testTearDown(tearDown) { - if (this.parent == null || this.parent.testTearDown == null) { - this[_testTearDown] = tearDown; - return; - } - this[_testTearDown] = dart.fn(() => { - let f = dart.dcall(tearDown); - if (async.Future.is(f)) { - return f.then(dart.dynamic)(dart.fn(_ => dart.dsend(this.parent, 'testTearDown'), dynamicTodynamic())); - } else { - return dart.dsend(this.parent, 'testTearDown'); - } - }, VoidTodynamic$()); - } - get fullName() { - return dart.test(this.isRoot) || dart.test(this.parent.isRoot) ? this[_name$] : dart.str`${this.parent.fullName}${unittest.groupSep}${this[_name$]}`; - } - root() { - this.parent = null; - this[_name$] = ''; - this[_testSetUp] = null; - this[_testTearDown] = null; - } - new(parent, name) { - this.parent = parent; - this[_name$] = name; - this[_testSetUp] = null; - this[_testTearDown] = null; - this[_testSetUp] = this.parent.testSetUp; - this[_testTearDown] = this.parent.testTearDown; - } - }; - dart.defineNamedConstructor(src__group_context.GroupContext, 'root'); - dart.setSignature(src__group_context.GroupContext, { - constructors: () => ({ - root: dart.definiteFunctionType(src__group_context.GroupContext, []), - new: dart.definiteFunctionType(src__group_context.GroupContext, [src__group_context.GroupContext, core.String]) - }) - }); - src__utils.indent = function(str) { - return str[dartx.replaceAll](core.RegExp.new("^", {multiLine: true}), " "); - }; - dart.fn(src__utils.indent, StringToString()); - src__utils.Pair$ = dart.generic((E, F) => { - class Pair extends core.Object { - new(first, last) { - this.first = first; - this.last = last; - } - toString() { - return dart.str`(${this.first}, ${this.last})`; - } - ['=='](other) { - if (!src__utils.Pair.is(other)) return false; - return dart.equals(dart.dload(other, 'first'), this.first) && dart.equals(dart.dload(other, 'last'), this.last); - } - get hashCode() { - return (dart.notNull(dart.hashCode(this.first)) ^ dart.notNull(dart.hashCode(this.last))) >>> 0; - } - } - dart.addTypeTests(Pair); - dart.setSignature(Pair, { - constructors: () => ({new: dart.definiteFunctionType(src__utils.Pair$(E, F), [E, F])}) - }); - return Pair; - }); - src__utils.Pair = Pair(); - src__utils.getTrace = function(stack, formatStacks, filterStacks) { - let trace = null; - if (stack == null || !dart.test(formatStacks)) return null; - if (typeof stack == 'string') { - trace = src__trace.Trace.parse(stack); - } else if (core.StackTrace.is(stack)) { - trace = src__trace.Trace.from(stack); - } else { - dart.throw(core.Exception.new(dart.str`Invalid stack type ${dart.runtimeType(stack)} for ${stack}.`)); - } - if (!dart.test(filterStacks)) return trace; - return new src__trace.Trace(trace.frames[dartx.takeWhile](dart.fn(frame => frame.package != 'unittest' || frame.member != 'TestCase._runTest', FrameTobool()))).terse.foldFrames(dart.fn(frame => frame.package == 'unittest' || dart.test(frame.isCore), FrameTobool())); - }; - dart.fn(src__utils.getTrace, dynamicAndboolAndboolToTrace()); - src__expected_function._PLACEHOLDER = dart.const(new core.Object()); - src__expected_function._Func0 = dart.typedef('_Func0', () => dart.functionType(dart.dynamic, [])); - src__expected_function._Func1 = dart.typedef('_Func1', () => dart.functionType(dart.dynamic, [dart.dynamic])); - src__expected_function._Func2 = dart.typedef('_Func2', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic])); - src__expected_function._Func3 = dart.typedef('_Func3', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic])); - src__expected_function._Func4 = dart.typedef('_Func4', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])); - src__expected_function._Func5 = dart.typedef('_Func5', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])); - src__expected_function._Func6 = dart.typedef('_Func6', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])); - src__expected_function._IsDoneCallback = dart.typedef('_IsDoneCallback', () => dart.functionType(core.bool, [])); - const _callback = Symbol('_callback'); - const _minExpectedCalls = Symbol('_minExpectedCalls'); - const _maxExpectedCalls = Symbol('_maxExpectedCalls'); - const _isDone = Symbol('_isDone'); - const _reason = Symbol('_reason'); - const _testCase = Symbol('_testCase'); - const _id$ = Symbol('_id'); - const _actualCalls = Symbol('_actualCalls'); - const _complete$ = Symbol('_complete'); - const _max6 = Symbol('_max6'); - const _max5 = Symbol('_max5'); - const _max4 = Symbol('_max4'); - const _max3 = Symbol('_max3'); - const _max2 = Symbol('_max2'); - const _max1 = Symbol('_max1'); - const _max0 = Symbol('_max0'); - const _run = Symbol('_run'); - const _afterRun = Symbol('_afterRun'); - src__expected_function.ExpectedFunction = class ExpectedFunction extends core.Object { - new(callback, minExpected, maxExpected, opts) { - let id = opts && 'id' in opts ? opts.id : null; - let reason = opts && 'reason' in opts ? opts.reason : null; - let isDone = opts && 'isDone' in opts ? opts.isDone : null; - this[_callback] = callback; - this[_minExpectedCalls] = minExpected; - this[_maxExpectedCalls] = maxExpected == 0 && dart.notNull(minExpected) > 0 ? minExpected : maxExpected; - this[_isDone] = isDone; - this[_reason] = reason == null ? '' : dart.str`\n${reason}`; - this[_testCase] = src__internal_test_case.InternalTestCase.as(unittest.currentTestCase); - this[_id$] = src__expected_function.ExpectedFunction._makeCallbackId(id, callback); - this[_actualCalls] = 0; - this[_complete$] = null; - unittest.ensureInitialized(); - if (this[_testCase] == null) { - dart.throw(new core.StateError("No valid test. Did you forget to run your test " + "inside a call to test()?")); - } - if (isDone != null || dart.notNull(minExpected) > 0) { - this[_testCase].callbackFunctionsOutstanding = dart.notNull(this[_testCase].callbackFunctionsOutstanding) + 1; - this[_complete$] = false; - } else { - this[_complete$] = true; - } - } - static _makeCallbackId(id, callback) { - if (id != null) return dart.str`${id} `; - let toString = dart.toString(callback); - let prefix = "Function '"; - let start = toString[dartx.indexOf](prefix); - if (start == -1) return ''; - start = dart.notNull(start) + dart.notNull(prefix[dartx.length]); - let end = toString[dartx.indexOf]("'", start); - if (end == -1) return ''; - return dart.str`${toString[dartx.substring](start, end)} `; - } - get func() { - if (src__expected_function._Func6.is(this[_callback])) return dart.bind(this, _max6); - if (src__expected_function._Func5.is(this[_callback])) return dart.bind(this, _max5); - if (src__expected_function._Func4.is(this[_callback])) return dart.bind(this, _max4); - if (src__expected_function._Func3.is(this[_callback])) return dart.bind(this, _max3); - if (src__expected_function._Func2.is(this[_callback])) return dart.bind(this, _max2); - if (src__expected_function._Func1.is(this[_callback])) return dart.bind(this, _max1); - if (src__expected_function._Func0.is(this[_callback])) return dart.bind(this, _max0); - dart.throw(new core.ArgumentError('The wrapped function has more than 6 required arguments')); - } - [_max0]() { - return this[_max6](); - } - [_max1](a0) { - if (a0 === void 0) a0 = src__expected_function._PLACEHOLDER; - return this[_max6](a0); - } - [_max2](a0, a1) { - if (a0 === void 0) a0 = src__expected_function._PLACEHOLDER; - if (a1 === void 0) a1 = src__expected_function._PLACEHOLDER; - return this[_max6](a0, a1); - } - [_max3](a0, a1, a2) { - if (a0 === void 0) a0 = src__expected_function._PLACEHOLDER; - if (a1 === void 0) a1 = src__expected_function._PLACEHOLDER; - if (a2 === void 0) a2 = src__expected_function._PLACEHOLDER; - return this[_max6](a0, a1, a2); - } - [_max4](a0, a1, a2, a3) { - if (a0 === void 0) a0 = src__expected_function._PLACEHOLDER; - if (a1 === void 0) a1 = src__expected_function._PLACEHOLDER; - if (a2 === void 0) a2 = src__expected_function._PLACEHOLDER; - if (a3 === void 0) a3 = src__expected_function._PLACEHOLDER; - return this[_max6](a0, a1, a2, a3); - } - [_max5](a0, a1, a2, a3, a4) { - if (a0 === void 0) a0 = src__expected_function._PLACEHOLDER; - if (a1 === void 0) a1 = src__expected_function._PLACEHOLDER; - if (a2 === void 0) a2 = src__expected_function._PLACEHOLDER; - if (a3 === void 0) a3 = src__expected_function._PLACEHOLDER; - if (a4 === void 0) a4 = src__expected_function._PLACEHOLDER; - return this[_max6](a0, a1, a2, a3, a4); - } - [_max6](a0, a1, a2, a3, a4, a5) { - if (a0 === void 0) a0 = src__expected_function._PLACEHOLDER; - if (a1 === void 0) a1 = src__expected_function._PLACEHOLDER; - if (a2 === void 0) a2 = src__expected_function._PLACEHOLDER; - if (a3 === void 0) a3 = src__expected_function._PLACEHOLDER; - if (a4 === void 0) a4 = src__expected_function._PLACEHOLDER; - if (a5 === void 0) a5 = src__expected_function._PLACEHOLDER; - return this[_run]([a0, a1, a2, a3, a4, a5][dartx.where](dart.fn(a => !dart.equals(a, src__expected_function._PLACEHOLDER), dynamicTobool$()))); - } - [_run](args) { - try { - this[_actualCalls] = dart.notNull(this[_actualCalls]) + 1; - if (dart.test(this[_testCase].isComplete)) { - if (this[_testCase].result == unittest.PASS) { - this[_testCase].error(dart.str`Callback ${this[_id$]}called (${this[_actualCalls]}) after test case ` + dart.str`${this[_testCase].description} had already been marked as ` + dart.str`${this[_testCase].result}.${this[_reason]}`); - } - return null; - } else if (dart.notNull(this[_maxExpectedCalls]) >= 0 && dart.notNull(this[_actualCalls]) > dart.notNull(this[_maxExpectedCalls])) { - dart.throw(new src__matcher__expect.TestFailure(dart.str`Callback ${this[_id$]}called more times than expected ` + dart.str`(${this[_maxExpectedCalls]}).${this[_reason]}`)); - } - return core.Function.apply(this[_callback], args[dartx.toList]()); - } catch (error) { - let stackTrace = dart.stackTrace(error); - this[_testCase].registerException(error, stackTrace); - return null; - } - finally { - this[_afterRun](); - } - } - [_afterRun]() { - if (dart.test(this[_complete$])) return; - if (dart.notNull(this[_minExpectedCalls]) > 0 && dart.notNull(this[_actualCalls]) < dart.notNull(this[_minExpectedCalls])) return; - if (this[_isDone] != null && !dart.test(this[_isDone]())) return; - this[_complete$] = true; - this[_testCase].markCallbackComplete(); - } - }; - dart.setSignature(src__expected_function.ExpectedFunction, { - constructors: () => ({new: dart.definiteFunctionType(src__expected_function.ExpectedFunction, [core.Function, core.int, core.int], {id: core.String, reason: core.String, isDone: VoidTobool()})}), - methods: () => ({ - [_max0]: dart.definiteFunctionType(dart.dynamic, []), - [_max1]: dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic]), - [_max2]: dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic, dart.dynamic]), - [_max3]: dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic, dart.dynamic, dart.dynamic]), - [_max4]: dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_max5]: dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_max6]: dart.definiteFunctionType(dart.dynamic, [], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), - [_run]: dart.definiteFunctionType(dart.dynamic, [core.Iterable]), - [_afterRun]: dart.definiteFunctionType(dart.void, []) - }), - statics: () => ({_makeCallbackId: dart.definiteFunctionType(core.String, [core.String, core.Function])}), - names: ['_makeCallbackId'] - }); - html_config._showResultsInPage = function(passed, failed, errors, results, isLayoutTest, uncaughtError) { - if (dart.test(isLayoutTest) && passed == results[dartx.length] && uncaughtError == null) { - html.document[dartx.body][dartx.innerHtml] = "PASS"; - } else { - let newBody = new core.StringBuffer(); - newBody.write(""); - newBody.write(passed == results[dartx.length] && uncaughtError == null ? "" : ""); - for (let test_ of results) { - newBody.write(html_config._toHtml(test_)); - } - if (uncaughtError != null) { - newBody.write(dart.str`\n \n \n \n `); - } - if (passed == results[dartx.length] && uncaughtError == null) { - newBody.write(dart.str` `); - } else { - newBody.write(dart.str` `); - } - newBody.write("
PASS
FAIL
--ERRORUncaught error: ${uncaughtError}
\n All ${passed} tests passed\n
Total\n ${passed} passed,\n ${failed} failed\n \n ${dart.notNull(errors) + (uncaughtError == null ? 0 : 1)} errors\n
"); - html.document[dartx.body][dartx.innerHtml] = newBody.toString(); - html.window[dartx.onHashChange].listen(dart.fn(_ => { - if (html.window[dartx.location][dartx.hash] != null && dart.test(html.window[dartx.location][dartx.hash][dartx.contains]('testFilter'))) { - html.window[dartx.location][dartx.reload](); - } - }, EventTovoid())); - } - }; - dart.fn(html_config._showResultsInPage, intAndintAndint__Tovoid()); - html_config._toHtml = function(testCase) { - if (!dart.test(testCase.isComplete)) { - return dart.str` \n ${testCase.id}\n NO STATUS\n Test did not complete\n `; - } - let html = dart.str` \n ${testCase.id}\n \n ${testCase.result[dartx.toUpperCase]()}\n \n \n

Expectation: \n \n ${testCase.description}\n .\n

\n
${convert.HTML_ESCAPE.convert(testCase.message)}
\n \n `; - if (testCase.stackTrace != null) { - html = dart.str`${html}
` + dart.notNull(convert.HTML_ESCAPE.convert(dart.toString(testCase.stackTrace))) + '
'; - } - return html; - }; - dart.fn(html_config._toHtml, TestCaseToString()); - const _isLayoutTest = Symbol('_isLayoutTest'); - const _onErrorSubscription = Symbol('_onErrorSubscription'); - const _onMessageSubscription = Symbol('_onMessageSubscription'); - const _installHandlers = Symbol('_installHandlers'); - const _uninstallHandlers = Symbol('_uninstallHandlers'); - html_config.HtmlConfiguration = class HtmlConfiguration extends src__simple_configuration.SimpleConfiguration { - new(isLayoutTest) { - this[_isLayoutTest] = isLayoutTest; - this[_onErrorSubscription] = null; - this[_onMessageSubscription] = null; - super.new(); - } - [_installHandlers]() { - if (this[_onErrorSubscription] == null) { - this[_onErrorSubscription] = html.window[dartx.onError].listen(dart.fn(e => { - if (!dart.equals(js.context.get('testExpectsGlobalError'), true)) { - unittest.handleExternalError(e, '(DOM callback has errors)'); - } - }, EventTovoid())); - } - if (this[_onMessageSubscription] == null) { - this[_onMessageSubscription] = html.window[dartx.onMessage].listen(dart.fn(e => this.processMessage(e), MessageEventTovoid())); - } - } - [_uninstallHandlers]() { - if (this[_onErrorSubscription] != null) { - this[_onErrorSubscription].cancel(); - this[_onErrorSubscription] = null; - } - if (this[_onMessageSubscription] != null) { - this[_onMessageSubscription].cancel(); - this[_onMessageSubscription] = null; - } - } - processMessage(e) { - if (dart.equals('unittest-suite-external-error', dart.dload(e, 'data'))) { - unittest.handleExternalError('', '(external error detected)'); - } - } - onInit() { - let meta = html.MetaElement._check(html.querySelector('meta[name="dart.unittest"]')); - unittest.filterStacks = meta == null ? true : !dart.test(meta[dartx.content][dartx.contains]('full-stack-traces')); - this[_installHandlers](); - html.window[dartx.postMessage]('unittest-suite-wait-for-done', '*'); - } - onStart() { - let hash = html.window[dartx.location][dartx.hash]; - if (hash != null && dart.notNull(hash[dartx.length]) > 1) { - let params = hash[dartx.substring](1)[dartx.split]('&'); - for (let param of params) { - let parts = param[dartx.split]('='); - if (parts[dartx.length] == 2 && parts[dartx.get](0) == 'testFilter') { - unittest.filterTests(dart.str`^${parts[dartx.get](1)}`); - } - } - } - super.onStart(); - } - onSummary(passed, failed, errors, results, uncaughtError) { - html_config._showResultsInPage(passed, failed, errors, results, this[_isLayoutTest], uncaughtError); - } - onDone(success) { - this[_uninstallHandlers](); - html.window[dartx.postMessage]('unittest-suite-done', '*'); - } - }; - dart.setSignature(html_config.HtmlConfiguration, { - constructors: () => ({new: dart.definiteFunctionType(html_config.HtmlConfiguration, [core.bool])}), - methods: () => ({ - [_installHandlers]: dart.definiteFunctionType(dart.void, []), - [_uninstallHandlers]: dart.definiteFunctionType(dart.void, []), - processMessage: dart.definiteFunctionType(dart.void, [dart.dynamic]) - }) - }); - html_config.useHtmlConfiguration = function(isLayoutTest) { - if (isLayoutTest === void 0) isLayoutTest = false; - unittest.unittestConfiguration = dart.test(isLayoutTest) ? html_config._singletonLayout : html_config._singletonNotLayout; - }; - dart.fn(html_config.useHtmlConfiguration, __Tovoid$()); - dart.defineLazy(html_config, { - get _singletonLayout() { - return new html_config.HtmlConfiguration(true); - } - }); - dart.defineLazy(html_config, { - get _singletonNotLayout() { - return new html_config.HtmlConfiguration(false); - } - }); - html_individual_config.HtmlIndividualConfiguration = class HtmlIndividualConfiguration extends html_config.HtmlConfiguration { - new(isLayoutTest) { - super.new(isLayoutTest); - } - onStart() { - let uri = core.Uri.parse(html.window[dartx.location][dartx.href]); - let groups = 'group='[dartx.allMatches](uri.query)[dartx.toList](); - if (dart.notNull(groups[dartx.length]) > 1) { - dart.throw(new core.ArgumentError('More than one "group" parameter provided.')); - } - let testGroupName = uri.queryParameters[dartx.get]('group'); - if (testGroupName != null) { - let startsWith = dart.str`${testGroupName}${unittest.groupSep}`; - unittest.filterTests(dart.fn(tc => tc.description[dartx.startsWith](startsWith), TestCaseTobool())); - } - super.onStart(); - } - }; - dart.setSignature(html_individual_config.HtmlIndividualConfiguration, { - constructors: () => ({new: dart.definiteFunctionType(html_individual_config.HtmlIndividualConfiguration, [core.bool])}) - }); - html_individual_config.useHtmlIndividualConfiguration = function(isLayoutTest) { - if (isLayoutTest === void 0) isLayoutTest = false; - unittest.unittestConfiguration = dart.test(isLayoutTest) ? html_individual_config._singletonLayout : html_individual_config._singletonNotLayout; - }; - dart.fn(html_individual_config.useHtmlIndividualConfiguration, __Tovoid$()); - dart.defineLazy(html_individual_config, { - get _singletonLayout() { - return new html_individual_config.HtmlIndividualConfiguration(true); - } - }); - dart.defineLazy(html_individual_config, { - get _singletonNotLayout() { - return new html_individual_config.HtmlIndividualConfiguration(false); - } - }); - const _isLayoutTest$ = Symbol('_isLayoutTest'); - const _onErrorSubscription$ = Symbol('_onErrorSubscription'); - const _onMessageSubscription$ = Symbol('_onMessageSubscription'); - const _installOnErrorHandler = Symbol('_installOnErrorHandler'); - const _installOnMessageHandler = Symbol('_installOnMessageHandler'); - const _installHandlers$ = Symbol('_installHandlers'); - const _uninstallHandlers$ = Symbol('_uninstallHandlers'); - const _htmlTestCSS = Symbol('_htmlTestCSS'); - const _showInteractiveResultsInPage = Symbol('_showInteractiveResultsInPage'); - const _buildRow = Symbol('_buildRow'); - html_enhanced_config.HtmlEnhancedConfiguration = class HtmlEnhancedConfiguration extends src__simple_configuration.SimpleConfiguration { - new(isLayoutTest) { - this[_isLayoutTest$] = isLayoutTest; - this[_onErrorSubscription$] = null; - this[_onMessageSubscription$] = null; - super.new(); - } - [_installOnErrorHandler]() { - if (this[_onErrorSubscription$] == null) { - this[_onErrorSubscription$] = html.window[dartx.onError].listen(dart.fn(e => unittest.handleExternalError(e, '(DOM callback has errors)'), EventTovoid())); - } - } - [_installOnMessageHandler]() { - if (this[_onMessageSubscription$] == null) { - this[_onMessageSubscription$] = html.window[dartx.onMessage].listen(dart.fn(e => this.processMessage(e), MessageEventTovoid())); - } - } - [_installHandlers$]() { - this[_installOnErrorHandler](); - this[_installOnMessageHandler](); - } - [_uninstallHandlers$]() { - if (this[_onErrorSubscription$] != null) { - dart.dsend(this[_onErrorSubscription$], 'cancel'); - this[_onErrorSubscription$] = null; - } - if (this[_onMessageSubscription$] != null) { - dart.dsend(this[_onMessageSubscription$], 'cancel'); - this[_onMessageSubscription$] = null; - } - } - processMessage(e) { - if (dart.equals('unittest-suite-external-error', dart.dload(e, 'data'))) { - unittest.handleExternalError('', '(external error detected)'); - } - } - onInit() { - this[_installHandlers$](); - let _CSSID = '_unittestcss_'; - let cssElement = html.document[dartx.head][dartx.querySelector](dart.str`#${_CSSID}`); - if (cssElement == null) { - cssElement = html.StyleElement.new(); - cssElement[dartx.id] = _CSSID; - html.document[dartx.head][dartx.append](cssElement); - } - cssElement[dartx.text] = this[_htmlTestCSS]; - html.window[dartx.postMessage]('unittest-suite-wait-for-done', '*'); - } - onStart() { - this[_installOnErrorHandler](); - } - onSummary(passed, failed, errors, results, uncaughtError) { - this[_showInteractiveResultsInPage](passed, failed, errors, results, this[_isLayoutTest$], uncaughtError); - } - onDone(success) { - this[_uninstallHandlers$](); - html.window[dartx.postMessage]('unittest-suite-done', '*'); - } - [_showInteractiveResultsInPage](passed, failed, errors, results, isLayoutTest, uncaughtError) { - if (dart.test(isLayoutTest) && passed == results[dartx.length]) { - html.document[dartx.body][dartx.innerHtml] = "PASS"; - } else { - let te = html.Element.html('
'); - te[dartx.children][dartx.add](html.Element.html(passed == results[dartx.length] ? "
PASS
" : "
FAIL
")); - if (passed == results[dartx.length] && uncaughtError == null) { - te[dartx.children][dartx.add](html.Element.html(dart.str`
All ${passed} tests passed
`)); - } else { - if (uncaughtError != null) { - te[dartx.children][dartx.add](html.Element.html(dart.str`
\n Uncaught error: ${uncaughtError}\n
`)); - } - te[dartx.children][dartx.add](html.Element.html(dart.str`
\n Total ${passed} passed,\n ${failed} failed,\n \n ${dart.notNull(errors) + (uncaughtError == null ? 0 : 1)} errors\n
`)); - } - te[dartx.children][dartx.add](html.Element.html("
\n ")); - te[dartx.querySelector]('#btnCollapseAll')[dartx.onClick].listen(dart.fn(_ => { - html.document[dartx.querySelectorAll](html.Element)('.unittest-row').forEach(dart.fn(el => el[dartx.attributes][dartx.set]('class', el[dartx.attributes][dartx.get]('class')[dartx.replaceAll]('unittest-row ', 'unittest-row-hidden ')), ElementToString())); - }, MouseEventTovoid())); - let previousGroup = ''; - let groupPassFail = true; - let groupedBy = LinkedHashMapOfString$ListOfTestCase().new(); - for (let t of results) { - if (!dart.test(groupedBy.containsKey(t.currentGroup))) { - groupedBy.set(t.currentGroup, ListOfTestCase().new()); - } - groupedBy.get(t.currentGroup)[dartx.add](t); - } - let flattened = ListOfTestCase().new(); - groupedBy.values[dartx.forEach](dart.fn(tList => { - tList[dartx.sort](dart.fn((tcA, tcB) => dart.notNull(tcA.id) - dart.notNull(tcB.id), TestCaseAndTestCaseToint())); - flattened[dartx.addAll](tList); - }, ListOfTestCaseTovoid())); - let nonAlphanumeric = core.RegExp.new('[^a-z0-9A-Z]'); - for (let test_ of flattened) { - let safeGroup = test_.currentGroup[dartx.replaceAll](nonAlphanumeric, '_'); - if (test_.currentGroup != previousGroup) { - previousGroup = test_.currentGroup; - let testsInGroup = results[dartx.where](dart.fn(t => t.currentGroup == previousGroup, TestCaseTobool()))[dartx.toList](); - let groupTotalTestCount = testsInGroup[dartx.length]; - let groupTestPassedCount = testsInGroup[dartx.where](dart.fn(t => t.result == 'pass', TestCaseTobool()))[dartx.length]; - groupPassFail = groupTotalTestCount == groupTestPassedCount; - let passFailClass = "unittest-group-status unittest-group-" + dart.str`status-${groupPassFail ? 'pass' : 'fail'}`; - te[dartx.children][dartx.add](html.Element.html(dart.str`
\n
\n
\n
\n
\n
\n ${test_.currentGroup}
\n  \n
\n (${groupTestPassedCount}/${groupTotalTestCount})
\n
\n
`)); - let grp = safeGroup == '' ? null : te[dartx.querySelector](dart.str`#${safeGroup}`); - if (grp != null) { - grp[dartx.onClick].listen(dart.fn(_ => { - let row = html.document[dartx.querySelector](dart.str`.unittest-row-${safeGroup}`); - if (dart.test(row[dartx.attributes][dartx.get]('class')[dartx.contains]('unittest-row '))) { - html.document[dartx.querySelectorAll](html.Element)(dart.str`.unittest-row-${safeGroup}`).forEach(dart.fn(e => e[dartx.attributes][dartx.set]('class', e[dartx.attributes][dartx.get]('class')[dartx.replaceAll]('unittest-row ', 'unittest-row-hidden ')), ElementToString())); - } else { - html.document[dartx.querySelectorAll](html.Element)(dart.str`.unittest-row-${safeGroup}`).forEach(dart.fn(e => e[dartx.attributes][dartx.set]('class', e[dartx.attributes][dartx.get]('class')[dartx.replaceAll]('unittest-row-hidden', 'unittest-row')), ElementToString())); - } - }, MouseEventTovoid())); - } - } - this[_buildRow](test_, te, safeGroup, !groupPassFail); - } - html.document[dartx.body][dartx.children][dartx.clear](); - html.document[dartx.body][dartx.children][dartx.add](te); - } - } - [_buildRow](test_, te, groupID, isVisible) { - let background = dart.str`unittest-row-${test_.id[dartx['%']](2) == 0 ? "even" : "odd"}`; - let display = dart.str`${dart.test(isVisible) ? "unittest-row" : "unittest-row-hidden"}`; - function addRowElement(id, status, description) { - te[dartx.children][dartx.add](html.Element.html(dart.str`
\n
\n
${id}
\n
\n ${status}
\n
${description}
\n
\n
`)); - } - dart.fn(addRowElement, dynamicAnddynamicAnddynamicTodynamic()); - if (!dart.test(test_.isComplete)) { - addRowElement(dart.str`${test_.id}`, 'NO STATUS', 'Test did not complete.'); - return; - } - addRowElement(dart.str`${test_.id}`, dart.str`${test_.result[dartx.toUpperCase]()}`, dart.str`${test_.description}. ${convert.HTML_ESCAPE.convert(test_.message)}`); - if (test_.stackTrace != null) { - addRowElement('', '', dart.str`
${convert.HTML_ESCAPE.convert(dart.toString(test_.stackTrace))}
`); - } - } - static get _isIE() { - return html.window[dartx.navigator][dartx.userAgent][dartx.contains]('MSIE'); - } - get [_htmlTestCSS]() { - return ' body{\n font-size: 14px;\n font-family: \'Open Sans\', \'Lucida Sans Unicode\', \'Lucida Grande\',' + dart.str` sans-serif;\n background: WhiteSmoke;\n }\n\n .unittest-group\n {\n background: rgb(75,75,75);\n width:98%;\n color: WhiteSmoke;\n font-weight: bold;\n padding: 6px;\n cursor: pointer;\n\n /* Provide some visual separation between groups for IE */\n ${dart.test(html_enhanced_config.HtmlEnhancedConfiguration._isIE) ? "border-bottom:solid black 1px;" : ""}\n ${dart.test(html_enhanced_config.HtmlEnhancedConfiguration._isIE) ? "border-top:solid #777777 1px;" : ""}\n\n background-image: -webkit-linear-gradient(bottom, rgb(50,50,50) 0%, ` + 'rgb(100,100,100) 100%);\n background-image: -moz-linear-gradient(bottom, rgb(50,50,50) 0%, ' + 'rgb(100,100,100) 100%);\n background-image: -ms-linear-gradient(bottom, rgb(50,50,50) 0%, ' + 'rgb(100,100,100) 100%);\n background-image: linear-gradient(bottom, rgb(50,50,50) 0%, ' + 'rgb(100,100,100) 100%);\n\n display: -webkit-box;\n display: -moz-box;\n display: -ms-box;\n display: box;\n\n -webkit-box-orient: horizontal;\n -moz-box-orient: horizontal;\n -ms-box-orient: horizontal;\n box-orient: horizontal;\n\n -webkit-box-align: center;\n -moz-box-align: center;\n -ms-box-align: center;\n box-align: center;\n }\n\n .unittest-group-status\n {\n width: 20px;\n height: 20px;\n border-radius: 20px;\n margin-left: 10px;\n }\n\n .unittest-group-status-pass{\n background: Green;\n background: ' + '-webkit-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%);\n background: ' + '-moz-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%);\n background: ' + '-ms-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%);\n background: ' + 'radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%);\n }\n\n .unittest-group-status-fail{\n background: Red;\n background: ' + '-webkit-radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%);\n background: ' + '-moz-radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%);\n background: ' + '-ms-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%);\n background: radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%);\n }\n\n .unittest-overall{\n font-size: 20px;\n }\n\n .unittest-summary{\n font-size: 18px;\n }\n\n .unittest-pass{\n color: Green;\n }\n\n .unittest-fail, .unittest-error\n {\n color: Red;\n }\n\n .unittest-row\n {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-box;\n display: box;\n -webkit-box-orient: horizontal;\n -moz-box-orient: horizontal;\n -ms-box-orient: horizontal;\n box-orient: horizontal;\n width: 100%;\n }\n\n .unittest-row-hidden\n {\n display: none;\n }\n\n .unittest-row-odd\n {\n background: WhiteSmoke;\n }\n\n .unittest-row-even\n {\n background: #E5E5E5;\n }\n\n .unittest-row-id\n {\n width: 3em;\n }\n\n .unittest-row-status\n {\n width: 4em;\n }\n\n .unittest-row-description\n {\n }\n\n '; - } - }; - dart.setSignature(html_enhanced_config.HtmlEnhancedConfiguration, { - constructors: () => ({new: dart.definiteFunctionType(html_enhanced_config.HtmlEnhancedConfiguration, [core.bool])}), - methods: () => ({ - [_installOnErrorHandler]: dart.definiteFunctionType(dart.void, []), - [_installOnMessageHandler]: dart.definiteFunctionType(dart.void, []), - [_installHandlers$]: dart.definiteFunctionType(dart.void, []), - [_uninstallHandlers$]: dart.definiteFunctionType(dart.void, []), - processMessage: dart.definiteFunctionType(dart.void, [dart.dynamic]), - [_showInteractiveResultsInPage]: dart.definiteFunctionType(dart.void, [core.int, core.int, core.int, core.List$(src__test_case.TestCase), core.bool, core.String]), - [_buildRow]: dart.definiteFunctionType(dart.void, [src__test_case.TestCase, html.Element, core.String, core.bool]) - }) - }); - html_enhanced_config.useHtmlEnhancedConfiguration = function(isLayoutTest) { - if (isLayoutTest === void 0) isLayoutTest = false; - unittest.unittestConfiguration = dart.test(isLayoutTest) ? html_enhanced_config._singletonLayout : html_enhanced_config._singletonNotLayout; - }; - dart.fn(html_enhanced_config.useHtmlEnhancedConfiguration, __Tovoid$()); - dart.defineLazy(html_enhanced_config, { - get _singletonLayout() { - return new html_enhanced_config.HtmlEnhancedConfiguration(true); - } - }); - dart.defineLazy(html_enhanced_config, { - get _singletonNotLayout() { - return new html_enhanced_config.HtmlEnhancedConfiguration(false); - } - }); - // Exports: - exports.unittest = unittest; - exports.src__configuration = src__configuration; - exports.src__simple_configuration = src__simple_configuration; - exports.src__matcher = src__matcher; - exports.src__matcher__core_matchers = src__matcher__core_matchers; - exports.src__matcher__description = src__matcher__description; - exports.src__matcher__interfaces = src__matcher__interfaces; - exports.src__matcher__pretty_print = src__matcher__pretty_print; - exports.src__matcher__util = src__matcher__util; - exports.src__matcher__error_matchers = src__matcher__error_matchers; - exports.src__matcher__expect = src__matcher__expect; - exports.src__matcher__future_matchers = src__matcher__future_matchers; - exports.src__matcher__iterable_matchers = src__matcher__iterable_matchers; - exports.src__matcher__map_matchers = src__matcher__map_matchers; - exports.src__matcher__numeric_matchers = src__matcher__numeric_matchers; - exports.src__matcher__operator_matchers = src__matcher__operator_matchers; - exports.src__matcher__prints_matcher = src__matcher__prints_matcher; - exports.src__matcher__string_matchers = src__matcher__string_matchers; - exports.src__matcher__throws_matcher = src__matcher__throws_matcher; - exports.src__matcher__throws_matchers = src__matcher__throws_matchers; - exports.src__internal_test_case = src__internal_test_case; - exports.src__test_environment = src__test_environment; - exports.src__group_context = src__group_context; - exports.src__utils = src__utils; - exports.src__test_case = src__test_case; - exports.src__expected_function = src__expected_function; - exports.html_config = html_config; - exports.html_individual_config = html_individual_config; - exports.html_enhanced_config = html_enhanced_config; -}); diff --git a/pkg/dev_compiler/test/codegen_expected/varargs.js b/pkg/dev_compiler/test/codegen_expected/varargs.js index 232f60c6cc25..884fd19073e8 100644 --- a/pkg/dev_compiler/test/codegen_expected/varargs.js +++ b/pkg/dev_compiler/test/codegen_expected/varargs.js @@ -6,7 +6,9 @@ dart_library.library('varargs', null, /* Imports */[ const dart = dart_sdk.dart; const dartx = dart_sdk.dartx; const varargs = Object.create(null); + const src__varargs = Object.create(null); let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); + let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))(); varargs.varargsTest = function(x, ...others) { let args = [1, others]; dart.dsend(x, 'call', ...args); @@ -17,6 +19,19 @@ dart_library.library('varargs', null, /* Imports */[ dart.dsend(x, 'call', ...args); }; dart.fn(varargs.varargsTest2, dynamicAnddynamicTodynamic()); + src__varargs._Rest = class _Rest extends core.Object { + new() { + } + }; + dart.setSignature(src__varargs._Rest, { + constructors: () => ({new: dart.definiteFunctionType(src__varargs._Rest, [])}) + }); + src__varargs.rest = dart.const(new src__varargs._Rest()); + src__varargs.spread = function(args) { + dart.throw(new core.StateError('The spread function cannot be called, ' + 'it should be compiled away.')); + }; + dart.fn(src__varargs.spread, dynamicTodynamic()); // Exports: exports.varargs = varargs; + exports.src__varargs = src__varargs; }); diff --git a/pkg/dev_compiler/test/codegen_test.dart b/pkg/dev_compiler/test/codegen_test.dart index 973bd27e1954..cad3b32f2c25 100644 --- a/pkg/dev_compiler/test/codegen_test.dart +++ b/pkg/dev_compiler/test/codegen_test.dart @@ -16,7 +16,7 @@ import 'dart:convert' show JSON; import 'dart:io' show Directory, File, Platform; import 'package:args/args.dart' show ArgParser, ArgResults; import 'package:path/path.dart' as path; -import 'package:test/test.dart' show group, test; +import 'package:test/test.dart' show test; import 'package:analyzer/analyzer.dart' show @@ -56,14 +56,6 @@ final codegenTestDir = path.join(repoDirectory, 'gen', 'codegen_tests'); /// output. final codegenOutputDir = path.join(repoDirectory, 'gen', 'codegen_output'); -// TODO(jmesserly): switch this to a .packages file. -final packageUrlMappings = { - 'package:expect/expect.dart': path.join(codegenDir, 'expect.dart'), - 'package:async_helper/async_helper.dart': - path.join(codegenDir, 'async_helper.dart'), - 'package:js/js.dart': path.join(codegenDir, 'packages', 'js', 'js.dart') -}; - final codeCoverage = Platform.environment.containsKey('COVERALLS_TOKEN'); RegExp filePattern; @@ -76,14 +68,17 @@ main(List arguments) { var sdkDir = path.join(repoDirectory, 'gen', 'patched_sdk'); var sdkSummaryFile = path.join(testDirectory, '..', 'lib', 'runtime', 'dart_sdk.sum'); + + var summaryPaths = new Directory(path.join(codegenOutputDir, 'pkg')) + .listSync() + .map((e) => e.path) + .where((p) => p.endsWith('.sum')) + .toList(); + var analyzerOptions = new AnalyzerOptions( - customUrlMappings: packageUrlMappings, - dartSdkSummaryPath: sdkSummaryFile); + dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths); var compiler = new ModuleCompiler(analyzerOptions); - // Build packages tests depend on. - _buildAllPackages(compiler); - var testDirs = [ 'language', 'corelib', @@ -141,6 +136,10 @@ main(List arguments) { }); } + if (filePattern.hasMatch('sunflower')) { + _buildSunflower(compiler, codegenOutputDir, codegenExpectDir); + } + if (codeCoverage) { test('build_sdk code coverage', () { return build_sdk.main(['--dart-sdk', sdkDir, '-o', codegenOutputDir]); @@ -157,11 +156,15 @@ void _writeModule(String outPath, String expectPath, JSModuleFile result) { new File(outPath + '.txt').writeAsStringSync(errors); var jsFile = new File(outPath + '.js'); + var summaryFile = new File(outPath + '.sum'); var expectFile = new File(expectPath + '.js'); var errorFile = new File(outPath + '.err'); if (result.isValid) { jsFile.writeAsStringSync(result.code); + if (result.summaryBytes != null) { + summaryFile.writeAsBytesSync(result.summaryBytes); + } if (result.sourceMap != null) { var mapPath = outPath + '.js.map'; new File(mapPath) @@ -207,40 +210,6 @@ dart_library.library('$moduleName', null, [ } } -void _buildAllPackages(ModuleCompiler compiler) { - group('dartdevc package', () { - _buildPackages(compiler, codegenOutputDir, codegenExpectDir); - - var packages = ['matcher', 'path', 'stack_trace']; - for (var package in packages) { - if (!filePattern.hasMatch(package)) continue; - test(package, () { - _buildPackage(compiler, codegenOutputDir, codegenExpectDir, package); - }); - } - - if (!filePattern.hasMatch('unittest')) return; - - test('unittest', () { - // Only build files applicable to the web - html_*.dart and its - // internal dependences. - _buildPackage(compiler, codegenOutputDir, codegenExpectDir, "unittest", - packageFiles: [ - 'unittest.dart', - 'html_config.dart', - 'html_individual_config.dart', - 'html_enhanced_config.dart' - ]); - }); - }); - - if (!filePattern.hasMatch('sunflower')) return; - - test('dartdevc sunflower', () { - _buildSunflower(compiler, codegenOutputDir, codegenExpectDir); - }); -} - void _buildSunflower( ModuleCompiler compiler, String outputDir, String expectDir) { var baseDir = path.join(codegenDir, 'sunflower'); @@ -255,65 +224,6 @@ void _buildSunflower( path.join(expectDir, 'sunflower', 'sunflower'), built); } -void _buildPackages( - ModuleCompiler compiler, String outputDir, String expectDir) { - // Note: we don't summarize these, as we're going to rely on our in-memory - // shared analysis context for caching, and `_moduleForLibrary` below - // understands these are from other modules. - var options = new CompilerOptions(sourceMap: false, summarizeApi: false); - - for (var uri in packageUrlMappings.keys) { - if (!filePattern.hasMatch(uri)) return; - - assert(uri.startsWith('package:')); - var uriPath = uri.substring('package:'.length); - var name = path.basenameWithoutExtension(uriPath); - test(name, () { - var input = new BuildUnit(name, codegenDir, [uri], _moduleForLibrary); - var built = compiler.compile(input, options); - - var outPath = path.join(outputDir, path.withoutExtension(uriPath)); - var expectPath = path.join(expectDir, path.withoutExtension(uriPath)); - _writeModule(outPath, expectPath, built); - }); - } -} - -void _buildPackage( - ModuleCompiler compiler, String outputDir, String expectDir, packageName, - {List packageFiles}) { - var options = new CompilerOptions(sourceMap: false, summarizeApi: false); - - var packageRoot = path.join(codegenDir, 'packages'); - var packageInputDir = path.join(packageRoot, packageName); - List files; - if (packageFiles != null) { - // Only collect files transitively reachable from packageFiles. - var reachable = new Set(); - for (var file in packageFiles) { - file = path.join(packageInputDir, file); - _collectTransitiveImports(new File(file).readAsStringSync(), reachable, - packageRoot: packageRoot, from: file); - } - files = reachable.toList(); - } else { - // Collect all files in the packages directory. - files = new Directory(packageInputDir) - .listSync(recursive: true) - .where((entry) => entry.path.endsWith('.dart')) - .map((entry) => entry.path) - .toList(); - } - - var unit = - new BuildUnit(packageName, packageInputDir, files, _moduleForLibrary); - var module = compiler.compile(unit, options); - - var outPath = path.join(outputDir, packageName, packageName); - var expectPath = path.join(expectDir, packageName, packageName); - _writeModule(outPath, expectPath, module); -} - String _moduleForLibrary(Source source) { var scheme = source.uri.scheme; if (scheme == 'package') { diff --git a/pkg/dev_compiler/test/worker/worker_test.dart b/pkg/dev_compiler/test/worker/worker_test.dart index 6685acfda349..5752822a2d5a 100644 --- a/pkg/dev_compiler/test/worker/worker_test.dart +++ b/pkg/dev_compiler/test/worker/worker_test.dart @@ -12,9 +12,6 @@ import 'package:bazel_worker/src/async_message_grouper.dart'; import 'package:bazel_worker/testing.dart'; import 'package:test/test.dart'; -import 'package:dev_compiler/src/compiler/compiler.dart' - show missingPartErrorCode, unusedPartWarningCode; - main() { group('Hello World', () { final argsFile = new File('test/worker/hello_world.args').absolute; @@ -222,7 +219,7 @@ main() { expect(outJS.existsSync(), isTrue); }); - test('error if part is not supplied', () { + test('works if part is not supplied', () { var result = Process.runSync('dart', [ 'bin/dartdevc.dart', 'compile', @@ -232,16 +229,13 @@ main() { outJS.path, libraryFile.path, ]); - expect( - result.stdout, - startsWith('[error] ${missingPartErrorCode.message} ' - '(test/worker/greeting.dart, line 1, col 1)')); + expect(result.stdout, isEmpty); expect(result.stderr, isEmpty); - expect(result.exitCode, 1); - expect(outJS.existsSync(), isFalse); + expect(result.exitCode, 0); + expect(outJS.existsSync(), isTrue); }); - test('warning if part without library is supplied', () { + test('part without library is silently ignored', () { var result = Process.runSync('dart', [ 'bin/dartdevc.dart', 'compile', @@ -251,10 +245,7 @@ main() { outJS.path, partFile.path, ]); - expect( - result.stdout, - startsWith('[warning] ${unusedPartWarningCode.message} ' - '(test/worker/greeting.dart, line 1, col 1)')); + expect(result.stdout, isEmpty); expect(result.stderr, isEmpty); expect(result.exitCode, 0); expect(outJS.existsSync(), isTrue); diff --git a/pkg/dev_compiler/tool/build_test_pkgs.sh b/pkg/dev_compiler/tool/build_test_pkgs.sh new file mode 100755 index 000000000000..1e4594994573 --- /dev/null +++ b/pkg/dev_compiler/tool/build_test_pkgs.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e # bail on error + +cd $( dirname "${BASH_SOURCE[0]}" )/.. + +mkdir -p gen/codegen_output/pkg/ + +SDK=--dart-sdk-summary=lib/runtime/dart_sdk.sum + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/expect.js \ + --url-mapping=package:expect/expect.dart,test/codegen/expect.dart \ + package:expect/expect.dart + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/async_helper.js \ + --url-mapping=package:async_helper/async_helper.dart,test/codegen/async_helper.dart \ + package:async_helper/async_helper.dart + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/js.js \ + package:js/js.dart + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/matcher.js \ + package:matcher/matcher.dart + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/stack_trace.js \ + package:stack_trace/stack_trace.dart + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/path.js \ + package:path/path.dart + +./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/unittest.js \ + package:unittest/unittest.dart \ + package:unittest/html_config.dart \ + package:unittest/html_individual_config.dart \ + package:unittest/html_enhanced_config.dart diff --git a/pkg/dev_compiler/tool/sdk_expected_errors.txt b/pkg/dev_compiler/tool/sdk_expected_errors.txt index 80a120c40f30..3faed0c1fc31 100644 --- a/pkg/dev_compiler/tool/sdk_expected_errors.txt +++ b/pkg/dev_compiler/tool/sdk_expected_errors.txt @@ -20,12 +20,6 @@ [error] Invalid override. The type of _SpeechRecognitionResultList.[]= ((int, SpeechRecognitionResult) → void) is not a subtype of JSMutableIndexable.[]= ((int, dynamic) → dynamic). (dart:html, line 38351, col 3) [error] Invalid override. The type of _StyleSheetList.[]= ((int, StyleSheet) → void) is not a subtype of JSMutableIndexable.[]= ((int, dynamic) → dynamic). (dart:html, line 38415, col 3) [error] Invalid override. The type of _EventStreamSubscription.asFuture (([dynamic]) → Future) is not a subtype of StreamSubscription.asFuture (([E]) → Future). (dart:html, line 40152, col 3) -[error] The part was not supplied as an input to the compiler. (dart:html_common/conversions.dart, line 1, col 1) -[error] The part was not supplied as an input to the compiler. (dart:html_common/conversions_dart2js.dart, line 1, col 1) -[error] The part was not supplied as an input to the compiler. (dart:html_common/css_class_set.dart, line 1, col 1) -[error] The part was not supplied as an input to the compiler. (dart:html_common/device.dart, line 1, col 1) -[error] The part was not supplied as an input to the compiler. (dart:html_common/filtered_element_list.dart, line 1, col 1) -[error] The part was not supplied as an input to the compiler. (dart:html_common/lists.dart, line 1, col 1) [error] Invalid override. The type of JsArray.[]= ((Object, E) → void) is not a subtype of JsObject.[]= ((Object, dynamic) → dynamic). (dart:js, line 363, col 3) [error] The return type 'double' is not a 'T', as defined by the method 'min'. (dart:math, line 90, col 16) [error] The return type 'double' is not a 'T', as defined by the method 'min'. (dart:math, line 94, col 51) diff --git a/pkg/dev_compiler/tool/test.sh b/pkg/dev_compiler/tool/test.sh index 4a4d01a0b1e2..f23dd2fef49e 100755 --- a/pkg/dev_compiler/tool/test.sh +++ b/pkg/dev_compiler/tool/test.sh @@ -27,6 +27,8 @@ if [ -d gen/codegen_output ]; then rm -r gen/codegen_output || fail fi +./tool/build_test_pkgs.sh + # Make sure we don't run tests in code coverage mode. # this will cause us to generate files that are not part of the baseline # TODO(jmesserly): we should move diff into Dart code, so we don't need to