summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUENISHI Kota <kuenishi+github@gmail.com>2010-05-31 23:13:32 +0900
committerUENISHI Kota <kuenishi+github@gmail.com>2010-05-31 23:13:32 +0900
commit7d1e51437e6b9e562420c13d18b2f7aedaa26b13 (patch)
tree17ea2a2ad4e6974df9d79bd82c332229e500f535
parentf5a7d444e202f47f65b72459677fcd3c8b31bcfd (diff)
downloadmsgpack-python-7d1e51437e6b9e562420c13d18b2f7aedaa26b13.tar.gz
erlang: added usage of cross-language test.
-rw-r--r--erlang/msgpack.erl21
1 files changed, 10 insertions, 11 deletions
diff --git a/erlang/msgpack.erl b/erlang/msgpack.erl
index df7974d..90ddb76 100644
--- a/erlang/msgpack.erl
+++ b/erlang/msgpack.erl
@@ -1,7 +1,7 @@
%%
%% MessagePack for Erlang
%%
-%% Copyright (C) 2009 UENISHI Kota
+%% Copyright (C) 2009-2010 UENISHI Kota
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -332,16 +332,15 @@ test()->
[0,42,"sum", [1,2]], [1,42, nil, [3]]
],
Passed = test_(Tests),
- Passed = length(Tests).
-%% Port = open_port({spawn, "./a.out"}, [stream]),
-%% receive {Port, {data, Data}}->
-%% io:format("~p~n", [unpack_all( list_to_binary(Data) )])
-%% after 1024-> timeout end,
-%% Passed2 = test_(Tests, Port),
-%% Passed2 = length(Tests),
-%% Port ! {self(), close},
-%% receive {Port, closed}-> ok
-%% after 1024 -> timeout end.
+ Passed = length(Tests),
+ {[Tests],<<>>} = msgpack:unpack(msgpack:pack([Tests])),
+ Port = open_port({spawn, "ruby ../crosslang.rb"}, [binary]),
+ true = port_command(Port, msgpack:pack(Tests) ),
+ %Port ! {self, {command, msgpack:pack(Tests)}}, ... not owner
+ receive
+ {Port, {data, Data}}-> {Tests, <<>>}=msgpack:unpack(Data)
+ after 1024-> ?assert(false) end,
+ port_close(Port).
test_([]) -> 0;
test_([S|Rest])->