fixed test with js callback
This commit is contained in:
parent
b3d8c5ba99
commit
08e0be70e2
2 changed files with 9 additions and 4 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 5350ed21606606dbee5ecb07e974f2abb9106270
|
Subproject commit 2f2785fafb0da6db75810eb6fa97d09c58257588
|
|
@ -119,10 +119,15 @@ user_command_test() ->
|
||||||
define(GameVM, "var t = '';\nfunction userCommand(user, command, args) { t = user + command + args; }\n"),
|
define(GameVM, "var t = '';\nfunction userCommand(user, command, args) { t = user + command + args; }\n"),
|
||||||
user_command(GameVM, "'jeena", "thecommand", "theargs'"),
|
user_command(GameVM, "'jeena", "thecommand", "theargs'"),
|
||||||
?assertMatch(<<"'jeenathecommandtheargs'">>, gen_server:call(GameVM, {eval, "t;"})).
|
?assertMatch(<<"'jeenathecommandtheargs'">>, gen_server:call(GameVM, {eval, "t;"})).
|
||||||
|
|
||||||
|
to_string({A, B, C}) ->
|
||||||
|
"{" ++ integer_to_list(A) ++ ", " ++ integer_to_list(B) ++ ", " ++ integer_to_list(C) ++ "}".
|
||||||
|
|
||||||
user_command2_test() ->
|
user_command2_test() ->
|
||||||
GameVM = start_link(test_table),
|
GameVM = start_link(test_table),
|
||||||
define(GameVM, "var t = '';\nfunction userCommand(user, command, args) { t = callErlang('erlang time') + ''; }\n"),
|
define(GameVM, "var t = '';\nfunction userCommand(user, command, args) { t = callErlang('erlang time') + ''; }\n"),
|
||||||
user_command(GameVM, "jeena", "test", ""),
|
user_command(GameVM, "", "", ""),
|
||||||
io:format("test ~p~n", [binary_to_list(gen_server:call(GameVM, {eval, "t;"}))]),
|
T = to_string(erlang:time()),
|
||||||
?assertMatch(<<"rt">>, gen_server:call(GameVM, {eval, "t;"})).
|
io:format("test ~p~n", [T]),
|
||||||
|
?assertMatch(T, binary_to_list(gen_server:call(GameVM, {eval, "t;"}))).
|
||||||
|
|
||||||
|
|
Reference in a new issue