summaryrefslogtreecommitdiff
path: root/source4/pidl/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-28 13:25:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:00 -0500
commit5ba8169109253c96f71e0e039b1c0b7a1056eab0 (patch)
tree575fe0e0904e7596a5d1d02691fcdc733a28cd87 /source4/pidl/tests
parentc2003743256bc0312c5360821d501591039dafcd (diff)
downloadsamba-5ba8169109253c96f71e0e039b1c0b7a1056eab0.tar.gz
samba-5ba8169109253c96f71e0e039b1c0b7a1056eab0.tar.bz2
samba-5ba8169109253c96f71e0e039b1c0b7a1056eab0.zip
r21584: Support for tagged types has landed!
It's now possible to use "struct foo" without a typedef in IDL files. echo_info4 is the first type that's been converted. (This used to be commit 3ac68e858df9b53cf5e0a84741916214a53b3121)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-xsource4/pidl/tests/header.pl8
-rwxr-xr-xsource4/pidl/tests/ndr.pl7
-rwxr-xr-xsource4/pidl/tests/typelist.pl3
3 files changed, 14 insertions, 4 deletions
diff --git a/source4/pidl/tests/header.pl b/source4/pidl/tests/header.pl
index 3dae33ae6c..7092eb0d14 100755
--- a/source4/pidl/tests/header.pl
+++ b/source4/pidl/tests/header.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;
@@ -36,3 +36,9 @@ like(parse_idl("interface x { void foo ([in,out] uint32 x); };"),
like(parse_idl("interface x { void foo (uint32 x); };"), qr/struct foo.*{.*struct\s+{\s+uint32_t x;\s+} in;\s+struct\s+{\s+uint32_t x;\s+} out;.*};/sm, "fn with no props implies in,out");
like(parse_idl("interface p { struct x { int y; }; };"),
qr/struct x.*{.*int32_t y;.*}.*;/sm, "interface member generated properly");
+
+like(parse_idl("interface p { struct x { struct y z; }; };"),
+ qr/struct x.*{.*struct y z;.*}.*;/sm, "tagged type struct member");
+
+like(parse_idl("interface p { struct x { union y z; }; };"),
+ qr/struct x.*{.*union y z;.*}.*;/sm, "tagged type union member");
diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl
index 17003d59c4..8245f768e8 100755
--- a/source4/pidl/tests/ndr.pl
+++ b/source4/pidl/tests/ndr.pl
@@ -4,12 +4,12 @@
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More tests => 26;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type mapToScalar);
+use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type mapToScalar ParseType);
# Case 1
@@ -224,3 +224,6 @@ is(mapToScalar({TYPE => "ENUM", PARENT => { PROPERTIES => { enum8bit => 1 } } })
is(mapToScalar({TYPE => "BITMAP", PROPERTIES => { bitmap64bit => 1 } }),
"hyper");
is(mapToScalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM", PARENT => { PROPERTIES => { enum8bit => 1 } } }}), "uint8");
+
+is_deeply(ParseType({TYPE => "STRUCT", NAME => "foo" }, "ref"),
+ {TYPE => "STRUCT", NAME => "foo" });
diff --git a/source4/pidl/tests/typelist.pl b/source4/pidl/tests/typelist.pl
index 376bd208f0..c5c409a525 100755
--- a/source4/pidl/tests/typelist.pl
+++ b/source4/pidl/tests/typelist.pl
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 52;
+use Test::More tests => 53;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -60,6 +60,7 @@ is(1, is_scalar({TYPE => "DECLARE", DATA => {TYPE => "ENUM" }}));
is(1, scalar_is_reference("string"));
is(0, scalar_is_reference("uint32"));
+is(0, scalar_is_reference({TYPE => "STRUCT", NAME => "echo_foobar"}));
is("uint8", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {enum8bit => 1}}}));
is("uint32", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {v1_enum => 1}}}));