| 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.dart.ast.ast_test; | 5 library analyzer.test.dart.ast.ast_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/src/generated/java_core.dart'; | |
| 9 import 'package:analyzer/src/generated/scanner.dart'; | 8 import 'package:analyzer/src/generated/scanner.dart'; |
| 10 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 9 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 11 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 10 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 12 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 13 | 12 |
| 14 import '../../generated/parser_test.dart' show ParserTestCase; | 13 import '../../generated/parser_test.dart' show ParserTestCase; |
| 15 import '../../generated/test_support.dart'; | 14 import '../../generated/test_support.dart'; |
| 16 import '../../reflective_tests.dart'; | 15 import '../../reflective_tests.dart'; |
| 17 import '../../utils.dart'; | 16 import '../../utils.dart'; |
| 18 | 17 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 AstNode firstNode = AstFactory.booleanLiteral(true); | 494 AstNode firstNode = AstFactory.booleanLiteral(true); |
| 496 AstNode secondNode = AstFactory.booleanLiteral(false); | 495 AstNode secondNode = AstFactory.booleanLiteral(false); |
| 497 AstNode thirdNode = AstFactory.booleanLiteral(true); | 496 AstNode thirdNode = AstFactory.booleanLiteral(true); |
| 498 nodes.add(firstNode); | 497 nodes.add(firstNode); |
| 499 nodes.add(secondNode); | 498 nodes.add(secondNode); |
| 500 nodes.add(thirdNode); | 499 nodes.add(thirdNode); |
| 501 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList()); | 500 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList()); |
| 502 list.addAll(nodes); | 501 list.addAll(nodes); |
| 503 expect(list, hasLength(3)); | 502 expect(list, hasLength(3)); |
| 504 AstNode fourthNode = AstFactory.integer(0); | 503 AstNode fourthNode = AstFactory.integer(0); |
| 505 expect(javaListSet(list, 1, fourthNode), same(secondNode)); | 504 list[1] = fourthNode; |
| 506 expect(list, hasLength(3)); | 505 expect(list, hasLength(3)); |
| 507 expect(list[0], same(firstNode)); | 506 expect(list[0], same(firstNode)); |
| 508 expect(list[1], same(fourthNode)); | 507 expect(list[1], same(fourthNode)); |
| 509 expect(list[2], same(thirdNode)); | 508 expect(list[2], same(thirdNode)); |
| 510 } | 509 } |
| 511 | 510 |
| 512 void test_set_negative() { | 511 void test_set_negative() { |
| 513 AstNode node = AstFactory.booleanLiteral(true); | 512 AstNode node = AstFactory.booleanLiteral(true); |
| 514 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList()); | 513 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList()); |
| 515 try { | 514 try { |
| 516 javaListSet(list, -1, node); | 515 list[-1] = node; |
| 517 fail("Expected IndexOutOfBoundsException"); | 516 fail("Expected IndexOutOfBoundsException"); |
| 518 } on RangeError { | 517 } on RangeError { |
| 519 // Expected | 518 // Expected |
| 520 } | 519 } |
| 521 } | 520 } |
| 522 | 521 |
| 523 void test_set_tooBig() { | 522 void test_set_tooBig() { |
| 524 AstNode node = AstFactory.booleanLiteral(true); | 523 AstNode node = AstFactory.booleanLiteral(true); |
| 525 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList()); | 524 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList()); |
| 526 try { | 525 try { |
| 527 javaListSet(list, 1, node); | 526 list[1] = node; |
| 528 fail("Expected IndexOutOfBoundsException"); | 527 fail("Expected IndexOutOfBoundsException"); |
| 529 } on RangeError { | 528 } on RangeError { |
| 530 // Expected | 529 // Expected |
| 531 } | 530 } |
| 532 } | 531 } |
| 533 } | 532 } |
| 534 | 533 |
| 535 @reflectiveTest | 534 @reflectiveTest |
| 536 class SimpleIdentifierTest extends ParserTestCase { | 535 class SimpleIdentifierTest extends ParserTestCase { |
| 537 void test_inDeclarationContext_catch_exception() { | 536 void test_inDeclarationContext_catch_exception() { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 final int ordinal; | 1298 final int ordinal; |
| 1300 | 1299 |
| 1301 const _WrapperKind(this.name, this.ordinal); | 1300 const _WrapperKind(this.name, this.ordinal); |
| 1302 | 1301 |
| 1303 int get hashCode => ordinal; | 1302 int get hashCode => ordinal; |
| 1304 | 1303 |
| 1305 int compareTo(_WrapperKind other) => ordinal - other.ordinal; | 1304 int compareTo(_WrapperKind other) => ordinal - other.ordinal; |
| 1306 | 1305 |
| 1307 String toString() => name; | 1306 String toString() => name; |
| 1308 } | 1307 } |
| OLD | NEW |