OLD | NEW |
---|---|
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 CHECK_PARSE_EQ("]", "']'"); | 171 CHECK_PARSE_EQ("]", "']'"); |
172 CHECK_PARSE_EQ("}", "'}'"); | 172 CHECK_PARSE_EQ("}", "'}'"); |
173 CHECK_PARSE_EQ("[a-b-c]", "[a-b - c]"); | 173 CHECK_PARSE_EQ("[a-b-c]", "[a-b - c]"); |
174 CHECK_PARSE_EQ("[\\d]", "[0-9]"); | 174 CHECK_PARSE_EQ("[\\d]", "[0-9]"); |
175 CHECK_PARSE_EQ("[x\\dz]", "[x 0-9 z]"); | 175 CHECK_PARSE_EQ("[x\\dz]", "[x 0-9 z]"); |
176 CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]"); | 176 CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]"); |
177 CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]"); | 177 CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]"); |
178 CHECK_PARSE_EQ("[z-\\d]", "[z - 0-9]"); | 178 CHECK_PARSE_EQ("[z-\\d]", "[z - 0-9]"); |
179 CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK", | 179 CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK", |
180 "'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'"); | 180 "'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'"); |
181 CHECK_PARSE_EQ("\\c!", "'c!'"); | 181 CHECK_PARSE_EQ("\\c!", "'\\c!'"); |
182 CHECK_PARSE_EQ("\\c_", "'c_'"); | 182 CHECK_PARSE_EQ("\\c_", "'\\c_'"); |
183 CHECK_PARSE_EQ("\\c~", "'c~'"); | 183 CHECK_PARSE_EQ("\\c~", "'\\c~'"); |
184 CHECK_PARSE_EQ("[a\\]c]", "[a ] c]"); | 184 CHECK_PARSE_EQ("[a\\]c]", "[a ] c]"); |
185 CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '"); | 185 CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '"); |
186 CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]"); | 186 CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]"); |
187 CHECK_PARSE_EQ("\\0", "'\\x00'"); | 187 CHECK_PARSE_EQ("\\0", "'\\x00'"); |
188 CHECK_PARSE_EQ("\\8", "'8'"); | 188 CHECK_PARSE_EQ("\\8", "'8'"); |
189 CHECK_PARSE_EQ("\\9", "'9'"); | 189 CHECK_PARSE_EQ("\\9", "'9'"); |
190 CHECK_PARSE_EQ("\\11", "'\\x09'"); | 190 CHECK_PARSE_EQ("\\11", "'\\x09'"); |
191 CHECK_PARSE_EQ("\\11a", "'\\x09a'"); | 191 CHECK_PARSE_EQ("\\11a", "'\\x09a'"); |
192 CHECK_PARSE_EQ("\\011", "'\\x09'"); | 192 CHECK_PARSE_EQ("\\011", "'\\x09'"); |
193 CHECK_PARSE_EQ("\\00011", "'\\x0011'"); | 193 CHECK_PARSE_EQ("\\00011", "'\\x0011'"); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 CHECK_PARSE_EQ("[\\11]", "[\\x09]"); | 227 CHECK_PARSE_EQ("[\\11]", "[\\x09]"); |
228 CHECK_PARSE_EQ("[\\11a]", "[\\x09 a]"); | 228 CHECK_PARSE_EQ("[\\11a]", "[\\x09 a]"); |
229 CHECK_PARSE_EQ("[\\011]", "[\\x09]"); | 229 CHECK_PARSE_EQ("[\\011]", "[\\x09]"); |
230 CHECK_PARSE_EQ("[\\00011]", "[\\x00 1 1]"); | 230 CHECK_PARSE_EQ("[\\00011]", "[\\x00 1 1]"); |
231 CHECK_PARSE_EQ("[\\118]", "[\\x09 8]"); | 231 CHECK_PARSE_EQ("[\\118]", "[\\x09 8]"); |
232 CHECK_PARSE_EQ("[\\111]", "[I]"); | 232 CHECK_PARSE_EQ("[\\111]", "[I]"); |
233 CHECK_PARSE_EQ("[\\1111]", "[I 1]"); | 233 CHECK_PARSE_EQ("[\\1111]", "[I 1]"); |
234 CHECK_PARSE_EQ("\\x34", "'\x34'"); | 234 CHECK_PARSE_EQ("\\x34", "'\x34'"); |
235 CHECK_PARSE_EQ("\\x60", "'\x60'"); | 235 CHECK_PARSE_EQ("\\x60", "'\x60'"); |
236 CHECK_PARSE_EQ("\\x3z", "'x3z'"); | 236 CHECK_PARSE_EQ("\\x3z", "'x3z'"); |
237 CHECK_PARSE_EQ("\\c", "'c'"); | 237 CHECK_PARSE_EQ("\\c", "'\\c'"); |
Erik Corry
2011/01/07 10:38:16
Test of the JS parser as well as the regexp parser
Lasse Reichstein
2011/01/07 12:34:09
Added to cctest/test-parsing.cc
| |
238 CHECK_PARSE_EQ("\\u0034", "'\x34'"); | 238 CHECK_PARSE_EQ("\\u0034", "'\x34'"); |
239 CHECK_PARSE_EQ("\\u003z", "'u003z'"); | 239 CHECK_PARSE_EQ("\\u003z", "'u003z'"); |
240 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))"); | 240 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))"); |
241 | 241 |
242 CHECK_SIMPLE("a", true); | 242 CHECK_SIMPLE("a", true); |
243 CHECK_SIMPLE("a|b", false); | 243 CHECK_SIMPLE("a|b", false); |
244 CHECK_SIMPLE("a\\n", false); | 244 CHECK_SIMPLE("a\\n", false); |
245 CHECK_SIMPLE("^a", false); | 245 CHECK_SIMPLE("^a", false); |
246 CHECK_SIMPLE("a$", false); | 246 CHECK_SIMPLE("a$", false); |
247 CHECK_SIMPLE("a\\b!", false); | 247 CHECK_SIMPLE("a\\b!", false); |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1776 bool in_second = CharacterInSet(&l2, i); | 1776 bool in_second = CharacterInSet(&l2, i); |
1777 CHECK((in_first || in_second) == CharacterInSet(&all, i)); | 1777 CHECK((in_first || in_second) == CharacterInSet(&all, i)); |
1778 } | 1778 } |
1779 } | 1779 } |
1780 | 1780 |
1781 | 1781 |
1782 TEST(Graph) { | 1782 TEST(Graph) { |
1783 V8::Initialize(NULL); | 1783 V8::Initialize(NULL); |
1784 Execute("\\b\\w+\\b", false, true, true); | 1784 Execute("\\b\\w+\\b", false, true, true); |
1785 } | 1785 } |
OLD | NEW |