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 engine.compile_time_error_code_test; | 5 library engine.compile_time_error_code_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/error.dart'; | 7 import 'package:analyzer/src/generated/error.dart'; |
8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
10 | 10 |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 | 1628 |
1629 class A {}'''); | 1629 class A {}'''); |
1630 Source sourceB = addNamedSource( | 1630 Source sourceB = addNamedSource( |
1631 "/b.dart", | 1631 "/b.dart", |
1632 r''' | 1632 r''' |
1633 part of lib; | 1633 part of lib; |
1634 | 1634 |
1635 class A {}'''); | 1635 class A {}'''); |
1636 computeLibrarySourceErrors(librarySource); | 1636 computeLibrarySourceErrors(librarySource); |
1637 assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 1637 assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 1638 assertNoErrors(librarySource); |
1638 verify([librarySource, sourceA, sourceB]); | 1639 verify([librarySource, sourceA, sourceB]); |
1639 } | 1640 } |
1640 | 1641 |
| 1642 void test_duplicateDefinition_inPart() { |
| 1643 Source librarySource = addNamedSource( |
| 1644 "/lib.dart", |
| 1645 r''' |
| 1646 library test; |
| 1647 part 'a.dart'; |
| 1648 class A {}'''); |
| 1649 Source sourceA = addNamedSource( |
| 1650 "/a.dart", |
| 1651 r''' |
| 1652 part of test; |
| 1653 class A {}'''); |
| 1654 computeLibrarySourceErrors(librarySource); |
| 1655 assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 1656 assertNoErrors(librarySource); |
| 1657 verify([librarySource, sourceA]); |
| 1658 } |
| 1659 |
1641 void test_duplicateDefinition_catch() { | 1660 void test_duplicateDefinition_catch() { |
1642 Source source = addSource(r''' | 1661 Source source = addSource(r''' |
1643 main() { | 1662 main() { |
1644 try {} catch (e, e) {} | 1663 try {} catch (e, e) {} |
1645 }'''); | 1664 }'''); |
1646 computeLibrarySourceErrors(source); | 1665 computeLibrarySourceErrors(source); |
1647 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 1666 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
1648 verify([source]); | 1667 verify([source]); |
1649 } | 1668 } |
1650 | 1669 |
(...skipping 4582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6233 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 6252 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
6234 verify([source]); | 6253 verify([source]); |
6235 reset(); | 6254 reset(); |
6236 } | 6255 } |
6237 | 6256 |
6238 void _check_wrongNumberOfParametersForOperator1(String name) { | 6257 void _check_wrongNumberOfParametersForOperator1(String name) { |
6239 _check_wrongNumberOfParametersForOperator(name, ""); | 6258 _check_wrongNumberOfParametersForOperator(name, ""); |
6240 _check_wrongNumberOfParametersForOperator(name, "a, b"); | 6259 _check_wrongNumberOfParametersForOperator(name, "a, b"); |
6241 } | 6260 } |
6242 } | 6261 } |
OLD | NEW |