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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// Check that 'dart:' libraries have their corresponding dart.library.X 5 /// Check that 'dart:' libraries have their corresponding dart.library.X
6 /// environment variable set. 6 /// environment variable set.
7 7
8 import "memory_source_file_helper.dart"; 8 import "memory_source_file_helper.dart";
9 9
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
11 11
12 import 'package:expect/expect.dart' show 12 import 'package:expect/expect.dart' show Expect;
13 Expect;
14 13
15 import 'package:compiler/src/null_compiler_output.dart' show 14 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput;
16 NullCompilerOutput;
17 15
18 import 'package:compiler/src/options.dart' show 16 import 'package:compiler/src/options.dart' show CompilerOptions;
19 CompilerOptions;
20 17
21 import 'package:compiler/compiler_new.dart' show 18 import 'package:compiler/compiler_new.dart'
22 CompilerInput, 19 show CompilerInput, CompilerDiagnostics;
23 CompilerDiagnostics;
24 20
25 const clientPlatform = r''' 21 const clientPlatform = r'''
26 [dart-spec] 22 [dart-spec]
27 spec: 3rd edition. 23 spec: 3rd edition.
28 24
29 [features] 25 [features]
30 # No extra features 26 # No extra features
31 27
32 [libraries] 28 [libraries]
33 mock.client: mock1.dart 29 mock.client: mock1.dart
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const DummyCompilerDiagnostics(); 64 const DummyCompilerDiagnostics();
69 65
70 report(code, uri, begin, end, text, kind) { 66 report(code, uri, begin, end, text, kind) {
71 throw "should not be needed"; 67 throw "should not be needed";
72 } 68 }
73 } 69 }
74 70
75 class CustomCompiler extends CompilerImpl { 71 class CustomCompiler extends CompilerImpl {
76 CustomCompiler(options, environment) 72 CustomCompiler(options, environment)
77 : super( 73 : super(
78 const DummyCompilerInput(), 74 const DummyCompilerInput(),
79 const NullCompilerOutput(), 75 const NullCompilerOutput(),
80 const DummyCompilerDiagnostics(), 76 const DummyCompilerDiagnostics(),
81 new CompilerOptions.parse( 77 new CompilerOptions.parse(
82 libraryRoot: Uri.base.resolve("sdk/"), 78 libraryRoot: Uri.base.resolve("sdk/"),
83 options: options, 79 options: options,
84 environment: environment)); 80 environment: environment));
85 } 81 }
86 82
87 runTest() async { 83 runTest() async {
88 var compiler = new CustomCompiler([], {}); 84 var compiler = new CustomCompiler([], {});
89 85
90 await compiler.setupSdk(); 86 await compiler.setupSdk();
91 87
92 // Core libraries are always present. 88 // Core libraries are always present.
93 Expect.equals("true", compiler.fromEnvironment("dart.library.collection")); 89 Expect.equals("true", compiler.fromEnvironment("dart.library.collection"));
94 // Non-existing entries in the environment return 'null'. 90 // Non-existing entries in the environment return 'null'.
(...skipping 19 matching lines...) Expand all
114 Expect.equals(null, compiler.fromEnvironment("dart.library.mock.client")); 110 Expect.equals(null, compiler.fromEnvironment("dart.library.mock.client"));
115 Expect.equals(null, compiler.fromEnvironment("dart.library.html")); 111 Expect.equals(null, compiler.fromEnvironment("dart.library.html"));
116 // Check for shared libraries.. 112 // Check for shared libraries..
117 Expect.equals("true", compiler.fromEnvironment("dart.library.mock.shared")); 113 Expect.equals("true", compiler.fromEnvironment("dart.library.mock.shared"));
118 // Check for server libraries. 114 // Check for server libraries.
119 Expect.equals("true", compiler.fromEnvironment("dart.library.mock.server")); 115 Expect.equals("true", compiler.fromEnvironment("dart.library.mock.server"));
120 Expect.equals("true", compiler.fromEnvironment("dart.library.io")); 116 Expect.equals("true", compiler.fromEnvironment("dart.library.io"));
121 117
122 // Check that user-defined env-variables win. 118 // Check that user-defined env-variables win.
123 compiler = new CustomCompiler([], 119 compiler = new CustomCompiler([],
124 {'dart.library.collection': "false", 120 {'dart.library.collection': "false", 'dart.library.mock.client': "foo"});
125 'dart.library.mock.client': "foo"});
126 121
127 await compiler.setupSdk(); 122 await compiler.setupSdk();
128 123
129 Expect.equals("false", compiler.fromEnvironment("dart.library.collection")); 124 Expect.equals("false", compiler.fromEnvironment("dart.library.collection"));
130 Expect.equals("foo", compiler.fromEnvironment("dart.library.mock.client")); 125 Expect.equals("foo", compiler.fromEnvironment("dart.library.mock.client"));
131 } 126 }
132 127
133 main() { 128 main() {
134 asyncStart(); 129 asyncStart();
135 runTest().then((_) { 130 runTest().then((_) {
136 asyncEnd(); 131 asyncEnd();
137 }); 132 });
138 } 133 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/least_upper_bound_test.dart ('k') | tests/compiler/dart2js/line_column_provider_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698