OLD | NEW |
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 test.src.context.context_test; | 5 library test.src.context.context_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/file_system/memory_file_system.dart'; | 9 import 'package:analyzer/file_system/memory_file_system.dart'; |
10 import 'package:analyzer/src/cancelable_future.dart'; | 10 import 'package:analyzer/src/cancelable_future.dart'; |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 context.computeLibraryElement(source); | 1434 context.computeLibraryElement(source); |
1435 expect(context.isClientLibrary(source), isTrue); | 1435 expect(context.isClientLibrary(source), isTrue); |
1436 expect(context.isServerLibrary(source), isFalse); | 1436 expect(context.isServerLibrary(source), isFalse); |
1437 } | 1437 } |
1438 | 1438 |
1439 void test_isClientLibrary_html() { | 1439 void test_isClientLibrary_html() { |
1440 Source source = addSource("/test.html", "<html></html>"); | 1440 Source source = addSource("/test.html", "<html></html>"); |
1441 expect(context.isClientLibrary(source), isFalse); | 1441 expect(context.isClientLibrary(source), isFalse); |
1442 } | 1442 } |
1443 | 1443 |
| 1444 void test_isClientLibrary_unknown() { |
| 1445 Source source = newSource("/test.dart"); |
| 1446 expect(context.isClientLibrary(source), isFalse); |
| 1447 } |
| 1448 |
1444 void test_isServerLibrary_dart() { | 1449 void test_isServerLibrary_dart() { |
1445 Source source = addSource( | 1450 Source source = addSource( |
1446 "/test.dart", | 1451 "/test.dart", |
1447 r''' | 1452 r''' |
1448 library lib; | 1453 library lib; |
1449 | 1454 |
1450 main() {}'''); | 1455 main() {}'''); |
1451 expect(context.isClientLibrary(source), isFalse); | 1456 expect(context.isClientLibrary(source), isFalse); |
1452 expect(context.isServerLibrary(source), isFalse); | 1457 expect(context.isServerLibrary(source), isFalse); |
1453 context.computeLibraryElement(source); | 1458 context.computeLibraryElement(source); |
1454 expect(context.isClientLibrary(source), isFalse); | 1459 expect(context.isClientLibrary(source), isFalse); |
1455 expect(context.isServerLibrary(source), isTrue); | 1460 expect(context.isServerLibrary(source), isTrue); |
1456 } | 1461 } |
1457 | 1462 |
1458 void test_isServerLibrary_html() { | 1463 void test_isServerLibrary_html() { |
1459 Source source = addSource("/test.html", "<html></html>"); | 1464 Source source = addSource("/test.html", "<html></html>"); |
1460 expect(context.isServerLibrary(source), isFalse); | 1465 expect(context.isServerLibrary(source), isFalse); |
1461 } | 1466 } |
1462 | 1467 |
| 1468 void test_isServerLibrary_unknown() { |
| 1469 Source source = newSource("/test.dart"); |
| 1470 expect(context.isServerLibrary(source), isFalse); |
| 1471 } |
| 1472 |
1463 void test_parseCompilationUnit_errors() { | 1473 void test_parseCompilationUnit_errors() { |
1464 Source source = addSource("/lib.dart", "library {"); | 1474 Source source = addSource("/lib.dart", "library {"); |
1465 CompilationUnit compilationUnit = context.parseCompilationUnit(source); | 1475 CompilationUnit compilationUnit = context.parseCompilationUnit(source); |
1466 expect(compilationUnit, isNotNull); | 1476 expect(compilationUnit, isNotNull); |
1467 var errorInfo = context.getErrors(source); | 1477 var errorInfo = context.getErrors(source); |
1468 expect(errorInfo, isNotNull); | 1478 expect(errorInfo, isNotNull); |
1469 List<AnalysisError> errors = errorInfo.errors; | 1479 List<AnalysisError> errors = errorInfo.errors; |
1470 expect(errors, isNotNull); | 1480 expect(errors, isNotNull); |
1471 expect(errors.length > 0, isTrue); | 1481 expect(errors.length > 0, isTrue); |
1472 } | 1482 } |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 } | 2650 } |
2641 } | 2651 } |
2642 | 2652 |
2643 class _AnalysisContextImplTest_test_applyChanges_removeContainer | 2653 class _AnalysisContextImplTest_test_applyChanges_removeContainer |
2644 implements SourceContainer { | 2654 implements SourceContainer { |
2645 Source libB; | 2655 Source libB; |
2646 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); | 2656 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); |
2647 @override | 2657 @override |
2648 bool contains(Source source) => source == libB; | 2658 bool contains(Source source) => source == libB; |
2649 } | 2659 } |
OLD | NEW |