diff --git a/js2/tests/cpp/DikDik_Shell.cpp b/js2/tests/cpp/DikDik_Shell.cpp index 669beb5d841..c0b39171c05 100644 --- a/js2/tests/cpp/DikDik_Shell.cpp +++ b/js2/tests/cpp/DikDik_Shell.cpp @@ -113,7 +113,7 @@ static JSValue load(Context *cx, const JSValue& /*thisValue*/, JSValue *argv, ui return kUndefinedValue; } -static JSValue print(Context *, const JSValue& /*thisValue*/, JSValue *argv, uint32 argc) +static JSValue print(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue *argv, uint32 argc) { for (uint32 i = 0; i < argc; i++) { stdOut << argv[i] << "\n"; @@ -121,7 +121,7 @@ static JSValue print(Context *, const JSValue& /*thisValue*/, JSValue *argv, uin return kUndefinedValue; } -static JSValue version(Context *, const JSValue& /*thisValue*/, JSValue * /*argv*/, uint32 /*argc*/) +static JSValue version(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue * /*argv*/, uint32 /*argc*/) { return JSValue(2.0); } @@ -146,6 +146,12 @@ static JSValue dikdik(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue * return kUndefinedValue; } +static JSValue quit(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue * /*argv*/, uint32 /*argc*/) +{ + exit(0); + return kUndefinedValue; +} + static int readEvalPrint(Context *cx, FILE *in) { int result = 0; @@ -265,8 +271,8 @@ int main(int argc, char **argv) stdOut << "Welcome to DikDik.\n"; #endif -#if DEBUG - testCollector(); +#if DEBUG + testCollector(); #endif try { @@ -279,6 +285,7 @@ int main(int argc, char **argv) globalObject->defineVariable(&cx, widenCString("trace"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, trace, NULL))); globalObject->defineVariable(&cx, widenCString("dikdik"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, dikdik, NULL))); globalObject->defineVariable(&cx, widenCString("version"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, version, NULL))); + globalObject->defineVariable(&cx, widenCString("quit"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, quit, NULL))); bool doInteractive = true; int result = 0;