Files
sdk/pkg/dev_compiler/test/testing.dart
T
John Messerly e8bee43919 More analyzer updates, and handle negative_tests
Also fixes node_test to not overwrite main SDK log

R=vsm@google.com

Review URL: https://codereview.chromium.org/1840203002 .
2016-03-29 15:16:44 -07:00

33 lines
1.0 KiB
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// 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.
library dev_compiler.src.testing;
import 'dart:mirrors';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:path/path.dart' as path;
final String testDirectory =
path.dirname((reflectClass(_TestUtils).owner as LibraryMirror).uri.path);
class _TestUtils {}
class TestUriResolver extends ResourceUriResolver {
final MemoryResourceProvider provider;
TestUriResolver(provider)
: provider = provider,
super(provider);
@override
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
if (uri.scheme == 'package') {
return (provider.getResource('/packages/' + uri.path) as File)
.createSource(uri);
}
return super.resolveAbsolute(uri, actualUri);
}
}