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

Side by Side Diff: pkg/analyzer/test/file_system/physical_resource_provider_test.dart

Issue 2411423003: Add prefix to path import to work around breaking change (Closed)
Patch Set: Created 4 years, 2 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 library analyzer.test.file_system.physical_resource_provider_test; 5 library analyzer.test.file_system.physical_resource_provider_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core'; 8 import 'dart:core';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
11 import 'package:analyzer/file_system/file_system.dart'; 11 import 'package:analyzer/file_system/file_system.dart';
12 import 'package:analyzer/file_system/physical_file_system.dart'; 12 import 'package:analyzer/file_system/physical_file_system.dart';
13 import 'package:analyzer/src/generated/source_io.dart'; 13 import 'package:analyzer/src/generated/source_io.dart';
14 import 'package:path/path.dart'; 14 import 'package:path/path.dart' as pathos;
15 import 'package:test/test.dart'; 15 import 'package:test/test.dart';
16 import 'package:test_reflective_loader/test_reflective_loader.dart'; 16 import 'package:test_reflective_loader/test_reflective_loader.dart';
17 import 'package:watcher/watcher.dart'; 17 import 'package:watcher/watcher.dart';
18 18
19 main() { 19 main() {
20 if (!new bool.fromEnvironment('skipPhysicalResourceProviderTests')) { 20 if (!new bool.fromEnvironment('skipPhysicalResourceProviderTests')) {
21 defineReflectiveSuite(() { 21 defineReflectiveSuite(() {
22 defineReflectiveTests(PhysicalResourceProviderTest); 22 defineReflectiveTests(PhysicalResourceProviderTest);
23 defineReflectiveTests(FileTest); 23 defineReflectiveTests(FileTest);
24 defineReflectiveTests(FolderTest); 24 defineReflectiveTests(FolderTest);
25 }); 25 });
26 } 26 }
27 } 27 }
28 28
29 var _isFile = new isInstanceOf<File>(); 29 var _isFile = new isInstanceOf<File>();
30 var _isFileSystemException = new isInstanceOf<FileSystemException>(); 30 var _isFileSystemException = new isInstanceOf<FileSystemException>();
31 var _isFolder = new isInstanceOf<Folder>(); 31 var _isFolder = new isInstanceOf<Folder>();
32 32
33 String join(String part1, [String part2, String part3]) =>
34 pathos.join(part1, part2, part3);
35
33 @reflectiveTest 36 @reflectiveTest
34 class FileTest extends _BaseTest { 37 class FileTest extends _BaseTest {
35 String path; 38 String path;
36 File file; 39 File file;
37 40
38 setUp() { 41 setUp() {
39 super.setUp(); 42 super.setUp();
40 path = join(tempPath, 'file.txt'); 43 path = join(tempPath, 'file.txt');
41 file = PhysicalResourceProvider.INSTANCE.getResource(path); 44 file = PhysicalResourceProvider.INSTANCE.getResource(path);
42 } 45 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 new io.Directory(newPath).createSync(); 176 new io.Directory(newPath).createSync();
174 File file = PhysicalResourceProvider.INSTANCE.getResource(oldPath); 177 File file = PhysicalResourceProvider.INSTANCE.getResource(oldPath);
175 expect(() { 178 expect(() {
176 file.renameSync(newPath); 179 file.renameSync(newPath);
177 }, throwsA(_isFileSystemException)); 180 }, throwsA(_isFileSystemException));
178 expect(file.path, oldPath); 181 expect(file.path, oldPath);
179 expect(file.exists, isTrue); 182 expect(file.exists, isTrue);
180 } 183 }
181 184
182 void test_resolveSymbolicLinksSync_links() { 185 void test_resolveSymbolicLinksSync_links() {
183 Context pathContext = PhysicalResourceProvider.INSTANCE.pathContext; 186 pathos.Context pathContext = PhysicalResourceProvider.INSTANCE.pathContext;
184 String pathA = pathContext.join(tempPath, 'a'); 187 String pathA = pathContext.join(tempPath, 'a');
185 String pathB = pathContext.join(pathA, 'b'); 188 String pathB = pathContext.join(pathA, 'b');
186 new io.Directory(pathB).createSync(recursive: true); 189 new io.Directory(pathB).createSync(recursive: true);
187 String filePath = pathContext.join(pathB, 'test.txt'); 190 String filePath = pathContext.join(pathB, 'test.txt');
188 io.File testFile = new io.File(filePath); 191 io.File testFile = new io.File(filePath);
189 testFile.writeAsStringSync('test'); 192 testFile.writeAsStringSync('test');
190 193
191 String pathC = pathContext.join(tempPath, 'c'); 194 String pathC = pathContext.join(tempPath, 'c');
192 String pathD = pathContext.join(pathC, 'd'); 195 String pathD = pathContext.join(pathC, 'd');
193 new io.Link(pathD).createSync(pathA, recursive: true); 196 new io.Link(pathD).createSync(pathA, recursive: true);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 Folder folder = PhysicalResourceProvider.INSTANCE.getFolder(path); 436 Folder folder = PhysicalResourceProvider.INSTANCE.getFolder(path);
434 expect(folder.toUri(), new Uri.directory(path)); 437 expect(folder.toUri(), new Uri.directory(path));
435 } 438 }
436 } 439 }
437 440
438 @reflectiveTest 441 @reflectiveTest
439 class PhysicalResourceProviderTest extends _BaseTest { 442 class PhysicalResourceProviderTest extends _BaseTest {
440 test_getFolder_trailingSeparator() { 443 test_getFolder_trailingSeparator() {
441 String path = tempPath; 444 String path = tempPath;
442 PhysicalResourceProvider provider = PhysicalResourceProvider.INSTANCE; 445 PhysicalResourceProvider provider = PhysicalResourceProvider.INSTANCE;
443 Folder folder = provider.getFolder('$path$separator'); 446 Folder folder = provider.getFolder('$path${pathos.separator}');
444 expect(folder.path, path); 447 expect(folder.path, path);
445 } 448 }
446 449
447 test_getModificationTimes() async { 450 test_getModificationTimes() async {
448 PhysicalResourceProvider provider = PhysicalResourceProvider.INSTANCE; 451 PhysicalResourceProvider provider = PhysicalResourceProvider.INSTANCE;
449 String path = join(tempPath, 'file1.txt'); 452 String path = join(tempPath, 'file1.txt');
450 new io.File(path).writeAsStringSync(''); 453 new io.File(path).writeAsStringSync('');
451 Source source = provider.getFile(path).createSource(); 454 Source source = provider.getFile(path).createSource();
452 List<int> times = await provider.getModificationTimes([source]); 455 List<int> times = await provider.getModificationTimes([source]);
453 expect(times, [source.modificationStamp]); 456 expect(times, [source.modificationStamp]);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 623
621 setUp() { 624 setUp() {
622 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); 625 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource');
623 tempPath = tempDirectory.absolute.path; 626 tempPath = tempDirectory.absolute.path;
624 } 627 }
625 628
626 tearDown() { 629 tearDown() {
627 tempDirectory.deleteSync(recursive: true); 630 tempDirectory.deleteSync(recursive: true);
628 } 631 }
629 } 632 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698