| Anthony F. Molinaro | 917d898 | 2011-06-21 06:20:18 +0000 | [diff] [blame] | 1 | -module(test_thrift_1151). | 
 | 2 |  | 
 | 3 | -include("thrift1151_types.hrl"). | 
 | 4 |  | 
 | 5 | -ifdef(TEST). | 
 | 6 | -include_lib("eunit/include/eunit.hrl"). | 
 | 7 |  | 
 | 8 | unmatched_struct_test() -> | 
 | 9 |   S1 = #structC{x=#structB{x=1}}, | 
 | 10 |   {ok, Transport} = thrift_memory_buffer:new(), | 
 | 11 |   {ok, Protocol} = thrift_binary_protocol:new(Transport), | 
 | 12 |   ?assertException (error, struct_unmatched, | 
 | 13 |     thrift_protocol:write(Protocol, | 
 | 14 |       {{struct, element(2, thrift1151_types:struct_info('structC'))}, S1})). | 
 | 15 |  | 
 | 16 | badarg_test() -> | 
 | 17 |   S2 = #structC{x=#structA{x="1"}}, | 
 | 18 |   {ok, Transport} = thrift_memory_buffer:new(), | 
 | 19 |   {ok, Protocol} = thrift_binary_protocol:new(Transport), | 
 | 20 |   ?assertException (error, badarg, | 
 | 21 |     thrift_protocol:write(Protocol, | 
 | 22 |       {{struct, element(2, thrift1151_types:struct_info('structC'))}, S2})). | 
 | 23 |  | 
 | 24 | -endif. |