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 3702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3713 CompileRun( | 3713 CompileRun( |
3714 "try {\n" | 3714 "try {\n" |
3715 " throw new Error('a');\n" | 3715 " throw new Error('a');\n" |
3716 "} finally {\n" | 3716 "} finally {\n" |
3717 " native_with_try_catch();\n" | 3717 " native_with_try_catch();\n" |
3718 "}\n"); | 3718 "}\n"); |
3719 CHECK(try_catch.HasCaught()); | 3719 CHECK(try_catch.HasCaught()); |
3720 } | 3720 } |
3721 | 3721 |
3722 | 3722 |
| 3723 static void TryCatchNestedHelper(int depth) { |
| 3724 if (depth > 0) { |
| 3725 v8::TryCatch try_catch; |
| 3726 try_catch.SetVerbose(true); |
| 3727 TryCatchNestedHelper(depth - 1); |
| 3728 CHECK(try_catch.HasCaught()); |
| 3729 try_catch.ReThrow(); |
| 3730 } else { |
| 3731 v8::ThrowException(v8_str("back")); |
| 3732 } |
| 3733 } |
| 3734 |
| 3735 |
| 3736 TEST(TryCatchNested) { |
| 3737 v8::V8::Initialize(); |
| 3738 v8::HandleScope scope; |
| 3739 LocalContext context; |
| 3740 v8::TryCatch try_catch; |
| 3741 TryCatchNestedHelper(5); |
| 3742 CHECK(try_catch.HasCaught()); |
| 3743 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "back")); |
| 3744 } |
| 3745 |
| 3746 |
3723 THREADED_TEST(Equality) { | 3747 THREADED_TEST(Equality) { |
3724 v8::HandleScope scope; | 3748 v8::HandleScope scope; |
3725 LocalContext context; | 3749 LocalContext context; |
3726 // Check that equality works at all before relying on CHECK_EQ | 3750 // Check that equality works at all before relying on CHECK_EQ |
3727 CHECK(v8_str("a")->Equals(v8_str("a"))); | 3751 CHECK(v8_str("a")->Equals(v8_str("a"))); |
3728 CHECK(!v8_str("a")->Equals(v8_str("b"))); | 3752 CHECK(!v8_str("a")->Equals(v8_str("b"))); |
3729 | 3753 |
3730 CHECK_EQ(v8_str("a"), v8_str("a")); | 3754 CHECK_EQ(v8_str("a"), v8_str("a")); |
3731 CHECK_NE(v8_str("a"), v8_str("b")); | 3755 CHECK_NE(v8_str("a"), v8_str("b")); |
3732 CHECK_EQ(v8_num(1), v8_num(1)); | 3756 CHECK_EQ(v8_num(1), v8_num(1)); |
(...skipping 14264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17997 | 18021 |
17998 i::Semaphore* sem_; | 18022 i::Semaphore* sem_; |
17999 volatile int sem_value_; | 18023 volatile int sem_value_; |
18000 }; | 18024 }; |
18001 | 18025 |
18002 | 18026 |
18003 THREADED_TEST(SemaphoreInterruption) { | 18027 THREADED_TEST(SemaphoreInterruption) { |
18004 ThreadInterruptTest().RunTest(); | 18028 ThreadInterruptTest().RunTest(); |
18005 } | 18029 } |
18006 #endif // WIN32 | 18030 #endif // WIN32 |
OLD | NEW |