Reviewers: Erik Corry,

Description:
Made rethrow test not depend on stack overflow behavior.

Please review this at http://codereview.chromium.org/345046

Affected files:
   M test/cctest/test-api.cc


Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index  
514a22fcf31fdf3fb93c3f147315535326d4ade6..9d979e80c75d4c965939974d631ba63c12c8ea43
  
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -8674,7 +8674,7 @@ static v8::Handle<Value> SpaghettiIncident(const  
v8::Arguments& args) {
  }


-// Test that a stack overflow can be propagated down through a spaghetti
+// Test that an exception can be propagated down through a spaghetti
  // stack using ReThrow.
  THREADED_TEST(SpaghettiStackOverflow) {
    v8::HandleScope scope;
@@ -8683,8 +8683,20 @@ THREADED_TEST(SpaghettiStackOverflow) {
        v8::String::New("s"),
        v8::FunctionTemplate::New(SpaghettiIncident)->GetFunction());
    v8::TryCatch try_catch;
-  CompileRun("var o = {toString: function () {return s(o);}}; s(o);");
+  CompileRun(
+      "var i = 0;"
+      "var o = {"
+      "  toString: function () {"
+      "    if (i == 10) {"
+      "      throw 'Hey!';"
+      "    } else {"
+      "      i++;"
+      "      return s(o);"
+      "    }"
+      "  }"
+      "};"
+      "s(o);");
    CHECK(try_catch.HasCaught());
    v8::String::Utf8Value value(try_catch.Exception());
-  CHECK_NE(0, strstr(*value, "RangeError"));
+  CHECK_EQ(0, strcmp(*value, "Hey!"));
  }



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to