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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 final __test = new ConstantEvaluatorTest(); | 1114 final __test = new ConstantEvaluatorTest(); |
1115 runJUnitTest(__test, __test.test_unary_negated_integer); | 1115 runJUnitTest(__test, __test.test_unary_negated_integer); |
1116 }); | 1116 }); |
1117 }); | 1117 }); |
1118 } | 1118 } |
1119 } | 1119 } |
1120 | 1120 |
1121 class IndexExpressionTest extends EngineTestCase { | 1121 class IndexExpressionTest extends EngineTestCase { |
1122 void test_inGetterContext_assignment_compound_left() { | 1122 void test_inGetterContext_assignment_compound_left() { |
1123 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1123 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1124 // a[i] += ? | 1124 // a[b] += c |
1125 AstFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | 1125 AstFactory.assignmentExpression(expression, TokenType.PLUS_EQ, AstFactory.id
entifier3("c")); |
1126 JUnitTestCase.assertTrue(expression.inGetterContext()); | 1126 JUnitTestCase.assertTrue(expression.inGetterContext()); |
1127 } | 1127 } |
1128 | 1128 |
1129 void test_inGetterContext_assignment_simple_left() { | 1129 void test_inGetterContext_assignment_simple_left() { |
1130 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1130 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1131 // a[i] = ? | 1131 // a[b] = c |
1132 AstFactory.assignmentExpression(expression, TokenType.EQ, null); | 1132 AstFactory.assignmentExpression(expression, TokenType.EQ, AstFactory.identif
ier3("c")); |
1133 JUnitTestCase.assertFalse(expression.inGetterContext()); | 1133 JUnitTestCase.assertFalse(expression.inGetterContext()); |
1134 } | 1134 } |
1135 | 1135 |
1136 void test_inGetterContext_nonAssignment() { | 1136 void test_inGetterContext_nonAssignment() { |
1137 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1137 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1138 // a[i] + ? | 1138 // a[b] + c |
1139 AstFactory.binaryExpression(expression, TokenType.PLUS, null); | 1139 AstFactory.binaryExpression(expression, TokenType.PLUS, AstFactory.identifie
r3("c")); |
1140 JUnitTestCase.assertTrue(expression.inGetterContext()); | 1140 JUnitTestCase.assertTrue(expression.inGetterContext()); |
1141 } | 1141 } |
1142 | 1142 |
1143 void test_inSetterContext_assignment_compound_left() { | 1143 void test_inSetterContext_assignment_compound_left() { |
1144 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1144 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1145 // a[i] += ? | 1145 // a[b] += c |
1146 AstFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | 1146 AstFactory.assignmentExpression(expression, TokenType.PLUS_EQ, AstFactory.id
entifier3("c")); |
1147 JUnitTestCase.assertTrue(expression.inSetterContext()); | 1147 JUnitTestCase.assertTrue(expression.inSetterContext()); |
1148 } | 1148 } |
1149 | 1149 |
1150 void test_inSetterContext_assignment_compound_right() { | 1150 void test_inSetterContext_assignment_compound_right() { |
1151 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1151 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1152 // ? += a[i] | 1152 // c += a[b] |
1153 AstFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); | 1153 AstFactory.assignmentExpression(AstFactory.identifier3("c"), TokenType.PLUS_
EQ, expression); |
1154 JUnitTestCase.assertFalse(expression.inSetterContext()); | 1154 JUnitTestCase.assertFalse(expression.inSetterContext()); |
1155 } | 1155 } |
1156 | 1156 |
1157 void test_inSetterContext_assignment_simple_left() { | 1157 void test_inSetterContext_assignment_simple_left() { |
1158 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1158 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1159 // a[i] = ? | 1159 // a[b] = c |
1160 AstFactory.assignmentExpression(expression, TokenType.EQ, null); | 1160 AstFactory.assignmentExpression(expression, TokenType.EQ, AstFactory.identif
ier3("c")); |
1161 JUnitTestCase.assertTrue(expression.inSetterContext()); | 1161 JUnitTestCase.assertTrue(expression.inSetterContext()); |
1162 } | 1162 } |
1163 | 1163 |
1164 void test_inSetterContext_assignment_simple_right() { | 1164 void test_inSetterContext_assignment_simple_right() { |
1165 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1165 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1166 // ? = a[i] | 1166 // c = a[b] |
1167 AstFactory.assignmentExpression(null, TokenType.EQ, expression); | 1167 AstFactory.assignmentExpression(AstFactory.identifier3("c"), TokenType.EQ, e
xpression); |
1168 JUnitTestCase.assertFalse(expression.inSetterContext()); | 1168 JUnitTestCase.assertFalse(expression.inSetterContext()); |
1169 } | 1169 } |
1170 | 1170 |
1171 void test_inSetterContext_nonAssignment() { | 1171 void test_inSetterContext_nonAssignment() { |
1172 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1172 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1173 AstFactory.binaryExpression(expression, TokenType.PLUS, null); | 1173 AstFactory.binaryExpression(expression, TokenType.PLUS, AstFactory.identifie
r3("c")); |
1174 // a[i] + ? | 1174 // a[b] + cc |
1175 JUnitTestCase.assertFalse(expression.inSetterContext()); | 1175 JUnitTestCase.assertFalse(expression.inSetterContext()); |
1176 } | 1176 } |
1177 | 1177 |
1178 void test_inSetterContext_postfix() { | 1178 void test_inSetterContext_postfix() { |
1179 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1179 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1180 AstFactory.postfixExpression(expression, TokenType.PLUS_PLUS); | 1180 AstFactory.postfixExpression(expression, TokenType.PLUS_PLUS); |
1181 // a[i]++ | 1181 // a[b]++ |
1182 JUnitTestCase.assertTrue(expression.inSetterContext()); | 1182 JUnitTestCase.assertTrue(expression.inSetterContext()); |
1183 } | 1183 } |
1184 | 1184 |
1185 void test_inSetterContext_prefix_bang() { | 1185 void test_inSetterContext_prefix_bang() { |
1186 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1186 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1187 // !a[i] | 1187 // !a[b] |
1188 AstFactory.prefixExpression(TokenType.BANG, expression); | 1188 AstFactory.prefixExpression(TokenType.BANG, expression); |
1189 JUnitTestCase.assertFalse(expression.inSetterContext()); | 1189 JUnitTestCase.assertFalse(expression.inSetterContext()); |
1190 } | 1190 } |
1191 | 1191 |
1192 void test_inSetterContext_prefix_minusMinus() { | 1192 void test_inSetterContext_prefix_minusMinus() { |
1193 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1193 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1194 // --a[i] | 1194 // --a[b] |
1195 AstFactory.prefixExpression(TokenType.MINUS_MINUS, expression); | 1195 AstFactory.prefixExpression(TokenType.MINUS_MINUS, expression); |
1196 JUnitTestCase.assertTrue(expression.inSetterContext()); | 1196 JUnitTestCase.assertTrue(expression.inSetterContext()); |
1197 } | 1197 } |
1198 | 1198 |
1199 void test_inSetterContext_prefix_plusPlus() { | 1199 void test_inSetterContext_prefix_plusPlus() { |
1200 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); | 1200 IndexExpression expression = AstFactory.indexExpression(AstFactory.identifie
r3("a"), AstFactory.identifier3("b")); |
1201 // ++a[i] | 1201 // ++a[b] |
1202 AstFactory.prefixExpression(TokenType.PLUS_PLUS, expression); | 1202 AstFactory.prefixExpression(TokenType.PLUS_PLUS, expression); |
1203 JUnitTestCase.assertTrue(expression.inSetterContext()); | 1203 JUnitTestCase.assertTrue(expression.inSetterContext()); |
1204 } | 1204 } |
1205 | 1205 |
1206 static dartSuite() { | 1206 static dartSuite() { |
1207 _ut.group('IndexExpressionTest', () { | 1207 _ut.group('IndexExpressionTest', () { |
1208 _ut.test('test_inGetterContext_assignment_compound_left', () { | 1208 _ut.test('test_inGetterContext_assignment_compound_left', () { |
1209 final __test = new IndexExpressionTest(); | 1209 final __test = new IndexExpressionTest(); |
1210 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); | 1210 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); |
1211 }); | 1211 }); |
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4264 ToSourceVisitorTest.dartSuite(); | 4264 ToSourceVisitorTest.dartSuite(); |
4265 BreadthFirstVisitorTest.dartSuite(); | 4265 BreadthFirstVisitorTest.dartSuite(); |
4266 ClassDeclarationTest.dartSuite(); | 4266 ClassDeclarationTest.dartSuite(); |
4267 ClassTypeAliasTest.dartSuite(); | 4267 ClassTypeAliasTest.dartSuite(); |
4268 IndexExpressionTest.dartSuite(); | 4268 IndexExpressionTest.dartSuite(); |
4269 NodeListTest.dartSuite(); | 4269 NodeListTest.dartSuite(); |
4270 SimpleIdentifierTest.dartSuite(); | 4270 SimpleIdentifierTest.dartSuite(); |
4271 SimpleStringLiteralTest.dartSuite(); | 4271 SimpleStringLiteralTest.dartSuite(); |
4272 VariableDeclarationTest.dartSuite(); | 4272 VariableDeclarationTest.dartSuite(); |
4273 } | 4273 } |
OLD | NEW |