1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

pidl: fix parse_idl test after idl.yp changes

We now generate 'FILE' and 'LINE' elements for each layer.

This change makes the expected PIDL trees human readable:-)

metze
This commit is contained in:
Stefan Metzmacher 2009-08-12 10:24:01 +02:00
parent 6392f14cd7
commit 5796da6948

View File

@ -113,52 +113,127 @@ testok "cpp-quote", "cpp_quote(\"bla\")";
my $x = Parse::Pidl::IDL::parse_string("interface foo { struct x {}; }", "<foo>");
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
{ 'NAME' => 'x', 'TYPE' => 'STRUCT', ELEMENTS => [] } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'INTERFACE',
'NAME' => 'foo',
'DATA' => [ {
'TYPE' => 'STRUCT',
'NAME' => 'x',
'ELEMENTS' => [],
'FILE' => '<foo>',
'LINE' => 0
} ],
'FILE' => '<foo>',
'LINE' => 0
}]);
$x = Parse::Pidl::IDL::parse_string("interface foo { struct x; }", "<foo>");
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
{ 'NAME' => 'x', 'TYPE' => 'STRUCT' } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'INTERFACE',
'NAME' => 'foo',
'DATA' => [ {
'TYPE' => 'STRUCT',
'NAME' => 'x',
'FILE' => '<foo>',
'LINE' => 0
} ],
'FILE' => '<foo>',
'LINE' => 0
}]);
$x = Parse::Pidl::IDL::parse_string("cpp_quote(\"foobar\")", "<quote>");
is_deeply($x,
[ { 'FILE' => '<quote>', 'DATA' => '"foobar"',
'TYPE' => 'CPP_QUOTE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'CPP_QUOTE',
'DATA' => '"foobar"',
'FILE' => '<quote>',
'LINE' => 0
}]);
# A typedef of a struct without body
$x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct x y; }", "<foo>");
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
{ 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => {
TYPE => 'STRUCT', NAME => 'x' } } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'INTERFACE',
'NAME' => 'foo',
'DATA' => [ {
'TYPE' => 'TYPEDEF',
'NAME' => 'y',
'DATA' => {
'TYPE' => 'STRUCT',
'NAME' => 'x',
'FILE' => '<foo>',
'LINE' => 0,
},
'FILE' => '<foo>',
'LINE' => 0,
} ],
'FILE' => '<foo>',
'LINE' => 0
}]);
# A typedef of a struct with empty body
$x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct {} y; }", "<foo>");
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
{ 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'STRUCT', ELEMENTS => [] } } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'INTERFACE',
'NAME' => 'foo',
'DATA' => [ {
'TYPE' => 'TYPEDEF',
'NAME' => 'y',
'DATA' => {
'TYPE' => 'STRUCT',
'ELEMENTS' => [],
'FILE' => '<foo>',
'LINE' => 0
},
'FILE' => '<foo>',
'LINE' => 0
} ],
'FILE' => '<foo>',
'LINE' => 0
}]);
# A typedef of a bitmap with no body
$x = Parse::Pidl::IDL::parse_string("interface foo { typedef bitmap x y; }", "<foo>");
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
{ 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'BITMAP', NAME => 'x' } } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'INTERFACE',
'NAME' => 'foo',
'DATA' => [ {
'TYPE' => 'TYPEDEF',
'NAME' => 'y',
'DATA' => {
'TYPE' => 'BITMAP',
'NAME' => 'x',
'FILE' => '<foo>',
'LINE' => 0
},
'FILE' => '<foo>',
'LINE' => 0
} ],
'FILE' => '<foo>',
'LINE' => 0
}]);
# A typedef of a union with no body
$x = Parse::Pidl::IDL::parse_string("interface foo { typedef union x y; }", "<foo>");
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
{ 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'UNION', NAME => 'x' } } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
is_deeply($x, [ {
'TYPE' => 'INTERFACE',
'NAME' => 'foo',
'DATA' => [ {
'TYPE' => 'TYPEDEF',
'NAME' => 'y',
'DATA' => {
'TYPE' => 'UNION',
'NAME' => 'x',
'FILE' => '<foo>',
'LINE' => 0
},
'FILE' => '<foo>',
'LINE' => 0
} ],
'FILE' => '<foo>',
'LINE' => 0
}]);