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 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 5 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
6 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
8 | 8 |
9 import '../integration_tests.dart'; | 9 import '../integration_tests.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 defineReflectiveSuite(() { | 12 defineReflectiveSuite(() { |
13 defineReflectiveTests(MapUriTest); | 13 defineReflectiveTests(DeleteContextTest); |
14 defineReflectiveTests(MapUriTest_Driver); | |
15 }); | 14 }); |
16 } | 15 } |
17 | 16 |
18 class AbstractMapUriTest extends AbstractAnalysisServerIntegrationTest { | 17 @reflectiveTest |
19 test_mapUri() async { | 18 class DeleteContextTest extends AbstractAnalysisServerIntegrationTest { |
19 test_delete() async { | |
20 String pathname = sourcePath('lib/main.dart'); | 20 String pathname = sourcePath('lib/main.dart'); |
21 writeFile(pathname, '// dummy'); | 21 writeFile(pathname, '// dummy'); |
22 writeFile(sourcePath('.packages'), 'foo:lib/'); | 22 writeFile(sourcePath('.packages'), 'foo:lib/'); |
23 standardAnalysisSetup(); | 23 standardAnalysisSetup(); |
24 | 24 |
25 String contextId = | 25 String contextId = |
26 (await sendExecutionCreateContext(sourceDirectory.path))?.id; | 26 (await sendExecutionCreateContext(sourceDirectory.path)).id; |
27 | 27 |
28 { | 28 ExecutionMapUriResult result = |
29 ExecutionMapUriResult result = | 29 await sendExecutionMapUri(contextId, uri: 'package:foo/main.dart'); |
30 expect(result.file, pathname); | |
31 | |
32 expect(await sendExecutionDeleteContext(contextId), isNull); | |
33 | |
34 // After the delete, expect this to fail. | |
35 try { | |
36 result = | |
30 await sendExecutionMapUri(contextId, uri: 'package:foo/main.dart'); | 37 await sendExecutionMapUri(contextId, uri: 'package:foo/main.dart'); |
31 expect(result.file, pathname); | 38 fail('expected exception after context delete'); |
32 } | 39 } catch (ignore) {} |
Paul Berry
2017/02/12 14:39:04
This won't work because the way the fail() method
devoncarew
2017/02/12 17:52:34
Ah, good catch! I'll add a class as above.
| |
40 } | |
33 | 41 |
34 { | |
35 ExecutionMapUriResult result = | |
36 await sendExecutionMapUri(contextId, file: pathname); | |
37 expect(result.uri, 'package:foo/main.dart'); | |
38 } | |
39 } | |
40 } | |
41 | |
42 @reflectiveTest | |
43 class MapUriTest extends AbstractMapUriTest {} | |
44 | |
45 @reflectiveTest | |
46 class MapUriTest_Driver extends AbstractMapUriTest { | |
47 @override | 42 @override |
48 bool get enableNewAnalysisDriver => true; | 43 bool get enableNewAnalysisDriver => true; |
49 } | 44 } |
OLD | NEW |