From 7d1e51437e6b9e562420c13d18b2f7aedaa26b13 Mon Sep 17 00:00:00 2001 From: UENISHI Kota Date: Mon, 31 May 2010 23:13:32 +0900 Subject: [PATCH] erlang: added usage of cross-language test. --- erlang/msgpack.erl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/erlang/msgpack.erl b/erlang/msgpack.erl index df7974db..90ddb769 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])->