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

Side by Side Diff: tests/compiler/dart2js/scanner_test.dart

Issue 1313073007: Move parser and token related libraries into their own subfolder. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix unittests and try Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'package:compiler/src/scanner/utf8_bytes_scanner.dart'; 6 import 'package:compiler/src/scanner/utf8_bytes_scanner.dart';
7 import 'package:compiler/src/scanner/token.dart'; 7 import 'package:compiler/src/tokens/token.dart';
8 import 'package:compiler/src/util/characters.dart'; 8 import 'package:compiler/src/util/characters.dart';
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 10
11 Token scan(List<int> bytes) { 11 Token scan(List<int> bytes) {
12 List<int> zeroTerminated = new Uint8List(bytes.length + 1); 12 List<int> zeroTerminated = new Uint8List(bytes.length + 1);
13 zeroTerminated.setRange(0, bytes.length, bytes); 13 zeroTerminated.setRange(0, bytes.length, bytes);
14 zeroTerminated[bytes.length] = 0; 14 zeroTerminated[bytes.length] = 0;
15 return new Utf8BytesScanner.fromBytes(zeroTerminated).tokenize(); 15 return new Utf8BytesScanner.fromBytes(zeroTerminated).tokenize();
16 } 16 }
17 17
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // "#!" 71 // "#!"
72 token = scan([0x23, 0x21]); 72 token = scan([0x23, 0x21]);
73 Expect.equals(token.info, EOF_INFO); // Treated as a comment. 73 Expect.equals(token.info, EOF_INFO); // Treated as a comment.
74 74
75 // Regression test for issue 1761. 75 // Regression test for issue 1761.
76 // "#! Hello, World!" 76 // "#! Hello, World!"
77 token = scan([0x23, 0x21, 0x20, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 77 token = scan([0x23, 0x21, 0x20, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20,
78 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21]); 78 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21]);
79 Expect.equals(token.info, EOF_INFO); // Treated as a comment. 79 Expect.equals(token.info, EOF_INFO); // Treated as a comment.
80 } 80 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/scanner_offset_length_test.dart ('k') | tests/compiler/dart2js/unparser2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698