Revision: 3202
Author: [email protected]
Date: Tue Nov  3 01:52:06 2009
Log: Made rethrow test not depend on stack overflow behavior.

Review URL: http://codereview.chromium.org/345046

http://code.google.com/p/v8/source/detail?r=3202

Modified:
  /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Tue Nov  3 00:53:34 2009
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Tue Nov  3 01:52:06 2009
@@ -8674,17 +8674,29 @@
  }


-// 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) {
+THREADED_TEST(SpaghettiStackReThrow) {
    v8::HandleScope scope;
    LocalContext context;
    context->Global()->Set(
        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