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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 8226017: Introduce collective --harmony flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 i::byte buffer[32]; 58 i::byte buffer[32];
59 for (int i = 0; (key_token = keywords[i]).keyword != NULL; i++) { 59 for (int i = 0; (key_token = keywords[i]).keyword != NULL; i++) {
60 const i::byte* keyword = 60 const i::byte* keyword =
61 reinterpret_cast<const i::byte*>(key_token.keyword); 61 reinterpret_cast<const i::byte*>(key_token.keyword);
62 int length = i::StrLength(key_token.keyword); 62 int length = i::StrLength(key_token.keyword);
63 CHECK(static_cast<int>(sizeof(buffer)) >= length); 63 CHECK(static_cast<int>(sizeof(buffer)) >= length);
64 { 64 {
65 i::Utf8ToUC16CharacterStream stream(keyword, length); 65 i::Utf8ToUC16CharacterStream stream(keyword, length);
66 i::JavaScriptScanner scanner(&unicode_cache); 66 i::JavaScriptScanner scanner(&unicode_cache);
67 // The scanner should parse 'let' as Token::LET for this test. 67 // The scanner should parse 'let' as Token::LET for this test.
68 scanner.SetHarmonyBlockScoping(true); 68 scanner.SetHarmonyScoping(true);
69 scanner.Initialize(&stream); 69 scanner.Initialize(&stream);
70 CHECK_EQ(key_token.token, scanner.Next()); 70 CHECK_EQ(key_token.token, scanner.Next());
71 CHECK_EQ(i::Token::EOS, scanner.Next()); 71 CHECK_EQ(i::Token::EOS, scanner.Next());
72 } 72 }
73 // Removing characters will make keyword matching fail. 73 // Removing characters will make keyword matching fail.
74 { 74 {
75 i::Utf8ToUC16CharacterStream stream(keyword, length - 1); 75 i::Utf8ToUC16CharacterStream stream(keyword, length - 1);
76 i::JavaScriptScanner scanner(&unicode_cache); 76 i::JavaScriptScanner scanner(&unicode_cache);
77 scanner.Initialize(&stream); 77 scanner.Initialize(&stream);
78 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); 78 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]"); 699 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]");
700 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); 700 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]");
701 // Escaped ']'s wont end the character class. 701 // Escaped ']'s wont end the character class.
702 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); 702 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]");
703 // Escaped slashes are not terminating. 703 // Escaped slashes are not terminating.
704 TestScanRegExp("/\\//flipperwald", "\\/"); 704 TestScanRegExp("/\\//flipperwald", "\\/");
705 // Starting with '=' works too. 705 // Starting with '=' works too.
706 TestScanRegExp("/=/", "="); 706 TestScanRegExp("/=/", "=");
707 TestScanRegExp("/=?/", "=?"); 707 TestScanRegExp("/=?/", "=?");
708 } 708 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698