OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 RegExpCompileData result; | 396 RegExpCompileData result; |
397 CHECK(!v8::internal::RegExpParser::ParseRegExp( | 397 CHECK(!v8::internal::RegExpParser::ParseRegExp( |
398 &reader, false, &result, &zone)); | 398 &reader, false, &result, &zone)); |
399 CHECK(result.tree == NULL); | 399 CHECK(result.tree == NULL); |
400 CHECK(!result.error.is_null()); | 400 CHECK(!result.error.is_null()); |
401 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); | 401 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); |
402 CHECK_EQ(expected, *str); | 402 CHECK_EQ(expected, *str); |
403 } | 403 } |
404 | 404 |
405 | 405 |
406 UNINITIALIZED_TEST(Errors) { | 406 TEST(Errors) { |
407 V8::Initialize(NULL); | |
408 const char* kEndBackslash = "\\ at end of pattern"; | 407 const char* kEndBackslash = "\\ at end of pattern"; |
409 ExpectError("\\", kEndBackslash); | 408 ExpectError("\\", kEndBackslash); |
410 const char* kUnterminatedGroup = "Unterminated group"; | 409 const char* kUnterminatedGroup = "Unterminated group"; |
411 ExpectError("(foo", kUnterminatedGroup); | 410 ExpectError("(foo", kUnterminatedGroup); |
412 const char* kInvalidGroup = "Invalid group"; | 411 const char* kInvalidGroup = "Invalid group"; |
413 ExpectError("(?", kInvalidGroup); | 412 ExpectError("(?", kInvalidGroup); |
414 const char* kUnterminatedCharacterClass = "Unterminated character class"; | 413 const char* kUnterminatedCharacterClass = "Unterminated character class"; |
415 ExpectError("[", kUnterminatedCharacterClass); | 414 ExpectError("[", kUnterminatedCharacterClass); |
416 ExpectError("[a-", kUnterminatedCharacterClass); | 415 ExpectError("[a-", kUnterminatedCharacterClass); |
417 const char* kNothingToRepeat = "Nothing to repeat"; | 416 const char* kNothingToRepeat = "Nothing to repeat"; |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 ZoneList<CharacterRange> first_only(4, &zone); | 1809 ZoneList<CharacterRange> first_only(4, &zone); |
1811 ZoneList<CharacterRange> second_only(4, &zone); | 1810 ZoneList<CharacterRange> second_only(4, &zone); |
1812 ZoneList<CharacterRange> both(4, &zone); | 1811 ZoneList<CharacterRange> both(4, &zone); |
1813 } | 1812 } |
1814 | 1813 |
1815 | 1814 |
1816 TEST(Graph) { | 1815 TEST(Graph) { |
1817 V8::Initialize(NULL); | 1816 V8::Initialize(NULL); |
1818 Execute("\\b\\w+\\b", false, true, true); | 1817 Execute("\\b\\w+\\b", false, true, true); |
1819 } | 1818 } |
OLD | NEW |