| OLD | NEW |
| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 void test_factory_hasWorkspaceFile_forWorkspace() { | 138 void test_factory_hasWorkspaceFile_forWorkspace() { |
| 139 provider.newFile(_p('/workspace/WORKSPACE'), ''); | 139 provider.newFile(_p('/workspace/WORKSPACE'), ''); |
| 140 BazelWorkspace workspace = new BazelWorkspace(provider, _p('/workspace')); | 140 BazelWorkspace workspace = new BazelWorkspace(provider, _p('/workspace')); |
| 141 expect(workspace.root, _p('/workspace')); | 141 expect(workspace.root, _p('/workspace')); |
| 142 expect(workspace.readonly, isNull); | 142 expect(workspace.readonly, isNull); |
| 143 expect(workspace.bin, _p('/workspace/bazel-bin')); | 143 expect(workspace.bin, _p('/workspace/bazel-bin')); |
| 144 expect(workspace.genfiles, _p('/workspace/bazel-genfiles')); | 144 expect(workspace.genfiles, _p('/workspace/bazel-genfiles')); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void test_factory_null_notInWorkspace() { | 147 void test_factory_notInWorkspace() { |
| 148 BazelWorkspace workspace = | 148 BazelWorkspace workspace = |
| 149 new BazelWorkspace(provider, _p('/workspace/my/module')); | 149 new BazelWorkspace(provider, _p('/workspace/my/module')); |
| 150 expect(workspace, isNull); | 150 expect(workspace, isNotNull); |
| 151 expect(workspace.root, _p('/workspace/my/module')); |
| 152 expect(workspace.readonly, isNull); |
| 153 expect(workspace.bin, isNull); |
| 154 expect(workspace.genfiles, isNull); |
| 151 } | 155 } |
| 152 | 156 |
| 153 void test_factory_symlinkPrefix() { | 157 void test_factory_symlinkPrefix() { |
| 154 provider.newFile(_p('/workspace/WORKSPACE'), ''); | 158 provider.newFile(_p('/workspace/WORKSPACE'), ''); |
| 155 BazelWorkspace workspace = | 159 BazelWorkspace workspace = |
| 156 new BazelWorkspace(provider, _p('/workspace'), symlinkPrefix: 'foobar'); | 160 new BazelWorkspace(provider, _p('/workspace'), symlinkPrefix: 'foobar'); |
| 157 expect(workspace.root, _p('/workspace')); | 161 expect(workspace.root, _p('/workspace')); |
| 158 expect(workspace.readonly, isNull); | 162 expect(workspace.readonly, isNull); |
| 159 expect(workspace.bin, _p('/workspace/foobar-bin')); | 163 expect(workspace.bin, _p('/workspace/foobar-bin')); |
| 160 expect(workspace.genfiles, _p('/workspace/foobar-genfiles')); | 164 expect(workspace.genfiles, _p('/workspace/foobar-genfiles')); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 220 } |
| 217 | 221 |
| 218 class _BaseTest { | 222 class _BaseTest { |
| 219 final MemoryResourceProvider provider = new MemoryResourceProvider(); | 223 final MemoryResourceProvider provider = new MemoryResourceProvider(); |
| 220 | 224 |
| 221 /** | 225 /** |
| 222 * Return the [provider] specific path for the given Posix [path]. | 226 * Return the [provider] specific path for the given Posix [path]. |
| 223 */ | 227 */ |
| 224 String _p(String path) => provider.convertPath(path); | 228 String _p(String path) => provider.convertPath(path); |
| 225 } | 229 } |
| OLD | NEW |