| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 final __test = new NodeLocatorTest(); | 84 final __test = new NodeLocatorTest(); |
| 85 runJUnitTest(__test, __test.test_searchWithin_offsetBeforeNode); | 85 runJUnitTest(__test, __test.test_searchWithin_offsetBeforeNode); |
| 86 }); | 86 }); |
| 87 }); | 87 }); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 class IndexExpressionTest extends EngineTestCase { | 91 class IndexExpressionTest extends EngineTestCase { |
| 92 void test_inGetterContext_assignment_compound_left() { | 92 void test_inGetterContext_assignment_compound_left() { |
| 93 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 93 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 94 // a[i] += ? |
| 94 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | 95 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); |
| 95 JUnitTestCase.assertTrue(expression.inGetterContext()); | 96 JUnitTestCase.assertTrue(expression.inGetterContext()); |
| 96 } | 97 } |
| 97 | 98 |
| 98 void test_inGetterContext_assignment_simple_left() { | 99 void test_inGetterContext_assignment_simple_left() { |
| 99 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 100 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 101 // a[i] = ? |
| 100 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); | 102 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); |
| 101 JUnitTestCase.assertFalse(expression.inGetterContext()); | 103 JUnitTestCase.assertFalse(expression.inGetterContext()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void test_inGetterContext_nonAssignment() { | 106 void test_inGetterContext_nonAssignment() { |
| 105 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 107 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 108 // a[i] + ? |
| 106 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); | 109 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); |
| 107 JUnitTestCase.assertTrue(expression.inGetterContext()); | 110 JUnitTestCase.assertTrue(expression.inGetterContext()); |
| 108 } | 111 } |
| 109 | 112 |
| 110 void test_inSetterContext_assignment_compound_left() { | 113 void test_inSetterContext_assignment_compound_left() { |
| 111 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 114 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 115 // a[i] += ? |
| 112 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | 116 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); |
| 113 JUnitTestCase.assertTrue(expression.inSetterContext()); | 117 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 114 } | 118 } |
| 115 | 119 |
| 116 void test_inSetterContext_assignment_compound_right() { | 120 void test_inSetterContext_assignment_compound_right() { |
| 117 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 121 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 122 // ? += a[i] |
| 118 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); | 123 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); |
| 119 JUnitTestCase.assertFalse(expression.inSetterContext()); | 124 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 120 } | 125 } |
| 121 | 126 |
| 122 void test_inSetterContext_assignment_simple_left() { | 127 void test_inSetterContext_assignment_simple_left() { |
| 123 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 128 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 129 // a[i] = ? |
| 124 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); | 130 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); |
| 125 JUnitTestCase.assertTrue(expression.inSetterContext()); | 131 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 126 } | 132 } |
| 127 | 133 |
| 128 void test_inSetterContext_assignment_simple_right() { | 134 void test_inSetterContext_assignment_simple_right() { |
| 129 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 135 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 136 // ? = a[i] |
| 130 ASTFactory.assignmentExpression(null, TokenType.EQ, expression); | 137 ASTFactory.assignmentExpression(null, TokenType.EQ, expression); |
| 131 JUnitTestCase.assertFalse(expression.inSetterContext()); | 138 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 132 } | 139 } |
| 133 | 140 |
| 134 void test_inSetterContext_nonAssignment() { | 141 void test_inSetterContext_nonAssignment() { |
| 135 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 142 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 136 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); | 143 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); |
| 144 // a[i] + ? |
| 137 JUnitTestCase.assertFalse(expression.inSetterContext()); | 145 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 138 } | 146 } |
| 139 | 147 |
| 140 void test_inSetterContext_postfix() { | 148 void test_inSetterContext_postfix() { |
| 141 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 149 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 142 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); | 150 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); |
| 151 // a[i]++ |
| 143 JUnitTestCase.assertTrue(expression.inSetterContext()); | 152 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 144 } | 153 } |
| 145 | 154 |
| 146 void test_inSetterContext_prefix_bang() { | 155 void test_inSetterContext_prefix_bang() { |
| 147 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 156 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 157 // !a[i] |
| 148 ASTFactory.prefixExpression(TokenType.BANG, expression); | 158 ASTFactory.prefixExpression(TokenType.BANG, expression); |
| 149 JUnitTestCase.assertFalse(expression.inSetterContext()); | 159 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 150 } | 160 } |
| 151 | 161 |
| 152 void test_inSetterContext_prefix_minusMinus() { | 162 void test_inSetterContext_prefix_minusMinus() { |
| 153 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 163 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 164 // --a[i] |
| 154 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); | 165 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); |
| 155 JUnitTestCase.assertTrue(expression.inSetterContext()); | 166 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 156 } | 167 } |
| 157 | 168 |
| 158 void test_inSetterContext_prefix_plusPlus() { | 169 void test_inSetterContext_prefix_plusPlus() { |
| 159 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 170 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 171 // ++a[i] |
| 160 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); | 172 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); |
| 161 JUnitTestCase.assertTrue(expression.inSetterContext()); | 173 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 162 } | 174 } |
| 163 | 175 |
| 164 static dartSuite() { | 176 static dartSuite() { |
| 165 _ut.group('IndexExpressionTest', () { | 177 _ut.group('IndexExpressionTest', () { |
| 166 _ut.test('test_inGetterContext_assignment_compound_left', () { | 178 _ut.test('test_inGetterContext_assignment_compound_left', () { |
| 167 final __test = new IndexExpressionTest(); | 179 final __test = new IndexExpressionTest(); |
| 168 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); | 180 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); |
| 169 }); | 181 }); |
| (...skipping 3905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4075 NodeLocatorTest.dartSuite(); | 4087 NodeLocatorTest.dartSuite(); |
| 4076 ToSourceVisitorTest.dartSuite(); | 4088 ToSourceVisitorTest.dartSuite(); |
| 4077 BreadthFirstVisitorTest.dartSuite(); | 4089 BreadthFirstVisitorTest.dartSuite(); |
| 4078 ClassDeclarationTest.dartSuite(); | 4090 ClassDeclarationTest.dartSuite(); |
| 4079 IndexExpressionTest.dartSuite(); | 4091 IndexExpressionTest.dartSuite(); |
| 4080 NodeListTest.dartSuite(); | 4092 NodeListTest.dartSuite(); |
| 4081 SimpleIdentifierTest.dartSuite(); | 4093 SimpleIdentifierTest.dartSuite(); |
| 4082 SimpleStringLiteralTest.dartSuite(); | 4094 SimpleStringLiteralTest.dartSuite(); |
| 4083 VariableDeclarationTest.dartSuite(); | 4095 VariableDeclarationTest.dartSuite(); |
| 4084 } | 4096 } |
| OLD | NEW |