blob: 9cee4861bca4aaee7d21bd264ab090d88274dcec [file] [log] [blame]
Anthony F. Molinaro917d8982011-06-21 06:20:18 +00001-module(test_thrift_1151).
2
3-include("thrift1151_types.hrl").
4
5-ifdef(TEST).
6-include_lib("eunit/include/eunit.hrl").
7
8unmatched_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
16badarg_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.