Chromium Code Reviews| Index: runtime/vm/object_test.cc |
| diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc |
| index dcb3bbe5fdefe14c46218140ec75143f9cc48cc5..db710a7034e274b364d853cd704e8285cb552e48 100644 |
| --- a/runtime/vm/object_test.cc |
| +++ b/runtime/vm/object_test.cc |
| @@ -2064,21 +2064,32 @@ TEST_CASE(EmbeddedScript) { |
| str = script.GetLine(last_dart_line); |
| EXPECT_STREQ(" }", str.ToCString()); |
| - |
| script.Tokenize(String::Handle(String::New("ABC"))); |
| + // Tokens: 0: kIDENT, 1: kLPAREN, 2: kRPAREN, 3: kLBRACE, 4: kNEWLINE, |
| + // 5: kRETURN, 6: kSTRING, 7: kSEMICOLON, 8: kNEWLINE, |
| + // 9: kRBRACE, 10: kNEWLINE |
| + |
| intptr_t line, col; |
| + intptr_t fast_line; |
| script.GetTokenLocation(0, &line, &col); |
| EXPECT_EQ(first_dart_line, line); |
| EXPECT_EQ(col, col_offset + 1); |
| + script.GetTokenLocation(0, &fast_line, NULL); |
|
hausner
2013/09/23 18:54:49
Can you add a comment here why you call GetTokenLo
Michael Lippautz (Google)
2013/09/23 21:15:03
Done.
|
| + EXPECT_EQ(line, fast_line); |
| - script.GetTokenLocation(4, &line, &col); // Token 'return' |
| + script.GetTokenLocation(5, &line, &col); // Token 'return' |
| EXPECT_EQ(4, line); // 'return' is in line 4. |
| EXPECT_EQ(5, col); // Four spaces before 'return'. |
| + script.GetTokenLocation(5, &fast_line, NULL); |
| + EXPECT_EQ(line, fast_line); |
| intptr_t first_idx, last_idx; |
| script.TokenRangeAtLine(3, &first_idx, &last_idx); |
| EXPECT_EQ(0, first_idx); // Token 'main' is first token. |
| EXPECT_EQ(3, last_idx); // Token { is last token. |
| + script.TokenRangeAtLine(4, &first_idx, &last_idx); |
| + EXPECT_EQ(5, first_idx); // Token 'return' is first token. |
| + EXPECT_EQ(7, last_idx); // Token ; is last token. |
| script.TokenRangeAtLine(5, &first_idx, &last_idx); |
| EXPECT_EQ(9, first_idx); // Token } is first and only token. |
| EXPECT_EQ(9, last_idx); |