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

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

Issue 1034953002: Fix value computation for multi-line strings (issue 22993) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months 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 library engine.parser_test; 5 library engine.parser_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/error.dart'; 9 import 'package:analyzer/src/generated/error.dart';
10 import 'package:analyzer/src/generated/incremental_scanner.dart'; 10 import 'package:analyzer/src/generated/incremental_scanner.dart';
(...skipping 8816 matching lines...) Expand 10 before | Expand all | Expand 10 after
8827 parse4("parseStringLiteral", "'a \${b} c \$this d'"); 8827 parse4("parseStringLiteral", "'a \${b} c \$this d'");
8828 NodeList<InterpolationElement> elements = literal.elements; 8828 NodeList<InterpolationElement> elements = literal.elements;
8829 expect(elements, hasLength(5)); 8829 expect(elements, hasLength(5));
8830 expect(elements[0] is InterpolationString, isTrue); 8830 expect(elements[0] is InterpolationString, isTrue);
8831 expect(elements[1] is InterpolationExpression, isTrue); 8831 expect(elements[1] is InterpolationExpression, isTrue);
8832 expect(elements[2] is InterpolationString, isTrue); 8832 expect(elements[2] is InterpolationString, isTrue);
8833 expect(elements[3] is InterpolationExpression, isTrue); 8833 expect(elements[3] is InterpolationExpression, isTrue);
8834 expect(elements[4] is InterpolationString, isTrue); 8834 expect(elements[4] is InterpolationString, isTrue);
8835 } 8835 }
8836 8836
8837 void test_parseStringLiteral_multiline_trimmed() {
8838 SimpleStringLiteral literal = parse4("parseStringLiteral", "''' \\\na'''");
8839 expect(literal.literal, isNotNull);
8840 expect(literal.value, "a");
8841 }
8842
8843 void test_parseStringLiteral_multiline_untrimmed() {
8844 SimpleStringLiteral literal = parse4("parseStringLiteral", "''' a\nb'''");
8845 expect(literal.literal, isNotNull);
8846 expect(literal.value, " a\nb");
8847 }
8848
8837 void test_parseStringLiteral_single() { 8849 void test_parseStringLiteral_single() {
8838 SimpleStringLiteral literal = parse4("parseStringLiteral", "'a'"); 8850 SimpleStringLiteral literal = parse4("parseStringLiteral", "'a'");
8839 expect(literal.literal, isNotNull); 8851 expect(literal.literal, isNotNull);
8840 expect(literal.value, "a"); 8852 expect(literal.value, "a");
8841 } 8853 }
8842 8854
8843 void test_parseSuperConstructorInvocation_named() { 8855 void test_parseSuperConstructorInvocation_named() {
8844 SuperConstructorInvocation invocation = 8856 SuperConstructorInvocation invocation =
8845 parse4("parseSuperConstructorInvocation", "super.a()"); 8857 parse4("parseSuperConstructorInvocation", "super.a()");
8846 expect(invocation.argumentList, isNotNull); 8858 expect(invocation.argumentList, isNotNull);
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
9825 new Scanner(null, new CharSequenceReader(source), listener); 9837 new Scanner(null, new CharSequenceReader(source), listener);
9826 Token tokenStream = scanner.tokenize(); 9838 Token tokenStream = scanner.tokenize();
9827 // 9839 //
9828 // Parse the source. 9840 // Parse the source.
9829 // 9841 //
9830 Parser parser = new Parser(null, listener); 9842 Parser parser = new Parser(null, listener);
9831 return invokeParserMethodImpl( 9843 return invokeParserMethodImpl(
9832 parser, methodName, <Object>[tokenStream], tokenStream) as Token; 9844 parser, methodName, <Object>[tokenStream], tokenStream) as Token;
9833 } 9845 }
9834 } 9846 }
OLDNEW
« pkg/analyzer/lib/src/generated/parser.dart ('K') | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698