diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-18 13:44:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:32 -0500 |
commit | 2b43de2ed8025ef598c31d41f0fe710f8e3a3658 (patch) | |
tree | 85aaf1780c3d2ae6b8df3368e2dd0007fcf01efa /source4/pidl/tests | |
parent | ae76a5a92819bfd2d31bc5d23a540c6c71b47354 (diff) | |
download | samba-2b43de2ed8025ef598c31d41f0fe710f8e3a3658.tar.gz samba-2b43de2ed8025ef598c31d41f0fe710f8e3a3658.tar.bz2 samba-2b43de2ed8025ef598c31d41f0fe710f8e3a3658.zip |
r21428: Handle representation types in Needed().
(This used to be commit 34517c69e67d7eafa00e6fe0072bd04f074cdbde)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-x | source4/pidl/tests/ndr.pl | 28 | ||||
-rwxr-xr-x | source4/pidl/tests/samba-ndr.pl | 34 |
2 files changed, 53 insertions, 9 deletions
diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl index da22949c6d..baf06b1eae 100755 --- a/source4/pidl/tests/ndr.pl +++ b/source4/pidl/tests/ndr.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 12; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -189,3 +189,29 @@ is_deeply(GetElementLevelTable($e), [ 'CONVERT_TO' => undef } ]); + +# representation_type +$e = { + 'FILE' => 'foo.idl', + 'NAME' => 'v', + 'PROPERTIES' => { represent_as => "bar" }, + 'POINTERS' => 0, + 'TYPE' => 'uint8', + 'PARENT' => { TYPE => 'STRUCT' }, + 'LINE' => 42 }; + +$ne = ParseElement($e); +is($ne->{REPRESENTATION_TYPE}, "bar"); + +# representation_type +$e = { + 'FILE' => 'foo.idl', + 'NAME' => 'v', + 'PROPERTIES' => { }, + 'POINTERS' => 0, + 'TYPE' => 'uint8', + 'PARENT' => { TYPE => 'STRUCT' }, + 'LINE' => 42 }; + +$ne = ParseElement($e); +is($ne->{REPRESENTATION_TYPE}, "uint8"); diff --git a/source4/pidl/tests/samba-ndr.pl b/source4/pidl/tests/samba-ndr.pl index f64a8c4093..1f859db788 100755 --- a/source4/pidl/tests/samba-ndr.pl +++ b/source4/pidl/tests/samba-ndr.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 29; +use Test::More tests => 31; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -176,27 +176,27 @@ EnvSubstituteValue($env, $fn); is_deeply($env, { foo => 0, this => "r" }); my $needed = {}; -NeededElement({ TYPE => "foo" }, "pull", $needed); +NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed); is_deeply($needed, { pull_foo => 1 }); # old settings should be kept $needed = { pull_foo => 0 }; -NeededElement({ TYPE => "foo" }, "pull", $needed); +NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed); is_deeply($needed, { pull_foo => 0 }); # print/pull/push are independent of each other $needed = { pull_foo => 0 }; -NeededElement({ TYPE => "foo" }, "print", $needed); +NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "print", $needed); is_deeply($needed, { pull_foo => 0, print_foo => 1 }); $needed = { }; -NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar" } ] }, $needed); +NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] }, $needed); is_deeply($needed, { pull_foo => 1, print_foo => 1, push_foo => 1, pull_bar => 1, print_bar => 1, push_bar => 1}); # push/pull/print are always set for functions $needed = { pull_foo => 0 }; -NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar" } ] }, $needed); +NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] }, $needed); is_deeply($needed, { pull_foo => 1, print_foo => 1, push_foo => 1, pull_bar => 1, push_bar => 1, print_bar => 1}); @@ -216,7 +216,7 @@ is_deeply($needed, { pull_bla => 1, print_bla => 1, push_bla => 1 }); $needed = {}; NeededTypedef({ PROPERTIES => { public => 1 }, NAME => "bla", DATA => { TYPE => "STRUCT", - ELEMENTS => [ { TYPE => "bar" } ] } }, + ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } }, $needed); is_deeply($needed, { pull_bla => 1, print_bla => 1, push_bla => 1, pull_bar => 1, print_bar => 1, push_bar => 1}); @@ -224,7 +224,25 @@ is_deeply($needed, { pull_bla => 1, print_bla => 1, push_bla => 1, $needed = {}; NeededTypedef({ PROPERTIES => { gensize => 1}, NAME => "bla", DATA => { TYPE => "STRUCT", - ELEMENTS => [ { TYPE => "bar" } ] } }, + ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } }, $needed); is_deeply($needed, { ndr_size_bla => 1 }); +# make sure types for elements are set too +$needed = { pull_bla => 1 }; +NeededTypedef({ NAME => "bla", + DATA => { TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } }, + $needed); +is_deeply($needed, { pull_bla => 1, pull_bar => 1 }); + +$needed = {}; +NeededTypedef({ PROPERTIES => { public => 1}, + NAME => "bla", + DATA => { TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "rep" } ] } }, + $needed); +is_deeply($needed, { pull_bla => 1, push_bla => 1, print_bla => 1, print_rep => 1, + pull_bar => 1, push_bar => 1, + ndr_bar_to_rep => 1, ndr_rep_to_bar => 1}); + |