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

Side by Side Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 1342213003: Add optional message to assert in Dart2js - continued (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add dart2js test Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library mock_compiler; 5 library mock_compiler;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 /// Expected number of errors. If `null`, the number of errors is not checked. 67 /// Expected number of errors. If `null`, the number of errors is not checked.
68 final int expectedErrors; 68 final int expectedErrors;
69 final Map<String, SourceFile> sourceFiles; 69 final Map<String, SourceFile> sourceFiles;
70 Node parsedTree; 70 Node parsedTree;
71 final String testedPatchVersion; 71 final String testedPatchVersion;
72 final LibrarySourceProvider librariesOverride; 72 final LibrarySourceProvider librariesOverride;
73 73
74 MockCompiler.internal( 74 MockCompiler.internal(
75 {Map<String, String> coreSource, 75 {Map<String, String> coreSource,
76 bool enableTypeAssertions: false, 76 bool enableTypeAssertions: false,
77 bool enableUserAssertions: false,
77 bool enableMinification: false, 78 bool enableMinification: false,
78 bool enableConcreteTypeInference: false, 79 bool enableConcreteTypeInference: false,
79 int maxConcreteTypeSize: 5, 80 int maxConcreteTypeSize: 5,
80 bool disableTypeInference: false, 81 bool disableTypeInference: false,
81 bool analyzeAll: false, 82 bool analyzeAll: false,
82 bool analyzeOnly: false, 83 bool analyzeOnly: false,
83 bool emitJavaScript: true, 84 bool emitJavaScript: true,
84 bool preserveComments: false, 85 bool preserveComments: false,
85 // Our unit tests check code generation output that is 86 // Our unit tests check code generation output that is
86 // affected by inlining support. 87 // affected by inlining support.
87 bool disableInlining: true, 88 bool disableInlining: true,
88 bool trustTypeAnnotations: false, 89 bool trustTypeAnnotations: false,
89 bool enableAsyncAwait: false, 90 bool enableAsyncAwait: false,
90 int this.expectedWarnings, 91 int this.expectedWarnings,
91 int this.expectedErrors, 92 int this.expectedErrors,
92 api.CompilerOutputProvider outputProvider, 93 api.CompilerOutputProvider outputProvider,
93 String patchVersion, 94 String patchVersion,
94 LibrarySourceProvider this.librariesOverride}) 95 LibrarySourceProvider this.librariesOverride})
95 : sourceFiles = new Map<String, SourceFile>(), 96 : sourceFiles = new Map<String, SourceFile>(),
96 testedPatchVersion = patchVersion, 97 testedPatchVersion = patchVersion,
97 super(enableTypeAssertions: enableTypeAssertions, 98 super(enableTypeAssertions: enableTypeAssertions,
99 enableUserAssertions: enableUserAssertions,
98 enableMinification: enableMinification, 100 enableMinification: enableMinification,
99 enableConcreteTypeInference: enableConcreteTypeInference, 101 enableConcreteTypeInference: enableConcreteTypeInference,
100 maxConcreteTypeSize: maxConcreteTypeSize, 102 maxConcreteTypeSize: maxConcreteTypeSize,
101 disableTypeInferenceFlag: disableTypeInference, 103 disableTypeInferenceFlag: disableTypeInference,
102 analyzeAllFlag: analyzeAll, 104 analyzeAllFlag: analyzeAll,
103 analyzeOnly: analyzeOnly, 105 analyzeOnly: analyzeOnly,
104 emitJavaScript: emitJavaScript, 106 emitJavaScript: emitJavaScript,
105 preserveComments: preserveComments, 107 preserveComments: preserveComments,
106 trustTypeAnnotations: trustTypeAnnotations, 108 trustTypeAnnotations: trustTypeAnnotations,
107 showPackageWarnings: true, 109 showPackageWarnings: true,
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 442
441 // TODO(herhut): Disallow warnings and errors during compilation by default. 443 // TODO(herhut): Disallow warnings and errors during compilation by default.
442 MockCompiler compilerFor(String code, Uri uri, 444 MockCompiler compilerFor(String code, Uri uri,
443 {bool analyzeAll: false, 445 {bool analyzeAll: false,
444 bool analyzeOnly: false, 446 bool analyzeOnly: false,
445 Map<String, String> coreSource, 447 Map<String, String> coreSource,
446 bool disableInlining: true, 448 bool disableInlining: true,
447 bool minify: false, 449 bool minify: false,
448 bool trustTypeAnnotations: false, 450 bool trustTypeAnnotations: false,
449 bool enableTypeAssertions: false, 451 bool enableTypeAssertions: false,
452 bool enableUserAssertions: false,
450 int expectedErrors, 453 int expectedErrors,
451 int expectedWarnings, 454 int expectedWarnings,
452 api.CompilerOutputProvider outputProvider}) { 455 api.CompilerOutputProvider outputProvider}) {
453 MockCompiler compiler = new MockCompiler.internal( 456 MockCompiler compiler = new MockCompiler.internal(
454 analyzeAll: analyzeAll, 457 analyzeAll: analyzeAll,
455 analyzeOnly: analyzeOnly, 458 analyzeOnly: analyzeOnly,
456 coreSource: coreSource, 459 coreSource: coreSource,
457 disableInlining: disableInlining, 460 disableInlining: disableInlining,
458 enableMinification: minify, 461 enableMinification: minify,
459 trustTypeAnnotations: trustTypeAnnotations, 462 trustTypeAnnotations: trustTypeAnnotations,
460 enableTypeAssertions: enableTypeAssertions, 463 enableTypeAssertions: enableTypeAssertions,
464 enableUserAssertions: enableUserAssertions,
461 expectedErrors: expectedErrors, 465 expectedErrors: expectedErrors,
462 expectedWarnings: expectedWarnings, 466 expectedWarnings: expectedWarnings,
463 outputProvider: outputProvider); 467 outputProvider: outputProvider);
464 compiler.registerSource(uri, code); 468 compiler.registerSource(uri, code);
465 compiler.diagnosticHandler = createHandler(compiler, code); 469 compiler.diagnosticHandler = createHandler(compiler, code);
466 return compiler; 470 return compiler;
467 } 471 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698