Skip to content

Commit

Permalink
Use StringSource in type provider tests to prevent bad path lookups.
Browse files Browse the repository at this point in the history
Prevent windows from doing a path lookup for 'dart:core' which will
crash. All we need is a string source with a uri..

Change-Id: I742060633f3bd89323ad3e3f0f19ae80c1aedbae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104806
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
  • Loading branch information
MichaelRFairhurst authored and commit-bot@chromium.org committed Jun 6, 2019
1 parent 0929649 commit 527dffd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/analyzer/test/generated/resolver_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/generated/testing/test_type_provider.dart';
import 'package:analyzer/src/source/source_resource.dart';
import 'package:analyzer/src/string_source.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
Expand Down Expand Up @@ -1183,15 +1184,16 @@ class TypeProviderImplTest extends EngineTestCase {
symbolType.element,
typeType.element
];
coreUnit.source = new TestSource('dart:core');
coreUnit.source = new StringSource('', null, uri: Uri.parse('dart:core'));
coreUnit.librarySource = coreUnit.source;
CompilationUnitElementImpl asyncUnit = new CompilationUnitElementImpl();
asyncUnit.types = <ClassElement>[
futureType.element,
futureOrType.element,
streamType.element
];
asyncUnit.source = new TestSource('dart:async');

asyncUnit.source = new StringSource('', null, uri: Uri.parse('dart:async'));
asyncUnit.librarySource = asyncUnit.source;
LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode(
null, null, AstTestFactory.libraryIdentifier2(["dart.core"]), true);
Expand Down

0 comments on commit 527dffd

Please sign in to comment.