Author: [EMAIL PROTECTED]
Date: Mon Nov 17 08:00:58 2008
New Revision: 773

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

Log:
Fix external string test.

Modified: branches/bleeding_edge/test/cctest/test-api.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/test-api.cc      (original)
+++ branches/bleeding_edge/test/cctest/test-api.cc      Mon Nov 17 08:00:58 2008
@@ -5237,7 +5237,8 @@

  static v8::Handle<Value> ExternalSymbolGetter(Local<String> name,
                                                const AccessorInfo& info) {
-  CHECK(name->IsExternal());
+  ApiTestFuzzer::Fuzz();
+  CHECK(!name->Equals(v8_str("externalSymbol722")) ||  
name->IsExternal());  CHECK(name->IsExternal());
    return v8::True();
  }

@@ -5245,7 +5246,8 @@
  static void ExternalSymbolSetter(Local<String> name,
                                   Local<Value> value,
                                   const AccessorInfo&) {
-  CHECK(name->IsExternal());
+  ApiTestFuzzer::Fuzz();
+  CHECK(!name->Equals(v8_str("externalSymbol722")) || name->IsExternal());
  }


@@ -5255,12 +5257,20 @@
    v8::HandleScope scope;
    LocalContext context;
    Local<ObjectTemplate> templ = ObjectTemplate::New();
-  templ->SetAccessor(v8_str("x"), ExternalSymbolGetter,  
ExternalSymbolSetter);
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-  Local<Value> value = CompileRun("var o = { x: 42 }; o.x");
+  // Use a bizare name so that the name does not clash with names used
+  // in natives files.  If running with snapshots enabled, variable
+  // names used in the native files will be normal symbols instead of
+  // external ones.  Also, make sure that the bizare name is used from
+  // JavaScript code before using it from C++ code.
+  Local<Value> value =
+      CompileRun("var o = { externalSymbol722: 42 }; o.externalSymbol722");
    CHECK_EQ(42, value->Int32Value());
-  value = CompileRun("obj.x");
+  templ->SetAccessor(v8_str("externalSymbol722"),
+                     ExternalSymbolGetter,
+                     ExternalSymbolSetter);
+  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  value = CompileRun("obj.externalSymbol722");
    CHECK_EQ(true, value->BooleanValue());
-  value = CompileRun("obj.x = 42");
+  value = CompileRun("obj.externalSymbol722 = 42");
    v8::V8::SetExternalSymbolCallback(NULL);
  }

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

Reply via email to