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

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

Issue 1248483008: Split MessageKind into a MessageKind key and a MessageTemplate. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 relative URIs are resolved against the canonical name of a 5 /// Check that relative URIs are resolved against the canonical name of a
6 /// library. This only matters for dart:-libraries, so this test mocks up two 6 /// library. This only matters for dart:-libraries, so this test mocks up two
7 /// dart:-libraries. 7 /// dart:-libraries.
8 8
9 import "dart:io"; 9 import "dart:io";
10 10
11 import "dart:async"; 11 import "dart:async";
12 12
13 import "memory_source_file_helper.dart"; 13 import "memory_source_file_helper.dart";
14 14
15 import "package:async_helper/async_helper.dart"; 15 import "package:async_helper/async_helper.dart";
16 16
17 import 'package:expect/expect.dart' show 17 import 'package:expect/expect.dart' show
18 Expect; 18 Expect;
19 19
20 import 'package:compiler/src/elements/elements.dart' show 20 import 'package:compiler/src/elements/elements.dart' show
21 LibraryElement; 21 LibraryElement;
22 22
23 import 'package:compiler/src/dart2jslib.dart' show 23 import 'package:compiler/src/dart2jslib.dart' show
24 MessageKind; 24 MessageKind,
25 MessageTemplate;
25 26
26 import 'package:compiler/src/null_compiler_output.dart' show 27 import 'package:compiler/src/null_compiler_output.dart' show
27 NullCompilerOutput; 28 NullCompilerOutput;
28 29
29 import 'package:compiler/src/old_to_new_api.dart' show 30 import 'package:compiler/src/old_to_new_api.dart' show
30 LegacyCompilerDiagnostics, 31 LegacyCompilerDiagnostics,
31 LegacyCompilerInput; 32 LegacyCompilerInput;
32 33
33 import 'package:sdk_library_metadata/libraries.dart' show 34 import 'package:sdk_library_metadata/libraries.dart' show
34 DART2JS_PLATFORM, 35 DART2JS_PLATFORM,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (uri == sdkRoot.resolve('lib/mock1.dart')) { 86 if (uri == sdkRoot.resolve('lib/mock1.dart')) {
86 return provider.readStringFromUri(Uri.parse('memory:mock1.dart')); 87 return provider.readStringFromUri(Uri.parse('memory:mock1.dart'));
87 } 88 }
88 if (uri == sdkRoot.resolve('lib/mock2.dart')) { 89 if (uri == sdkRoot.resolve('lib/mock2.dart')) {
89 return provider.readStringFromUri(Uri.parse('memory:mock2.dart')); 90 return provider.readStringFromUri(Uri.parse('memory:mock2.dart'));
90 } 91 }
91 return provider.readStringFromUri(uri); 92 return provider.readStringFromUri(uri);
92 } 93 }
93 94
94 String expectedMessage = 95 String expectedMessage =
95 MessageKind.LIBRARY_NOT_FOUND.message( 96 MessageTemplate.TEMPLATES[MessageKind.LIBRARY_NOT_FOUND].message(
96 {'resolvedUri': 'dart:mock2.dart'}).computeMessage(); 97 {'resolvedUri': 'dart:mock2.dart'}).computeMessage();
97 98
98 int actualMessageCount = 0; 99 int actualMessageCount = 0;
99 100
100 wrappedHandler( 101 wrappedHandler(
101 Uri uri, int begin, int end, String message, kind) { 102 Uri uri, int begin, int end, String message, kind) {
102 if (message == expectedMessage) { 103 if (message == expectedMessage) {
103 actualMessageCount++; 104 actualMessageCount++;
104 } else { 105 } else {
105 return handler(uri, begin, end, message, kind); 106 return handler(uri, begin, end, message, kind);
(...skipping 16 matching lines...) Expand all
122 asyncStart(); 123 asyncStart();
123 compiler.libraryLoader.loadLibrary(Uri.parse("dart:m_o_c_k_1")) 124 compiler.libraryLoader.loadLibrary(Uri.parse("dart:m_o_c_k_1"))
124 .then(checkLibrary) 125 .then(checkLibrary)
125 .then(asyncSuccess); 126 .then(asyncSuccess);
126 } 127 }
127 128
128 const Map MEMORY_SOURCE_FILES = const { 129 const Map MEMORY_SOURCE_FILES = const {
129 "mock1.dart": "library mock1; import 'mock2.dart';", 130 "mock1.dart": "library mock1; import 'mock2.dart';",
130 "mock2.dart": "library mock2;", 131 "mock2.dart": "library mock2;",
131 }; 132 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/import_mirrors_test.dart ('k') | tests/compiler/dart2js/message_kind_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698