OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
9 import 'package:test/src/util/string_literal_iterator.dart'; | 9 import 'package:test/src/util/string_literal_iterator.dart'; |
10 | 10 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 /// Returns a matcher that asserts that the given rune is the rune for [char]. | 232 /// Returns a matcher that asserts that the given rune is the rune for [char]. |
233 Matcher _isRune(String char) { | 233 Matcher _isRune(String char) { |
234 return predicate((rune) { | 234 return predicate((rune) { |
235 return rune is int && new String.fromCharCode(rune) == char; | 235 return rune is int && new String.fromCharCode(rune) == char; |
236 }, 'is the rune "$char"'); | 236 }, 'is the rune "$char"'); |
237 } | 237 } |
238 | 238 |
239 /// Parses [dart], which should be a string literal, into a | 239 /// Parses [dart], which should be a string literal, into a |
240 /// [StringLiteralIterator]. | 240 /// [StringLiteralIterator]. |
241 StringLiteralIterator _parse(String dart) { | 241 StringLiteralIterator _parse(String dart) { |
242 var literal = parseCompilationUnit("final str = $dart;") | 242 var declaration = |
243 .declarations.single.variables.variables.single.initializer; | 243 parseCompilationUnit("final str = $dart;").declarations.single; |
| 244 var literal = declaration.variables.variables.single.initializer; |
244 return new StringLiteralIterator(literal); | 245 return new StringLiteralIterator(literal); |
245 } | 246 } |
OLD | NEW |