| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.gn_test; | 5 library analyzer.test.generated.gn_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/gn.dart'; | 8 import 'package:analyzer/src/generated/gn.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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 void test_resolve() { | 25 void test_resolve() { |
| 26 _addResources([ | 26 _addResources([ |
| 27 '/workspace/.jiri_root/', | 27 '/workspace/.jiri_root/', |
| 28 '/workspace/out/debug-x87_128/gen/dart.sources/', | 28 '/workspace/out/debug-x87_128/gen/dart.sources/', |
| 29 '/workspace/some/code/', | 29 '/workspace/some/code/', |
| 30 '/workspace/a/source/code.dart', | 30 '/workspace/a/source/code.dart', |
| 31 ]); | 31 ]); |
| 32 provider.newFile( | 32 provider.newFile( |
| 33 _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'), | 33 _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'), |
| 34 '/workspace/a/source'); | 34 _p('/workspace/a/source')); |
| 35 _setUp(); | 35 _setUp(); |
| 36 _assertResolve( | 36 _assertResolve( |
| 37 'package:flutter/code.dart', '/workspace/a/source/code.dart'); | 37 'package:flutter/code.dart', '/workspace/a/source/code.dart'); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void test_resolveDoesNotExist() { | 40 void test_resolveDoesNotExist() { |
| 41 _addResources([ | 41 _addResources([ |
| 42 '/workspace/.jiri_root/', | 42 '/workspace/.jiri_root/', |
| 43 '/workspace/out/debug-x87_128/gen/dart.sources/', | 43 '/workspace/out/debug-x87_128/gen/dart.sources/', |
| 44 '/workspace/some/code/', | 44 '/workspace/some/code/', |
| 45 '/workspace/a/source/code.dart', | 45 '/workspace/a/source/code.dart', |
| 46 ]); | 46 ]); |
| 47 provider.newFile( | 47 provider.newFile( |
| 48 _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'), | 48 _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'), |
| 49 '/workspace/a/source'); | 49 _p('/workspace/a/source')); |
| 50 _setUp(); | 50 _setUp(); |
| 51 expect( | 51 expect( |
| 52 resolver.resolveAbsolute(Uri.parse('package:bogus/code.dart')), null); | 52 resolver.resolveAbsolute(Uri.parse('package:bogus/code.dart')), null); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void _addResources(List<String> paths) { | 55 void _addResources(List<String> paths) { |
| 56 for (String path in paths) { | 56 for (String path in paths) { |
| 57 if (path.endsWith('/')) { | 57 if (path.endsWith('/')) { |
| 58 provider.newFolder(_p(path.substring(0, path.length - 1))); | 58 provider.newFolder(_p(path.substring(0, path.length - 1))); |
| 59 } else { | 59 } else { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 class _BaseTest { | 125 class _BaseTest { |
| 126 final MemoryResourceProvider provider = new MemoryResourceProvider(); | 126 final MemoryResourceProvider provider = new MemoryResourceProvider(); |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * Return the [provider] specific path for the given Posix [path]. | 129 * Return the [provider] specific path for the given Posix [path]. |
| 130 */ | 130 */ |
| 131 String _p(String path) => provider.convertPath(path); | 131 String _p(String path) => provider.convertPath(path); |
| 132 } | 132 } |
| OLD | NEW |