| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.ast_test; | 8 library engine.ast_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); | 79 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); |
| 80 List<AstNode> nodes = new List<AstNode>(); | 80 List<AstNode> nodes = new List<AstNode>(); |
| 81 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_BreadthFirstVi
sitorTest_testIt(nodes); | 81 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_BreadthFirstVi
sitorTest_testIt(nodes); |
| 82 visitor.visitAllNodes(unit); | 82 visitor.visitAllNodes(unit); |
| 83 EngineTestCase.assertSizeOfList(59, nodes); | 83 EngineTestCase.assertSizeOfList(59, nodes); |
| 84 EngineTestCase.assertInstanceOf((obj) => obj is CompilationUnit, Compilation
Unit, nodes[0]); | 84 EngineTestCase.assertInstanceOf((obj) => obj is CompilationUnit, Compilation
Unit, nodes[0]); |
| 85 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla
ration, nodes[2]); | 85 EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDecla
ration, nodes[2]); |
| 86 EngineTestCase.assertInstanceOf((obj) => obj is FunctionDeclaration, Functio
nDeclaration, nodes[3]); | 86 EngineTestCase.assertInstanceOf((obj) => obj is FunctionDeclaration, Functio
nDeclaration, nodes[3]); |
| 87 EngineTestCase.assertInstanceOf((obj) => obj is FunctionDeclarationStatement
, FunctionDeclarationStatement, nodes[27]); | 87 EngineTestCase.assertInstanceOf((obj) => obj is FunctionDeclarationStatement
, FunctionDeclarationStatement, nodes[27]); |
| 88 EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiter
al, nodes[58]); | 88 EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiter
al, nodes[58]); |
| 89 //3 |
| 89 } | 90 } |
| 90 | 91 |
| 91 static dartSuite() { | 92 static dartSuite() { |
| 92 _ut.group('BreadthFirstVisitorTest', () { | 93 _ut.group('BreadthFirstVisitorTest', () { |
| 93 _ut.test('testIt', () { | 94 _ut.test('testIt', () { |
| 94 final __test = new BreadthFirstVisitorTest(); | 95 final __test = new BreadthFirstVisitorTest(); |
| 95 runJUnitTest(__test, __test.testIt); | 96 runJUnitTest(__test, __test.testIt); |
| 96 }); | 97 }); |
| 97 }); | 98 }); |
| 98 } | 99 } |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 JUnitTestCase.assertSame(parent, secondNode.parent); | 868 JUnitTestCase.assertSame(parent, secondNode.parent); |
| 868 JUnitTestCase.assertSame(parent, thirdNode.parent); | 869 JUnitTestCase.assertSame(parent, thirdNode.parent); |
| 869 } | 870 } |
| 870 | 871 |
| 871 void test_add_negative() { | 872 void test_add_negative() { |
| 872 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 873 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 873 try { | 874 try { |
| 874 list.insert(-1, AstFactory.booleanLiteral(true)); | 875 list.insert(-1, AstFactory.booleanLiteral(true)); |
| 875 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 876 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 876 } on RangeError catch (exception) { | 877 } on RangeError catch (exception) { |
| 878 // Expected |
| 877 } | 879 } |
| 878 } | 880 } |
| 879 | 881 |
| 880 void test_add_tooBig() { | 882 void test_add_tooBig() { |
| 881 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 883 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 882 try { | 884 try { |
| 883 list.insert(1, AstFactory.booleanLiteral(true)); | 885 list.insert(1, AstFactory.booleanLiteral(true)); |
| 884 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 886 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 885 } on RangeError catch (exception) { | 887 } on RangeError catch (exception) { |
| 888 // Expected |
| 886 } | 889 } |
| 887 } | 890 } |
| 888 | 891 |
| 889 void test_addAll() { | 892 void test_addAll() { |
| 890 AstNode parent = AstFactory.argumentList([]); | 893 AstNode parent = AstFactory.argumentList([]); |
| 891 List<AstNode> firstNodes = new List<AstNode>(); | 894 List<AstNode> firstNodes = new List<AstNode>(); |
| 892 AstNode firstNode = AstFactory.booleanLiteral(true); | 895 AstNode firstNode = AstFactory.booleanLiteral(true); |
| 893 AstNode secondNode = AstFactory.booleanLiteral(false); | 896 AstNode secondNode = AstFactory.booleanLiteral(false); |
| 894 firstNodes.add(firstNode); | 897 firstNodes.add(firstNode); |
| 895 firstNodes.add(secondNode); | 898 firstNodes.add(secondNode); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 EngineTestCase.assertSizeOfList(0, list); | 935 EngineTestCase.assertSizeOfList(0, list); |
| 933 JUnitTestCase.assertSame(owner, list.owner); | 936 JUnitTestCase.assertSame(owner, list.owner); |
| 934 } | 937 } |
| 935 | 938 |
| 936 void test_get_negative() { | 939 void test_get_negative() { |
| 937 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 940 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 938 try { | 941 try { |
| 939 list[-1]; | 942 list[-1]; |
| 940 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 943 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 941 } on RangeError catch (exception) { | 944 } on RangeError catch (exception) { |
| 945 // Expected |
| 942 } | 946 } |
| 943 } | 947 } |
| 944 | 948 |
| 945 void test_get_tooBig() { | 949 void test_get_tooBig() { |
| 946 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 950 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 947 try { | 951 try { |
| 948 list[1]; | 952 list[1]; |
| 949 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 953 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 950 } on RangeError catch (exception) { | 954 } on RangeError catch (exception) { |
| 955 // Expected |
| 951 } | 956 } |
| 952 } | 957 } |
| 953 | 958 |
| 954 void test_getBeginToken_empty() { | 959 void test_getBeginToken_empty() { |
| 955 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 960 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 956 JUnitTestCase.assertNull(list.beginToken); | 961 JUnitTestCase.assertNull(list.beginToken); |
| 957 } | 962 } |
| 958 | 963 |
| 959 void test_getBeginToken_nonEmpty() { | 964 void test_getBeginToken_nonEmpty() { |
| 960 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 965 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 JUnitTestCase.assertSame(firstNode, list[0]); | 1015 JUnitTestCase.assertSame(firstNode, list[0]); |
| 1011 JUnitTestCase.assertSame(thirdNode, list[1]); | 1016 JUnitTestCase.assertSame(thirdNode, list[1]); |
| 1012 } | 1017 } |
| 1013 | 1018 |
| 1014 void test_remove_negative() { | 1019 void test_remove_negative() { |
| 1015 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 1020 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 1016 try { | 1021 try { |
| 1017 list.removeAt(-1); | 1022 list.removeAt(-1); |
| 1018 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1023 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 1019 } on RangeError catch (exception) { | 1024 } on RangeError catch (exception) { |
| 1025 // Expected |
| 1020 } | 1026 } |
| 1021 } | 1027 } |
| 1022 | 1028 |
| 1023 void test_remove_tooBig() { | 1029 void test_remove_tooBig() { |
| 1024 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 1030 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 1025 try { | 1031 try { |
| 1026 list.removeAt(1); | 1032 list.removeAt(1); |
| 1027 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1033 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 1028 } on RangeError catch (exception) { | 1034 } on RangeError catch (exception) { |
| 1035 // Expected |
| 1029 } | 1036 } |
| 1030 } | 1037 } |
| 1031 | 1038 |
| 1032 void test_set() { | 1039 void test_set() { |
| 1033 List<AstNode> nodes = new List<AstNode>(); | 1040 List<AstNode> nodes = new List<AstNode>(); |
| 1034 AstNode firstNode = AstFactory.booleanLiteral(true); | 1041 AstNode firstNode = AstFactory.booleanLiteral(true); |
| 1035 AstNode secondNode = AstFactory.booleanLiteral(false); | 1042 AstNode secondNode = AstFactory.booleanLiteral(false); |
| 1036 AstNode thirdNode = AstFactory.booleanLiteral(true); | 1043 AstNode thirdNode = AstFactory.booleanLiteral(true); |
| 1037 nodes.add(firstNode); | 1044 nodes.add(firstNode); |
| 1038 nodes.add(secondNode); | 1045 nodes.add(secondNode); |
| 1039 nodes.add(thirdNode); | 1046 nodes.add(thirdNode); |
| 1040 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 1047 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 1041 list.addAll(nodes); | 1048 list.addAll(nodes); |
| 1042 EngineTestCase.assertSizeOfList(3, list); | 1049 EngineTestCase.assertSizeOfList(3, list); |
| 1043 AstNode fourthNode = AstFactory.integer(0); | 1050 AstNode fourthNode = AstFactory.integer(0); |
| 1044 JUnitTestCase.assertSame(secondNode, javaListSet(list, 1, fourthNode)); | 1051 JUnitTestCase.assertSame(secondNode, javaListSet(list, 1, fourthNode)); |
| 1045 EngineTestCase.assertSizeOfList(3, list); | 1052 EngineTestCase.assertSizeOfList(3, list); |
| 1046 JUnitTestCase.assertSame(firstNode, list[0]); | 1053 JUnitTestCase.assertSame(firstNode, list[0]); |
| 1047 JUnitTestCase.assertSame(fourthNode, list[1]); | 1054 JUnitTestCase.assertSame(fourthNode, list[1]); |
| 1048 JUnitTestCase.assertSame(thirdNode, list[2]); | 1055 JUnitTestCase.assertSame(thirdNode, list[2]); |
| 1049 } | 1056 } |
| 1050 | 1057 |
| 1051 void test_set_negative() { | 1058 void test_set_negative() { |
| 1052 AstNode node = AstFactory.booleanLiteral(true); | 1059 AstNode node = AstFactory.booleanLiteral(true); |
| 1053 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 1060 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 1054 try { | 1061 try { |
| 1055 javaListSet(list, -1, node); | 1062 javaListSet(list, -1, node); |
| 1056 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1063 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 1057 } on RangeError catch (exception) { | 1064 } on RangeError catch (exception) { |
| 1065 // Expected |
| 1058 } | 1066 } |
| 1059 } | 1067 } |
| 1060 | 1068 |
| 1061 void test_set_tooBig() { | 1069 void test_set_tooBig() { |
| 1062 AstNode node = AstFactory.booleanLiteral(true); | 1070 AstNode node = AstFactory.booleanLiteral(true); |
| 1063 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); | 1071 NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([])); |
| 1064 try { | 1072 try { |
| 1065 javaListSet(list, 1, node); | 1073 javaListSet(list, 1, node); |
| 1066 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1074 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 1067 } on RangeError catch (exception) { | 1075 } on RangeError catch (exception) { |
| 1076 // Expected |
| 1068 } | 1077 } |
| 1069 } | 1078 } |
| 1070 | 1079 |
| 1071 static dartSuite() { | 1080 static dartSuite() { |
| 1072 _ut.group('NodeListTest', () { | 1081 _ut.group('NodeListTest', () { |
| 1073 _ut.test('test_add', () { | 1082 _ut.test('test_add', () { |
| 1074 final __test = new NodeListTest(); | 1083 final __test = new NodeListTest(); |
| 1075 runJUnitTest(__test, __test.test_add); | 1084 runJUnitTest(__test, __test.test_add); |
| 1076 }); | 1085 }); |
| 1077 _ut.test('test_addAll', () { | 1086 _ut.test('test_addAll', () { |
| (...skipping 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4042 ToSourceVisitorTest.dartSuite(); | 4051 ToSourceVisitorTest.dartSuite(); |
| 4043 BreadthFirstVisitorTest.dartSuite(); | 4052 BreadthFirstVisitorTest.dartSuite(); |
| 4044 ClassDeclarationTest.dartSuite(); | 4053 ClassDeclarationTest.dartSuite(); |
| 4045 ClassTypeAliasTest.dartSuite(); | 4054 ClassTypeAliasTest.dartSuite(); |
| 4046 IndexExpressionTest.dartSuite(); | 4055 IndexExpressionTest.dartSuite(); |
| 4047 NodeListTest.dartSuite(); | 4056 NodeListTest.dartSuite(); |
| 4048 SimpleIdentifierTest.dartSuite(); | 4057 SimpleIdentifierTest.dartSuite(); |
| 4049 SimpleStringLiteralTest.dartSuite(); | 4058 SimpleStringLiteralTest.dartSuite(); |
| 4050 VariableDeclarationTest.dartSuite(); | 4059 VariableDeclarationTest.dartSuite(); |
| 4051 } | 4060 } |
| OLD | NEW |