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

Side by Side Diff: test/testing.dart

Issue 1840203002: More analyzer updates, and handle negative_tests (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dev_compiler.src.testing; 5 library dev_compiler.src.testing;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'package:analyzer/file_system/file_system.dart'; 8 import 'package:analyzer/file_system/file_system.dart';
9 import 'package:analyzer/file_system/memory_file_system.dart'; 9 import 'package:analyzer/file_system/memory_file_system.dart';
10 import 'package:analyzer/src/generated/engine.dart'
11 show AnalysisContext, AnalysisEngine, AnalysisOptionsImpl;
12 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
13 import 'package:cli_util/cli_util.dart' show getSdkDir;
14 import 'package:path/path.dart' as path; 11 import 'package:path/path.dart' as path;
15 12
16 import 'package:dev_compiler/src/analysis_context.dart';
17 import 'package:dev_compiler/src/options.dart';
18
19 /// Shared analysis context used for compilation.
20 final AnalysisContext realSdkContext = () {
21 var context = createAnalysisContextWithSources(new SourceResolverOptions(
22 dartSdkPath: getSdkDir().path,
23 customUrlMappings: {
24 'package:expect/expect.dart': _testCodegenPath('expect.dart'),
25 'package:async_helper/async_helper.dart':
26 _testCodegenPath('async_helper.dart'),
27 'package:unittest/unittest.dart': _testCodegenPath('unittest.dart'),
28 'package:dom/dom.dart': _testCodegenPath('sunflower', 'dom.dart')
29 }));
30 (context.analysisOptions as AnalysisOptionsImpl).cacheSize = 512;
31 return context;
32 }();
33
34 String _testCodegenPath(String p1, [String p2]) =>
35 path.join(testDirectory, 'codegen', p1, p2);
36
37 final String testDirectory = 13 final String testDirectory =
38 path.dirname((reflectClass(_TestUtils).owner as LibraryMirror).uri.path); 14 path.dirname((reflectClass(_TestUtils).owner as LibraryMirror).uri.path);
39 15
40 class _TestUtils {} 16 class _TestUtils {}
41 17
42 class TestUriResolver extends ResourceUriResolver { 18 class TestUriResolver extends ResourceUriResolver {
43 final MemoryResourceProvider provider; 19 final MemoryResourceProvider provider;
44 TestUriResolver(provider) 20 TestUriResolver(provider)
45 : provider = provider, 21 : provider = provider,
46 super(provider); 22 super(provider);
47 23
48 @override 24 @override
49 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 25 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
50 if (uri.scheme == 'package') { 26 if (uri.scheme == 'package') {
51 return (provider.getResource('/packages/' + uri.path) as File) 27 return (provider.getResource('/packages/' + uri.path) as File)
52 .createSource(uri); 28 .createSource(uri);
53 } 29 }
54 return super.resolveAbsolute(uri, actualUri); 30 return super.resolveAbsolute(uri, actualUri);
55 } 31 }
56 } 32 }
OLDNEW
« lib/src/report.dart ('K') | « test/end_to_end_test.dart ('k') | tool/node_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698