Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 681003002: Replace ${name} with $name where possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up also implementation Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.parser_test; 8 library engine.parser_test;
9 9
10 import 'package:analyzer/src/generated/java_core.dart'; 10 import 'package:analyzer/src/generated/java_core.dart';
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 int nodeStart = node.offset; 89 int nodeStart = node.offset;
90 int nodeLength = node.length; 90 int nodeLength = node.length;
91 if (nodeStart < 0 || nodeLength < 0) { 91 if (nodeStart < 0 || nodeLength < 0) {
92 _errors.add("No source info for ${node.runtimeType}"); 92 _errors.add("No source info for ${node.runtimeType}");
93 } 93 }
94 if (parent != null) { 94 if (parent != null) {
95 int nodeEnd = nodeStart + nodeLength; 95 int nodeEnd = nodeStart + nodeLength;
96 int parentStart = parent.offset; 96 int parentStart = parent.offset;
97 int parentEnd = parentStart + parent.length; 97 int parentEnd = parentStart + parent.length;
98 if (nodeStart < parentStart) { 98 if (nodeStart < parentStart) {
99 _errors.add("Invalid source start (${nodeStart}) for ${node.runtimeType} inside ${parent.runtimeType} (${parentStart})"); 99 _errors.add("Invalid source start ($nodeStart) for ${node.runtimeType} i nside ${parent.runtimeType} ($parentStart)");
100 } 100 }
101 if (nodeEnd > parentEnd) { 101 if (nodeEnd > parentEnd) {
102 _errors.add("Invalid source end (${nodeEnd}) for ${node.runtimeType} ins ide ${parent.runtimeType} (${parentStart})"); 102 _errors.add("Invalid source end ($nodeEnd) for ${node.runtimeType} insid e ${parent.runtimeType} ($parentStart)");
103 } 103 }
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 /** 108 /**
109 * The class `ComplexParserTest` defines parser tests that test the parsing of m ore complex 109 * The class `ComplexParserTest` defines parser tests that test the parsing of m ore complex
110 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure 110 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure
111 * that the precedence of operations is being handled correctly should be define d in this class. 111 * that the precedence of operations is being handled correctly should be define d in this class.
112 * 112 *
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 * 1775 *
1776 * @param prefix the unchanged text before the edit region 1776 * @param prefix the unchanged text before the edit region
1777 * @param removed the text that was removed from the original contents 1777 * @param removed the text that was removed from the original contents
1778 * @param added the text that was added to the modified contents 1778 * @param added the text that was added to the modified contents
1779 * @param suffix the unchanged text after the edit region 1779 * @param suffix the unchanged text after the edit region
1780 */ 1780 */
1781 void _assertParse(String prefix, String removed, String added, String suffix) { 1781 void _assertParse(String prefix, String removed, String added, String suffix) {
1782 // 1782 //
1783 // Compute the information needed to perform the test. 1783 // Compute the information needed to perform the test.
1784 // 1784 //
1785 String originalContents = "${prefix}${removed}${suffix}"; 1785 String originalContents = "$prefix$removed$suffix";
1786 String modifiedContents = "${prefix}${added}${suffix}"; 1786 String modifiedContents = "$prefix$added$suffix";
1787 int replaceStart = prefix.length; 1787 int replaceStart = prefix.length;
1788 Source source = new TestSource(); 1788 Source source = new TestSource();
1789 // 1789 //
1790 // Parse the original contents. 1790 // Parse the original contents.
1791 // 1791 //
1792 GatheringErrorListener originalListener = new GatheringErrorListener(); 1792 GatheringErrorListener originalListener = new GatheringErrorListener();
1793 Scanner originalScanner = new Scanner(source, new CharSequenceReader(origina lContents), originalListener); 1793 Scanner originalScanner = new Scanner(source, new CharSequenceReader(origina lContents), originalListener);
1794 Token originalTokens = originalScanner.tokenize(); 1794 Token originalTokens = originalScanner.tokenize();
1795 JUnitTestCase.assertNotNull(originalTokens); 1795 JUnitTestCase.assertNotNull(originalTokens);
1796 Parser originalParser = new Parser(source, originalListener); 1796 Parser originalParser = new Parser(source, originalListener);
(...skipping 5293 matching lines...) Expand 10 before | Expand all | Expand 10 after
7090 } 7090 }
7091 7091
7092 void test_parsePrimaryExpression_function_noArguments() { 7092 void test_parsePrimaryExpression_function_noArguments() {
7093 FunctionExpression expression = ParserTestCase.parse4("parsePrimaryExpressio n", "() => 42", []); 7093 FunctionExpression expression = ParserTestCase.parse4("parsePrimaryExpressio n", "() => 42", []);
7094 JUnitTestCase.assertNotNull(expression.parameters); 7094 JUnitTestCase.assertNotNull(expression.parameters);
7095 JUnitTestCase.assertNotNull(expression.body); 7095 JUnitTestCase.assertNotNull(expression.body);
7096 } 7096 }
7097 7097
7098 void test_parsePrimaryExpression_hex() { 7098 void test_parsePrimaryExpression_hex() {
7099 String hexLiteral = "3F"; 7099 String hexLiteral = "3F";
7100 IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "0x ${hexLiteral}", []); 7100 IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "0x $hexLiteral", []);
7101 JUnitTestCase.assertNotNull(literal.literal); 7101 JUnitTestCase.assertNotNull(literal.literal);
7102 JUnitTestCase.assertEquals(int.parse(hexLiteral, radix: 16), literal.value); 7102 JUnitTestCase.assertEquals(int.parse(hexLiteral, radix: 16), literal.value);
7103 } 7103 }
7104 7104
7105 void test_parsePrimaryExpression_identifier() { 7105 void test_parsePrimaryExpression_identifier() {
7106 SimpleIdentifier identifier = ParserTestCase.parse4("parsePrimaryExpression" , "a", []); 7106 SimpleIdentifier identifier = ParserTestCase.parse4("parsePrimaryExpression" , "a", []);
7107 JUnitTestCase.assertNotNull(identifier); 7107 JUnitTestCase.assertNotNull(identifier);
7108 } 7108 }
7109 7109
7110 void test_parsePrimaryExpression_int() { 7110 void test_parsePrimaryExpression_int() {
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
8278 main() { 8278 main() {
8279 _ut.groupSep = ' | '; 8279 _ut.groupSep = ' | ';
8280 runReflectiveTests(ComplexParserTest); 8280 runReflectiveTests(ComplexParserTest);
8281 runReflectiveTests(ErrorParserTest); 8281 runReflectiveTests(ErrorParserTest);
8282 runReflectiveTests(IncrementalParserTest); 8282 runReflectiveTests(IncrementalParserTest);
8283 runReflectiveTests(NonErrorParserTest); 8283 runReflectiveTests(NonErrorParserTest);
8284 runReflectiveTests(RecoveryParserTest); 8284 runReflectiveTests(RecoveryParserTest);
8285 runReflectiveTests(ResolutionCopierTest); 8285 runReflectiveTests(ResolutionCopierTest);
8286 runReflectiveTests(SimpleParserTest); 8286 runReflectiveTests(SimpleParserTest);
8287 } 8287 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/engine_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698