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

Side by Side Diff: runtime/vm/scanner_test.cc

Issue 9240014: Set breakpoint at url, line number (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « runtime/vm/scanner.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/os.h" 6 #include "vm/os.h"
7 #include "vm/scanner.h" 7 #include "vm/scanner.h"
8 #include "vm/token.h" 8 #include "vm/token.h"
9 #include "vm/unit_test.h" 9 #include "vm/unit_test.h"
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void InvalidText() { 324 void InvalidText() {
325 const Scanner::GrowableTokenStream& tokens = 325 const Scanner::GrowableTokenStream& tokens =
326 Scan("\\"); 326 Scan("\\");
327 327
328 EXPECT_EQ(2, tokens.length()); 328 EXPECT_EQ(2, tokens.length());
329 CheckKind(tokens, 0, Token::kERROR); 329 CheckKind(tokens, 0, Token::kERROR);
330 CheckKind(tokens, 1, Token::kEOS); 330 CheckKind(tokens, 1, Token::kEOS);
331 } 331 }
332 332
333 333
334 void FindLineTest() {
335 const char* source =
336 "/*1*/ \n"
337 "/*2*/ class A {\n"
338 "/*3*/ void foo() { }\n"
339 "/*4*/ }\n";
340
341 Scanner scanner(String::Handle(String::New(source)),
342 String::Handle(String::New("")));
343
344 intptr_t token_index = scanner.TokenIndexAtLine(3);
345 EXPECT_EQ(3, token_index);
346 token_index = scanner.TokenIndexAtLine(100);
347 EXPECT(token_index < 0);
348 }
349
350
334 TEST_CASE(Scanner_Test) { 351 TEST_CASE(Scanner_Test) {
335 ScanLargeText(); 352 ScanLargeText();
336 353
337 BoringTest(); 354 BoringTest();
338 CommentTest(); 355 CommentTest();
339 GreedIsGood(); 356 GreedIsGood();
340 StringEscapes(); 357 StringEscapes();
341 RawString(); 358 RawString();
342 MultilineString(); 359 MultilineString();
343 EmptyString(); 360 EmptyString();
344 EmptyMultilineString(); 361 EmptyMultilineString();
345 NumberLiteral(); 362 NumberLiteral();
346 InvalidText(); 363 InvalidText();
364 FindLineTest();
347 } 365 }
348 366
349 } // namespace dart 367 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scanner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698