Dss fix ejslog #30

Merged
merged 2 commits into from Sep 20, 2012
View
@@ -160,8 +160,8 @@ spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
JS_SetErrorReporter(vm->context, on_error);
JS_SetBranchCallback(vm->context, on_branch);
JS_SetContextPrivate(vm->context, state);
- JSNative *funptr = (JSNative *) *js_log;
- JS_DefineFunction(vm->context, JS_GetGlobalObject(vm->context), "ejsLog", *funptr,
+ JSNative funptr = (JSNative) &js_log;
+ JS_DefineFunction(vm->context, JS_GetGlobalObject(vm->context), "ejsLog", funptr,
0, JSFUN_FAST_NATIVE);
end_request(vm);
View
@@ -81,6 +81,19 @@ json_test_() ->
Struct = {struct, [{<<"test">>, <<"1">>}]},
?assertMatch(Struct, js_mochijson2:decode(js_mochijson2:encode(Struct))) end].
+ejslog_test_() ->
+ [{setup, fun test_util:port_setup/0,
+ fun test_util:port_teardown/1,
+ [fun() ->
+ P = test_util:get_thing(),
+ [] = os:cmd("rm -f /tmp/eval_tests.log"),
+ ?assertEqual({ok, true},
+ js_driver:eval_js(P, <<"ejsLog('/tmp/eval_tests.log', 'Hello')">>)),
+ ?assert(filelib:is_file("/tmp/eval_tests.log")),
+ erlang:unlink(P)
+ end]}].
+
+
error_test_() ->
[{setup, fun test_util:port_setup/0,
fun test_util:port_teardown/1,