OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 11697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11708 re = v8::RegExp::New(v8_str("foobarbaz"), | 11708 re = v8::RegExp::New(v8_str("foobarbaz"), |
11709 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | | 11709 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | |
11710 v8::RegExp::kMultiline)); | 11710 v8::RegExp::kMultiline)); |
11711 CHECK(re->IsRegExp()); | 11711 CHECK(re->IsRegExp()); |
11712 CHECK(re->GetSource()->Equals(v8_str("foobarbaz"))); | 11712 CHECK(re->GetSource()->Equals(v8_str("foobarbaz"))); |
11713 CHECK_EQ(static_cast<int>(re->GetFlags()), | 11713 CHECK_EQ(static_cast<int>(re->GetFlags()), |
11714 v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline); | 11714 v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline); |
11715 | 11715 |
11716 context->Global()->Set(v8_str("re"), re); | 11716 context->Global()->Set(v8_str("re"), re); |
11717 ExpectTrue("re.test('FoobarbaZ')"); | 11717 ExpectTrue("re.test('FoobarbaZ')"); |
| 11718 |
| 11719 v8::TryCatch try_catch; |
| 11720 re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone); |
| 11721 CHECK(re.IsEmpty()); |
| 11722 CHECK(try_catch.HasCaught()); |
| 11723 context->Global()->Set(v8_str("ex"), try_catch.Exception()); |
| 11724 ExpectTrue("ex instanceof SyntaxError"); |
11718 } | 11725 } |
OLD | NEW |