Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #30 from basho/dss-fix-ejslog

Dss fix ejslog
  • Loading branch information...
commit b70ed66e8a3b62775bea9078535ac8fae23673b1 2 parents 0e18747 + 7c9b581
@dizzyd dizzyd authored
Showing with 15 additions and 2 deletions.
  1. +2 −2 c_src/spidermonkey.c
  2. +13 −0 tests/eval_tests.erl
View
4 c_src/spidermonkey.c
@@ -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
13 tests/eval_tests.erl
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.