Chromium Code Reviews| 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 analyzer.test.generated.all_the_rest_test; | 5 library analyzer.test.generated.all_the_rest_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2558 null, | 2558 null, |
| 2559 null, | 2559 null, |
| 2560 AstFactory.identifier3("main"), | 2560 AstFactory.identifier3("main"), |
| 2561 AstFactory.formalParameterList([formalParameter]), | 2561 AstFactory.formalParameterList([formalParameter]), |
| 2562 body); | 2562 body); |
| 2563 } | 2563 } |
| 2564 } | 2564 } |
| 2565 | 2565 |
| 2566 @reflectiveTest | 2566 @reflectiveTest |
| 2567 class ElementLocatorTest extends ResolverTestCase { | 2567 class ElementLocatorTest extends ResolverTestCase { |
| 2568 void fail_locate_ExportDirective() { | 2568 void test_locate_ExportDirective() { |
| 2569 AstNode id = _findNodeIn("export", "export 'dart:core';"); | 2569 AstNode id = _findNodeIn("export", "export 'dart:core';"); |
| 2570 Element element = ElementLocator.locate(id); | 2570 Element element = ElementLocator.locate(id); |
| 2571 EngineTestCase.assertInstanceOf( | 2571 EngineTestCase.assertInstanceOf( |
| 2572 (obj) => obj is ImportElement, ImportElement, element); | 2572 (obj) => obj is ExportElement, ExportElement, element); |
| 2573 } | 2573 } |
| 2574 | 2574 |
| 2575 void fail_locate_Identifier_libraryDirective() { | 2575 void test_locate_Identifier_libraryDirective() { |
| 2576 AstNode id = _findNodeIn("foo", "library foo.bar;"); | 2576 AstNode id = _findNodeIn("foo", "library foo.bar;"); |
| 2577 Element element = ElementLocator.locate(id); | 2577 Element element = ElementLocator.locate(id); |
| 2578 EngineTestCase.assertInstanceOf( | 2578 EngineTestCase.assertInstanceOf( |
| 2579 (obj) => obj is LibraryElement, LibraryElement, element); | 2579 (obj) => obj is LibraryElement, LibraryElement, element); |
| 2580 } | 2580 } |
| 2581 | 2581 |
| 2582 void fail_locate_Identifier_partOfDirective() { | 2582 void fail_locate_Identifier_partOfDirective() { |
| 2583 // Can't resolve the library element without the library declaration. | 2583 // Can't resolve the library element without the library declaration. |
| 2584 // AstNode id = findNodeIn("foo", "part of foo.bar;"); | 2584 // AstNode id = findNodeIn("foo", "part of foo.bar;"); |
| 2585 // Element element = ElementLocator.locate(id); | 2585 // Element element = ElementLocator.locate(id); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3260 } | 3260 } |
| 3261 } | 3261 } |
| 3262 | 3262 |
| 3263 /** | 3263 /** |
| 3264 * Tests for the [ExitDetector] that do not require that the AST be resolved. | 3264 * Tests for the [ExitDetector] that do not require that the AST be resolved. |
| 3265 * | 3265 * |
| 3266 * See [ExitDetectorTest2] for tests that require the AST to be resolved. | 3266 * See [ExitDetectorTest2] for tests that require the AST to be resolved. |
| 3267 */ | 3267 */ |
| 3268 @reflectiveTest | 3268 @reflectiveTest |
| 3269 class ExitDetectorTest extends ParserTestCase { | 3269 class ExitDetectorTest extends ParserTestCase { |
| 3270 void fail_doStatement_continue_with_label() { | |
| 3271 _assertFalse("{ x: do { continue x; } while(true); }"); | |
| 3272 } | |
| 3273 | |
| 3274 void fail_whileStatement_continue_with_label() { | |
| 3275 _assertFalse("{ x: while (true) { continue x; } }"); | |
| 3276 } | |
| 3277 | |
| 3278 void fail_whileStatement_doStatement_scopeRequired() { | |
| 3279 _assertTrue("{ while (true) { x: do { continue x; } while(true); }"); | |
|
srawlins
2016/06/22 20:57:43
This was only failing because it didn't have enoug
| |
| 3280 } | |
| 3281 | |
| 3282 void test_asExpression() { | 3270 void test_asExpression() { |
| 3283 _assertFalse("a as Object;"); | 3271 _assertFalse("a as Object;"); |
| 3284 } | 3272 } |
| 3285 | 3273 |
| 3286 void test_asExpression_throw() { | 3274 void test_asExpression_throw() { |
| 3287 _assertTrue("throw '' as Object;"); | 3275 _assertTrue("throw '' as Object;"); |
| 3288 } | 3276 } |
| 3289 | 3277 |
| 3290 void test_assertStatement() { | 3278 void test_assertStatement() { |
| 3291 _assertFalse("assert(a);"); | 3279 _assertFalse("assert(a);"); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3488 } | 3476 } |
| 3489 | 3477 |
| 3490 void test_doStatement_true_break() { | 3478 void test_doStatement_true_break() { |
| 3491 _assertFalse("{ do { break; } while (true); }"); | 3479 _assertFalse("{ do { break; } while (true); }"); |
| 3492 } | 3480 } |
| 3493 | 3481 |
| 3494 void test_doStatement_true_continue() { | 3482 void test_doStatement_true_continue() { |
| 3495 _assertTrue("{ do { continue; } while (true); }"); | 3483 _assertTrue("{ do { continue; } while (true); }"); |
| 3496 } | 3484 } |
| 3497 | 3485 |
| 3486 void test_doStatement_true_continueWithLabel() { | |
| 3487 _assertTrue("{ x: do { continue x; } while (true); }"); | |
|
srawlins
2016/06/22 20:57:43
I changed these to _assertTrue because... this doe
Brian Wilkerson
2016/06/22 21:46:24
I don't understand. I would say that an infinite l
srawlins
2016/06/22 23:12:27
Here's the description of ExitDetector:
"Instance
| |
| 3488 } | |
| 3489 | |
| 3490 | |
| 3498 void test_doStatement_true_if_return() { | 3491 void test_doStatement_true_if_return() { |
| 3499 _assertTrue("{ do { if (true) {return null;} } while (true); }"); | 3492 _assertTrue("{ do { if (true) {return null;} } while (true); }"); |
| 3500 } | 3493 } |
| 3501 | 3494 |
| 3502 void test_doStatement_true_noBreak() { | 3495 void test_doStatement_true_noBreak() { |
| 3503 _assertTrue("{ do {} while (true); }"); | 3496 _assertTrue("{ do {} while (true); }"); |
| 3504 } | 3497 } |
| 3505 | 3498 |
| 3506 void test_doStatement_true_return() { | 3499 void test_doStatement_true_return() { |
| 3507 _assertTrue("{ do { return null; } while (true); }"); | 3500 _assertTrue("{ do { return null; } while (true); }"); |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3881 } | 3874 } |
| 3882 | 3875 |
| 3883 void test_whileStatement_true_break() { | 3876 void test_whileStatement_true_break() { |
| 3884 _assertFalse("{ while (true) { break; } }"); | 3877 _assertFalse("{ while (true) { break; } }"); |
| 3885 } | 3878 } |
| 3886 | 3879 |
| 3887 void test_whileStatement_true_continue() { | 3880 void test_whileStatement_true_continue() { |
| 3888 _assertTrue("{ while (true) { continue; } }"); | 3881 _assertTrue("{ while (true) { continue; } }"); |
| 3889 } | 3882 } |
| 3890 | 3883 |
| 3884 void test_whileStatement_true_continueWithLabel() { | |
| 3885 _assertTrue("{ x: while (true) { continue x; } }"); | |
| 3886 } | |
| 3887 | |
| 3888 void test_whileStatement_true_doStatement_scopeRequired() { | |
| 3889 _assertTrue("{ while (true) { x: do { continue x; } while (true); } }"); | |
| 3890 } | |
| 3891 | |
| 3891 void test_whileStatement_true_if_return() { | 3892 void test_whileStatement_true_if_return() { |
| 3892 _assertTrue("{ while (true) { if (true) {return null;} } }"); | 3893 _assertTrue("{ while (true) { if (true) {return null;} } }"); |
| 3893 } | 3894 } |
| 3894 | 3895 |
| 3895 void test_whileStatement_true_noBreak() { | 3896 void test_whileStatement_true_noBreak() { |
| 3896 _assertTrue("{ while (true) {} }"); | 3897 _assertTrue("{ while (true) {} }"); |
| 3897 } | 3898 } |
| 3898 | 3899 |
| 3899 void test_whileStatement_true_return() { | 3900 void test_whileStatement_true_return() { |
| 3900 _assertTrue("{ while (true) { return null; } }"); | 3901 _assertTrue("{ while (true) { return null; } }"); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4490 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 4491 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
| 4491 expect(UriKind.fromEncoding(0x58), same(null)); | 4492 expect(UriKind.fromEncoding(0x58), same(null)); |
| 4492 } | 4493 } |
| 4493 | 4494 |
| 4494 void test_getEncoding() { | 4495 void test_getEncoding() { |
| 4495 expect(UriKind.DART_URI.encoding, 0x64); | 4496 expect(UriKind.DART_URI.encoding, 0x64); |
| 4496 expect(UriKind.FILE_URI.encoding, 0x66); | 4497 expect(UriKind.FILE_URI.encoding, 0x66); |
| 4497 expect(UriKind.PACKAGE_URI.encoding, 0x70); | 4498 expect(UriKind.PACKAGE_URI.encoding, 0x70); |
| 4498 } | 4499 } |
| 4499 } | 4500 } |
| OLD | NEW |