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.src.dart.ast.utilities_test; | 5 library analyzer.test.src.dart.ast.utilities_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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 import '../../../generated/parser_test.dart' show ParserTestCase; | 22 import '../../../generated/parser_test.dart' show ParserTestCase; |
23 import '../../../generated/test_support.dart'; | 23 import '../../../generated/test_support.dart'; |
24 | 24 |
25 main() { | 25 main() { |
26 defineReflectiveSuite(() { | 26 defineReflectiveSuite(() { |
27 defineReflectiveTests(ConstantEvaluatorTest); | 27 defineReflectiveTests(ConstantEvaluatorTest); |
28 defineReflectiveTests(NodeLocatorTest); | 28 defineReflectiveTests(NodeLocatorTest); |
29 defineReflectiveTests(NodeLocator2Test); | 29 defineReflectiveTests(NodeLocator2Test); |
30 defineReflectiveTests(ResolutionCopierTest); | 30 defineReflectiveTests(ResolutionCopierTest); |
| 31 // ignore: deprecated_member_use |
31 defineReflectiveTests(ToSourceVisitorTest); | 32 defineReflectiveTests(ToSourceVisitorTest); |
32 defineReflectiveTests(ToSourceVisitor2Test); | 33 defineReflectiveTests(ToSourceVisitor2Test); |
33 }); | 34 }); |
34 } | 35 } |
35 | 36 |
36 @reflectiveTest | 37 @reflectiveTest |
37 class ConstantEvaluatorTest extends ParserTestCase { | 38 class ConstantEvaluatorTest extends ParserTestCase { |
38 void fail_constructor() { | 39 void fail_constructor() { |
39 Object value = _getConstantValue("?"); | 40 Object value = _getConstantValue("?"); |
40 expect(value, null); | 41 expect(value, null); |
(...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 * Assert that a `ToSourceVisitor2` will produce the [expectedSource] when | 3338 * Assert that a `ToSourceVisitor2` will produce the [expectedSource] when |
3338 * visiting the given [node]. | 3339 * visiting the given [node]. |
3339 */ | 3340 */ |
3340 void _assertSource(String expectedSource, AstNode node) { | 3341 void _assertSource(String expectedSource, AstNode node) { |
3341 StringBuffer buffer = new StringBuffer(); | 3342 StringBuffer buffer = new StringBuffer(); |
3342 node.accept(new ToSourceVisitor2(buffer)); | 3343 node.accept(new ToSourceVisitor2(buffer)); |
3343 expect(buffer.toString(), expectedSource); | 3344 expect(buffer.toString(), expectedSource); |
3344 } | 3345 } |
3345 } | 3346 } |
3346 | 3347 |
| 3348 @deprecated |
3347 @reflectiveTest | 3349 @reflectiveTest |
3348 class ToSourceVisitorTest extends EngineTestCase { | 3350 class ToSourceVisitorTest extends EngineTestCase { |
3349 void test_visitAdjacentStrings() { | 3351 void test_visitAdjacentStrings() { |
3350 _assertSource( | 3352 _assertSource( |
3351 "'a' 'b'", | 3353 "'a' 'b'", |
3352 AstFactory.adjacentStrings( | 3354 AstFactory.adjacentStrings( |
3353 [AstFactory.string2("a"), AstFactory.string2("b")])); | 3355 [AstFactory.string2("a"), AstFactory.string2("b")])); |
3354 } | 3356 } |
3355 | 3357 |
3356 void test_visitAnnotation_constant() { | 3358 void test_visitAnnotation_constant() { |
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5571 /** | 5573 /** |
5572 * Assert that a `ToSourceVisitor` will produce the [expectedSource] when | 5574 * Assert that a `ToSourceVisitor` will produce the [expectedSource] when |
5573 * visiting the given [node]. | 5575 * visiting the given [node]. |
5574 */ | 5576 */ |
5575 void _assertSource(String expectedSource, AstNode node) { | 5577 void _assertSource(String expectedSource, AstNode node) { |
5576 PrintStringWriter writer = new PrintStringWriter(); | 5578 PrintStringWriter writer = new PrintStringWriter(); |
5577 node.accept(new ToSourceVisitor(writer)); | 5579 node.accept(new ToSourceVisitor(writer)); |
5578 expect(writer.toString(), expectedSource); | 5580 expect(writer.toString(), expectedSource); |
5579 } | 5581 } |
5580 } | 5582 } |
OLD | NEW |