Made rethrow test not depend on stack overflow behavior.
authorchristian.plesner.hansen@gmail.com <christian.plesner.hansen@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 3 Nov 2009 09:52:06 +0000 (09:52 +0000)
committerchristian.plesner.hansen@gmail.com <christian.plesner.hansen@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 3 Nov 2009 09:52:06 +0000 (09:52 +0000)
Review URL: http://codereview.chromium.org/345046

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3202 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

test/cctest/test-api.cc

index 514a22fcf31fdf3fb93c3f147315535326d4ade6..53df072977cf8a51125768efd0f41cd00e74804e 100644 (file)
@@ -8674,17 +8674,29 @@ 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) {
+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!"));
 }