| Index: test/cctest/compiler/test-run-jsexceptions.cc
|
| diff --git a/test/cctest/compiler/test-run-jsexceptions.cc b/test/cctest/compiler/test-run-jsexceptions.cc
|
| index 5cafc34fdcffe12a17adeef6830e2b6a2452bd02..9b31fe09be15837c4b6df313437eb0a4f5b9f45f 100644
|
| --- a/test/cctest/compiler/test-run-jsexceptions.cc
|
| +++ b/test/cctest/compiler/test-run-jsexceptions.cc
|
| @@ -18,7 +18,7 @@ TEST(Throw) {
|
| }
|
|
|
|
|
| -TEST(ThrowSourcePosition) {
|
| +TEST(ThrowMessagePosition) {
|
| i::FLAG_turbo_exceptions = true;
|
| static const char* src =
|
| "(function(a, b) { \n"
|
| @@ -47,6 +47,48 @@ TEST(ThrowSourcePosition) {
|
| }
|
|
|
|
|
| +TEST(ThrowMessageDirectly) {
|
| + i::FLAG_turbo_exceptions = true;
|
| + static const char* src =
|
| + "(function(a, b) {"
|
| + " if (a) { throw b; } else { throw new Error(b); }"
|
| + "})";
|
| + FunctionTester T(src);
|
| + v8::Handle<v8::Message> message;
|
| +
|
| + message = T.CheckThrowsReturnMessage(T.false_value(), T.Val("Wat?"));
|
| + CHECK(!message.IsEmpty());
|
| + CHECK(message->Get()->Equals(v8_str("Uncaught Error: Wat?")));
|
| +
|
| + message = T.CheckThrowsReturnMessage(T.true_value(), T.Val("Kaboom!"));
|
| + CHECK(!message.IsEmpty());
|
| + CHECK(message->Get()->Equals(v8_str("Uncaught Kaboom!")));
|
| +}
|
| +
|
| +
|
| +TEST(ThrowMessageIndirectly) {
|
| + i::FLAG_turbo_exceptions = true;
|
| + static const char* src =
|
| + "(function(a, b) {"
|
| + " try {"
|
| + " if (a) { throw b; } else { throw new Error(b); }"
|
| + " } finally {"
|
| + " try { throw 'clobber'; } catch (e) { 'unclobber'; }"
|
| + " }"
|
| + "})";
|
| + FunctionTester T(src);
|
| + v8::Handle<v8::Message> message;
|
| +
|
| + message = T.CheckThrowsReturnMessage(T.false_value(), T.Val("Wat?"));
|
| + CHECK(!message.IsEmpty());
|
| + CHECK(message->Get()->Equals(v8_str("Uncaught Error: Wat?")));
|
| +
|
| + message = T.CheckThrowsReturnMessage(T.true_value(), T.Val("Kaboom!"));
|
| + CHECK(!message.IsEmpty());
|
| + CHECK(message->Get()->Equals(v8_str("Uncaught Kaboom!")));
|
| +}
|
| +
|
| +
|
| // TODO(mstarzinger): Increase test coverage by having similar tests within the
|
| // mjsunit suite to also test integration with other components (e.g. OSR).
|
|
|
|
|