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

Side by Side Diff: pkg/analyzer/test/generated/bazel_test.dart

Issue 2502103003: Change BazelWorkspace so that it checks the main source directory before READONLY. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/bazel.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.generated.bazel_test; 5 library analyzer.test.generated.bazel_test;
6 6
7 import 'package:analyzer/file_system/memory_file_system.dart'; 7 import 'package:analyzer/file_system/memory_file_system.dart';
8 import 'package:analyzer/src/generated/bazel.dart'; 8 import 'package:analyzer/src/generated/bazel.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 .findFile(_p('/Users/user/test/prime/my/module/test3.dart')) 605 .findFile(_p('/Users/user/test/prime/my/module/test3.dart'))
606 .path, 606 .path,
607 _p('/Users/user/test/prime/bazel-genfiles/my/module/test3.dart')); 607 _p('/Users/user/test/prime/bazel-genfiles/my/module/test3.dart'));
608 expect( 608 expect(
609 workspace 609 workspace
610 .findFile(_p('/Users/user/test/prime/other/module/test4.dart')) 610 .findFile(_p('/Users/user/test/prime/other/module/test4.dart'))
611 .path, 611 .path,
612 _p('/Users/user/test/READONLY/prime/other/module/test4.dart')); 612 _p('/Users/user/test/READONLY/prime/other/module/test4.dart'));
613 } 613 }
614 614
615 void test_findFile_main_overrides_readonly() {
616 provider.newFolder(_p('/Users/user/test/READONLY/prime'));
617 provider.newFolder(_p('/Users/user/test/prime'));
618 provider.newFolder(_p('/Users/user/test/prime/bazel-genfiles'));
619 provider.newFile(_p('/Users/user/test/prime/my/module/test.dart'), '');
620 provider.newFile(
621 _p('/Users/user/test/READONLY/prime/my/module/test.dart'), '');
622 BazelWorkspace workspace =
623 BazelWorkspace.find(provider, _p('/Users/user/test/prime/my/module'));
624 expect(
625 workspace
626 .findFile(_p('/Users/user/test/prime/my/module/test.dart'))
627 .path,
628 _p('/Users/user/test/prime/my/module/test.dart'));
629 }
630
615 void test_findFile_noReadOnly() { 631 void test_findFile_noReadOnly() {
616 provider.newFile(_p('/workspace/WORKSPACE'), ''); 632 provider.newFile(_p('/workspace/WORKSPACE'), '');
617 provider.newFile(_p('/workspace/my/module/test1.dart'), ''); 633 provider.newFile(_p('/workspace/my/module/test1.dart'), '');
618 provider.newFile(_p('/workspace/my/module/test2.dart'), ''); 634 provider.newFile(_p('/workspace/my/module/test2.dart'), '');
619 provider.newFile(_p('/workspace/my/module/test3.dart'), ''); 635 provider.newFile(_p('/workspace/my/module/test3.dart'), '');
620 provider.newFile(_p('/workspace/bazel-bin/my/module/test2.dart'), ''); 636 provider.newFile(_p('/workspace/bazel-bin/my/module/test2.dart'), '');
621 provider.newFile(_p('/workspace/bazel-genfiles/my/module/test3.dart'), ''); 637 provider.newFile(_p('/workspace/bazel-genfiles/my/module/test3.dart'), '');
622 BazelWorkspace workspace = 638 BazelWorkspace workspace =
623 BazelWorkspace.find(provider, _p('/workspace/my/module')); 639 BazelWorkspace.find(provider, _p('/workspace/my/module'));
624 expect(workspace.findFile(_p('/workspace/my/module/test1.dart')).path, 640 expect(workspace.findFile(_p('/workspace/my/module/test1.dart')).path,
(...skipping 11 matching lines...) Expand all
636 /** 652 /**
637 * Return the [provider] specific path for the given Posix [path]. 653 * Return the [provider] specific path for the given Posix [path].
638 */ 654 */
639 String _p(String path) => provider.convertPath(path); 655 String _p(String path) => provider.convertPath(path);
640 } 656 }
641 657
642 class _MockSource extends TypedMock implements Source { 658 class _MockSource extends TypedMock implements Source {
643 final String fullName; 659 final String fullName;
644 _MockSource(this.fullName); 660 _MockSource(this.fullName);
645 } 661 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/bazel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698