-module(ts).
-export([eval/1]).
-on_load(init/0).
-define(SHAREDLIB, "tremor-script").
-define(nif_stub, nif_stub_error(?LINE)).
nif_stub_error(Line) ->
erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
init() ->
PrivDir = case code:priv_dir(?MODULE) of
{error, bad_name} ->
EbinDir = filename:dirname(code:which(?MODULE)),
AppPath = filename:dirname(EbinDir),
filename:join(AppPath, "priv");
Path ->
Path
end,
erlang:load_nif(filename:join(PrivDir, ?SHAREDLIB), 0).
eval(_AstJsonString) ->
?nif_stub.
-ifdef(TEST).
basic_test() ->
?assertEqual(ok, eval("1")).
-endif.