diff options
author | Steve Cohen <steve@pinterest.com> | 2016-06-14 00:32:48 +0200 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2016-06-14 21:57:24 +0200 |
commit | 7ea4a87fc5c03c072a8d52cc499f1b83cfaa927b (patch) | |
tree | dcea1f2c9de439357f21805a75a12263a5517bde /lib/erl | |
parent | 61b170845f256b1977c6d8a8a5906ba998560a53 (diff) | |
download | thrift-7ea4a87fc5c03c072a8d52cc499f1b83cfaa927b.tar.gz |
THRIFT-3834 Erlang namespacing and exception metadata
Client: Erlang
Patch: Steve Cohen <steve@pinterest.com>
This closes #1027
Diffstat (limited to 'lib/erl')
-rw-r--r-- | lib/erl/test/thrift_test_test.erl | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/lib/erl/test/thrift_test_test.erl b/lib/erl/test/thrift_test_test.erl index e506437db..ae20f3199 100644 --- a/lib/erl/test/thrift_test_test.erl +++ b/lib/erl/test/thrift_test_test.erl @@ -33,32 +33,32 @@ constant_test_() -> record_generation_test_() -> [ {"Bonk record", ?_assertMatch( - {'Bonk', _, _}, - #'Bonk'{message=null,type=null} + {'thrift.test.Bonk', _, _}, + #'thrift.test.Bonk'{message=null,type=null} )}, {"Bools record", ?_assertMatch( - {'Bools', _, _}, - #'Bools'{im_true=null,im_false=null} + {'thrift.test.Bools', _, _}, + #'thrift.test.Bools'{im_true=null,im_false=null} )}, {"Xtruct record", ?_assertMatch( - {'Xtruct', _, _, _, _}, - #'Xtruct'{string_thing=null,byte_thing=null,i32_thing=null,i64_thing=null} + {'thrift.test.Xtruct', _, _, _, _}, + #'thrift.test.Xtruct'{string_thing=null,byte_thing=null,i32_thing=null,i64_thing=null} )}, {"Xtruct2 record", ?_assertMatch( - {'Xtruct2', _, _, _}, - #'Xtruct2'{byte_thing=null,struct_thing=null,i32_thing=null} + {'thrift.test.Xtruct2', _, _, _}, + #'thrift.test.Xtruct2'{byte_thing=null,struct_thing=null,i32_thing=null} )}, {"Xtruct3 record", ?_assertMatch( - {'Xtruct3', _, _, _, _}, - #'Xtruct3'{string_thing=null,changed=null,i32_thing=null,i64_thing=null} + {'thrift.test.Xtruct3', _, _, _, _}, + #'thrift.test.Xtruct3'{string_thing=null,changed=null,i32_thing=null,i64_thing=null} )}, {"Insanity record", ?_assertMatch( - {'Insanity', _, _}, - #'Insanity'{userMap=null,xtructs=null} + {'thrift.test.Insanity', _, _}, + #'thrift.test.Insanity'{userMap=null,xtructs=null} )}, {"CrazyNesting record", ?_assertMatch( - {'CrazyNesting', _, _, _, _}, - #'CrazyNesting'{ + {'thrift.test.CrazyNesting', _, _, _, _}, + #'thrift.test.CrazyNesting'{ string_field=null, set_field=null, list_field=null, @@ -66,22 +66,22 @@ record_generation_test_() -> } )}, {"Xception record", ?_assertMatch( - {'Xception', _, _}, - #'Xception'{errorCode=null,message=null} + {'thrift.test.Xception', _, _}, + #'thrift.test.Xception'{errorCode=null,message=null} )}, {"Xception2 record", ?_assertMatch( - {'Xception2', _, _}, - #'Xception2'{errorCode=null,struct_thing=null} + {'thrift.test.Xception2', _, _}, + #'thrift.test.Xception2'{errorCode=null,struct_thing=null} )}, - {"EmptyStruct record", ?_assertMatch({'EmptyStruct'}, #'EmptyStruct'{})}, - {"OneField record", ?_assertMatch({'OneField', _}, #'OneField'{field=null})}, + {"EmptyStruct record", ?_assertMatch({'thrift.test.EmptyStruct'}, #'thrift.test.EmptyStruct'{})}, + {"OneField record", ?_assertMatch({'thrift.test.OneField', _}, #'thrift.test.OneField'{field=null})}, {"VersioningTestV1 record", ?_assertMatch( - {'VersioningTestV1', _, _, _}, - #'VersioningTestV1'{begin_in_both=null,old_string=null,end_in_both=null} + {'thrift.test.VersioningTestV1', _, _, _}, + #'thrift.test.VersioningTestV1'{begin_in_both=null,old_string=null,end_in_both=null} )}, {"VersioningTestV2 record", ?_assertMatch( - {'VersioningTestV2', _, _, _, _, _, _, _, _, _, _, _, _}, - #'VersioningTestV2'{ + {'thrift.test.VersioningTestV2', _, _, _, _, _, _, _, _, _, _, _, _}, + #'thrift.test.VersioningTestV2'{ begin_in_both=null, newint=null, newbyte=null, @@ -97,20 +97,20 @@ record_generation_test_() -> } )}, {"ListTypeVersioningV1 record", ?_assertMatch( - {'ListTypeVersioningV1', _, _}, - #'ListTypeVersioningV1'{myints=null,hello=null} + {'thrift.test.ListTypeVersioningV1', _, _}, + #'thrift.test.ListTypeVersioningV1'{myints=null,hello=null} )}, {"ListTypeVersioningV2 record", ?_assertMatch( - {'ListTypeVersioningV2', _, _}, - #'ListTypeVersioningV2'{strings=null,hello=null} + {'thrift.test.ListTypeVersioningV2', _, _}, + #'thrift.test.ListTypeVersioningV2'{strings=null,hello=null} )}, {"GuessProtocolStruct record", ?_assertMatch( - {'GuessProtocolStruct', _}, - #'GuessProtocolStruct'{map_field=null} + {'thrift.test.GuessProtocolStruct', _}, + #'thrift.test.GuessProtocolStruct'{map_field=null} )}, {"LargeDeltas record", ?_assertMatch( - {'LargeDeltas', _, _, _, _, _, _, _, _, _, _}, - #'LargeDeltas'{ + {'thrift.test.LargeDeltas', _, _, _, _, _, _, _, _, _, _}, + #'thrift.test.LargeDeltas'{ b1=null, b10=null, b100=null, @@ -124,34 +124,34 @@ record_generation_test_() -> } )}, {"NestedListsI32x2 record", ?_assertMatch( - {'NestedListsI32x2', _}, - #'NestedListsI32x2'{integerlist=null} + {'thrift.test.NestedListsI32x2', _}, + #'thrift.test.NestedListsI32x2'{integerlist=null} )}, {"NestedListsI32x3 record", ?_assertMatch( - {'NestedListsI32x3', _}, - #'NestedListsI32x3'{integerlist=null} + {'thrift.test.NestedListsI32x3', _}, + #'thrift.test.NestedListsI32x3'{integerlist=null} )}, {"NestedMixedx2 record", ?_assertMatch( - {'NestedMixedx2', _, _, _}, - #'NestedMixedx2'{ + {'thrift.test.NestedMixedx2', _, _, _}, + #'thrift.test.NestedMixedx2'{ int_set_list=null, map_int_strset=null, map_int_strset_list=null } )}, - {"ListBonks record", ?_assertMatch({'ListBonks', _}, #'ListBonks'{bonk=null})}, + {"ListBonks record", ?_assertMatch({'thrift.test.ListBonks', _}, #'thrift.test.ListBonks'{bonk=null})}, {"NestedListsBonk record", ?_assertMatch( - {'NestedListsBonk', _}, - #'NestedListsBonk'{bonk=null} + {'thrift.test.NestedListsBonk', _}, + #'thrift.test.NestedListsBonk'{bonk=null} )}, {"BoolTest record", ?_assertMatch( - {'BoolTest', _, _}, - #'BoolTest'{b=null,s=null} + {'thrift.test.BoolTest', _, _}, + #'thrift.test.BoolTest'{b=null,s=null} )}, - {"StructA record", ?_assertMatch({'StructA', _}, #'StructA'{s=null})}, + {"StructA record", ?_assertMatch({'thrift.test.StructA', _}, #'thrift.test.StructA'{s=null})}, {"StructB record", ?_assertMatch( - {'StructB', _, _}, - #'StructB'{aa=null,ab=null} + {'thrift.test.StructB', _, _}, + #'thrift.test.StructB'{aa=null,ab=null} )} ]. @@ -159,21 +159,21 @@ struct_info_test_() -> [ {"Bonk definition (short version)", ?_assertEqual( {struct, [{1, string}, {2, i32}]}, - thrift_test_types:struct_info('Bonk') + thrift_test_types:struct_info('thrift.test.Bonk') )}, {"Bonk definition", ?_assertEqual( {struct, [ {1, undefined, string, message, undefined}, {2, undefined, i32, type, undefined} ]}, - thrift_test_types:struct_info_ext('Bonk') + thrift_test_types:struct_info_ext('thrift.test.Bonk') )}, {"Bools definition", ?_assertEqual( {struct, [ {1, undefined, bool, im_true, undefined}, {2, undefined, bool, im_false, undefined} ]}, - thrift_test_types:struct_info_ext('Bools') + thrift_test_types:struct_info_ext('thrift.test.Bools') )}, {"Xtruct definition", ?_assertEqual( {struct, [ @@ -182,15 +182,15 @@ struct_info_test_() -> {9, undefined, i32, i32_thing, undefined}, {11, undefined, i64, i64_thing, undefined} ]}, - thrift_test_types:struct_info_ext('Xtruct') + thrift_test_types:struct_info_ext('thrift.test.Xtruct') )}, {"Xtruct2 definition", ?_assertEqual( {struct, [ {1, undefined, byte, byte_thing, undefined}, - {2, undefined, {struct, {'thrift_test_types', 'Xtruct'}}, struct_thing, #'Xtruct'{}}, + {2, undefined, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}, struct_thing, #'thrift.test.Xtruct'{}}, {3, undefined, i32, i32_thing, undefined} ]}, - thrift_test_types:struct_info_ext('Xtruct2') + thrift_test_types:struct_info_ext('thrift.test.Xtruct2') )}, {"Xtruct3 definition", ?_assertEqual( {struct, [ @@ -199,50 +199,50 @@ struct_info_test_() -> {9, undefined, i32, i32_thing, undefined}, {11, undefined, i64, i64_thing, undefined} ]}, - thrift_test_types:struct_info_ext('Xtruct3') + thrift_test_types:struct_info_ext('thrift.test.Xtruct3') )}, {"Insanity definition", ?_assertEqual( {struct, [ {1, undefined, {map, i32, i64}, userMap, dict:new()}, - {2, undefined, {list, {struct, {'thrift_test_types', 'Xtruct'}}}, xtructs, []} + {2, undefined, {list, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}}, xtructs, []} ]}, - thrift_test_types:struct_info_ext('Insanity') + thrift_test_types:struct_info_ext('thrift.test.Insanity') )}, {"CrazyNesting definition", ?_assertEqual( {struct, [ {1, undefined, string, string_field, undefined}, - {2, optional, {set, {struct, {'thrift_test_types', 'Insanity'}}}, set_field, sets:new()}, - {3, required, {list, {map, + {2, optional, {set, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}}, set_field, sets:new()}, + {3, required, {list, {map, {set, i32}, - {map, i32, {set, {list, {map, {struct, {'thrift_test_types', 'Insanity'}}, string}}}} + {map, i32, {set, {list, {map, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}, string}}}} }}, list_field, []}, {4, undefined, string, binary_field, undefined} ]}, - thrift_test_types:struct_info_ext('CrazyNesting') + thrift_test_types:struct_info_ext('thrift.test.CrazyNesting') )}, {"Xception definition", ?_assertEqual( {struct, [ {1, undefined, i32, errorCode, undefined}, {2, undefined, string, message, undefined} ]}, - thrift_test_types:struct_info_ext('Xception') + thrift_test_types:struct_info_ext('thrift.test.Xception') )}, {"Xception2 definition", ?_assertEqual( {struct, [ {1, undefined, i32, errorCode, undefined}, - {2, undefined, {struct, {'thrift_test_types', 'Xtruct'}}, struct_thing, #'Xtruct'{}} + {2, undefined, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}, struct_thing, #'thrift.test.Xtruct'{}} ]}, - thrift_test_types:struct_info_ext('Xception2') + thrift_test_types:struct_info_ext('thrift.test.Xception2') )}, {"EmptyStruct definition", ?_assertEqual( {struct, []}, - thrift_test_types:struct_info_ext('EmptyStruct') + thrift_test_types:struct_info_ext('thrift.test.EmptyStruct') )}, {"OneField definition", ?_assertEqual( {struct, [ - {1, undefined, {struct, {'thrift_test_types', 'EmptyStruct'}}, field, #'EmptyStruct'{}} + {1, undefined, {struct, {'thrift_test_types', 'thrift.test.EmptyStruct'}}, field, #'thrift.test.EmptyStruct'{}} ]}, - thrift_test_types:struct_info_ext('OneField') + thrift_test_types:struct_info_ext('thrift.test.OneField') )}, {"VersioningTestV1 definition", ?_assertEqual( {struct, [ @@ -250,7 +250,7 @@ struct_info_test_() -> {3, undefined, string, old_string, undefined}, {12, undefined, i32, end_in_both, undefined} ]}, - thrift_test_types:struct_info_ext('VersioningTestV1') + thrift_test_types:struct_info_ext('thrift.test.VersioningTestV1') )}, {"VersioningTestV2 definition", ?_assertEqual( {struct, [ @@ -260,61 +260,61 @@ struct_info_test_() -> {4, undefined, i16, newshort, undefined}, {5, undefined, i64, newlong, undefined}, {6, undefined, double, newdouble, undefined}, - {7, undefined, {struct, {thrift_test_types, 'Bonk'}}, newstruct, #'Bonk'{}}, + {7, undefined, {struct, {thrift_test_types, 'thrift.test.Bonk'}}, newstruct, #'thrift.test.Bonk'{}}, {8, undefined, {list, i32}, newlist, []}, {9, undefined, {set, i32}, newset, sets:new()}, {10, undefined, {map, i32, i32}, newmap, dict:new()}, {11, undefined, string, newstring, undefined}, {12, undefined, i32, end_in_both, undefined} ]}, - thrift_test_types:struct_info_ext('VersioningTestV2') + thrift_test_types:struct_info_ext('thrift.test.VersioningTestV2') )}, {"ListTypeVersioningV1 definition", ?_assertEqual( {struct, [ {1, undefined, {list, i32}, myints, []}, {2, undefined, string, hello, undefined} ]}, - thrift_test_types:struct_info_ext('ListTypeVersioningV1') + thrift_test_types:struct_info_ext('thrift.test.ListTypeVersioningV1') )}, {"ListTypeVersioningV2 definition", ?_assertEqual( {struct, [ {1, undefined, {list, string}, strings, []}, {2, undefined, string, hello, undefined} ]}, - thrift_test_types:struct_info_ext('ListTypeVersioningV2') + thrift_test_types:struct_info_ext('thrift.test.ListTypeVersioningV2') )}, {"GuessProtocolStruct definition", ?_assertEqual( {struct, [ {7, undefined, {map, string, string}, map_field, dict:new()} ]}, - thrift_test_types:struct_info_ext('GuessProtocolStruct') + thrift_test_types:struct_info_ext('thrift.test.GuessProtocolStruct') )}, {"LargeDeltas definition", ?_assertEqual( {struct, [ - {1, undefined, {struct, {thrift_test_types, 'Bools'}}, b1, #'Bools'{}}, - {10, undefined, {struct, {thrift_test_types, 'Bools'}}, b10, #'Bools'{}}, - {100, undefined, {struct, {thrift_test_types, 'Bools'}}, b100, #'Bools'{}}, + {1, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b1, #'thrift.test.Bools'{}}, + {10, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b10, #'thrift.test.Bools'{}}, + {100, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b100, #'thrift.test.Bools'{}}, {500, undefined, bool, check_true, undefined}, - {1000, undefined, {struct, {thrift_test_types, 'Bools'}}, b1000, #'Bools'{}}, + {1000, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b1000, #'thrift.test.Bools'{}}, {1500, undefined, bool, check_false, undefined}, - {2000, undefined, {struct, {thrift_test_types, 'VersioningTestV2'}}, vertwo2000, #'VersioningTestV2'{}}, + {2000, undefined, {struct, {thrift_test_types, 'thrift.test.VersioningTestV2'}}, vertwo2000, #'thrift.test.VersioningTestV2'{}}, {2500, undefined, {set, string}, a_set2500, sets:new()}, - {3000, undefined, {struct, {thrift_test_types, 'VersioningTestV2'}}, vertwo3000, #'VersioningTestV2'{}}, + {3000, undefined, {struct, {thrift_test_types, 'thrift.test.VersioningTestV2'}}, vertwo3000, #'thrift.test.VersioningTestV2'{}}, {4000, undefined, {list, i32}, big_numbers, []} ]}, - thrift_test_types:struct_info_ext('LargeDeltas') + thrift_test_types:struct_info_ext('thrift.test.LargeDeltas') )}, {"NestedListsI32x2 definition", ?_assertEqual( {struct, [ {1, undefined, {list, {list, i32}}, integerlist, []} ]}, - thrift_test_types:struct_info_ext('NestedListsI32x2') + thrift_test_types:struct_info_ext('thrift.test.NestedListsI32x2') )}, {"NestedListsI32x3 definition", ?_assertEqual( {struct, [ {1, undefined, {list, {list, {list, i32}}}, integerlist, []} ]}, - thrift_test_types:struct_info_ext('NestedListsI32x3') + thrift_test_types:struct_info_ext('thrift.test.NestedListsI32x3') )}, {"NestedMixedx2 definition", ?_assertEqual( {struct, [ @@ -322,37 +322,37 @@ struct_info_test_() -> {2, undefined, {map, i32, {set, string}}, map_int_strset, dict:new()}, {3, undefined, {list, {map, i32, {set, string}}}, map_int_strset_list, []} ]}, - thrift_test_types:struct_info_ext('NestedMixedx2') + thrift_test_types:struct_info_ext('thrift.test.NestedMixedx2') )}, {"ListBonks definition", ?_assertEqual( {struct, [ - {1, undefined, {list, {struct, {thrift_test_types, 'Bonk'}}}, bonk, []} + {1, undefined, {list, {struct, {thrift_test_types, 'thrift.test.Bonk'}}}, bonk, []} ]}, - thrift_test_types:struct_info_ext('ListBonks') + thrift_test_types:struct_info_ext('thrift.test.ListBonks') )}, {"NestedListsBonk definition", ?_assertEqual( {struct, [ - {1, undefined, {list, {list, {list, {struct, {thrift_test_types, 'Bonk'}}}}}, bonk, []} + {1, undefined, {list, {list, {list, {struct, {thrift_test_types, 'thrift.test.Bonk'}}}}}, bonk, []} ]}, - thrift_test_types:struct_info_ext('NestedListsBonk') + thrift_test_types:struct_info_ext('thrift.test.NestedListsBonk') )}, {"BoolTest definition", ?_assertEqual( {struct, [ {1, optional, bool, b, true}, {2, optional, string, s, "true"} ]}, - thrift_test_types:struct_info_ext('BoolTest') + thrift_test_types:struct_info_ext('thrift.test.BoolTest') )}, {"StructA definition", ?_assertEqual( {struct, [{1, required, string, s, undefined}]}, - thrift_test_types:struct_info_ext('StructA') + thrift_test_types:struct_info_ext('thrift.test.StructA') )}, {"StructB definition", ?_assertEqual( {struct, [ - {1, optional, {struct, {thrift_test_types, 'StructA'}}, aa, #'StructA'{}}, - {2, required, {struct, {thrift_test_types, 'StructA'}}, ab, #'StructA'{}} + {1, optional, {struct, {thrift_test_types, 'thrift.test.StructA'}}, aa, #'thrift.test.StructA'{}}, + {2, required, {struct, {thrift_test_types, 'thrift.test.StructA'}}, ab, #'thrift.test.StructA'{}} ]}, - thrift_test_types:struct_info_ext('StructB') + thrift_test_types:struct_info_ext('thrift.test.StructB') )} ]. @@ -432,12 +432,12 @@ service_info_test_() -> )}, {"testStruct params", ?_assertEqual( {struct, [ - {1, {struct, {thrift_test_types, 'Xtruct'}}} + {1, {struct, {thrift_test_types, 'thrift.test.Xtruct'}}} ]}, thrift_test_thrift:function_info(testStruct, params_type) )}, {"testStruct reply", ?_assertEqual( - {struct, {thrift_test_types, 'Xtruct'}}, + {struct, {thrift_test_types, 'thrift.test.Xtruct'}}, thrift_test_thrift:function_info(testStruct, reply_type) )}, {"testStruct exceptions", ?_assertEqual( @@ -446,12 +446,12 @@ service_info_test_() -> )}, {"testNest params", ?_assertEqual( {struct, [ - {1, {struct, {thrift_test_types, 'Xtruct2'}}} + {1, {struct, {thrift_test_types, 'thrift.test.Xtruct2'}}} ]}, thrift_test_thrift:function_info(testNest, params_type) )}, {"testNest reply", ?_assertEqual( - {struct, {thrift_test_types, 'Xtruct2'}}, + {struct, {thrift_test_types, 'thrift.test.Xtruct2'}}, thrift_test_thrift:function_info(testNest, reply_type) )}, {"testNest exceptions", ?_assertEqual( @@ -556,12 +556,12 @@ service_info_test_() -> )}, {"testInsanity params", ?_assertEqual( {struct, [ - {1, {struct, {thrift_test_types, 'Insanity'}}} + {1, {struct, {thrift_test_types, 'thrift.test.Insanity'}}} ]}, thrift_test_thrift:function_info(testInsanity, params_type) )}, {"testInsanity reply", ?_assertEqual( - {map, i64, {map, i32, {struct, {'thrift_test_types', 'Insanity'}}}}, + {map, i64, {map, i32, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}}}, thrift_test_thrift:function_info(testInsanity, reply_type) )}, {"testInsanity exceptions", ?_assertEqual( @@ -580,7 +580,7 @@ service_info_test_() -> thrift_test_thrift:function_info(testMulti, params_type) )}, {"testMulti reply", ?_assertEqual( - {struct, {thrift_test_types, 'Xtruct'}}, + {struct, {thrift_test_types, 'thrift.test.Xtruct'}}, thrift_test_thrift:function_info(testMulti, reply_type) )}, {"testMulti exceptions", ?_assertEqual( @@ -597,7 +597,7 @@ service_info_test_() -> )}, {"testException exceptions", ?_assertEqual( {struct, [ - {1, {struct, {thrift_test_types, 'Xception'}}} + {1, {struct, {thrift_test_types, 'thrift.test.Xception'}}} ]}, thrift_test_thrift:function_info(testException, exceptions) )}, @@ -606,13 +606,13 @@ service_info_test_() -> thrift_test_thrift:function_info(testMultiException, params_type) )}, {"testMultiException reply", ?_assertEqual( - {struct, {thrift_test_types, 'Xtruct'}}, + {struct, {thrift_test_types, 'thrift.test.Xtruct'}}, thrift_test_thrift:function_info(testMultiException, reply_type) )}, {"testMultiException exceptions", ?_assertEqual( {struct, [ - {1, {struct, {thrift_test_types, 'Xception'}}}, - {2, {struct, {thrift_test_types, 'Xception2'}}} + {1, {struct, {thrift_test_types, 'thrift.test.Xception'}}}, + {2, {struct, {thrift_test_types, 'thrift.test.Xception2'}}} ]}, thrift_test_thrift:function_info(testMultiException, exceptions) )}, |