summaryrefslogtreecommitdiffstats
path: root/pidl/tests/tdr.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:47:29 +0000
commit4f5791ebd03eaec1c7da0865a383175b05102712 (patch)
tree8ce7b00f7a76baa386372422adebbe64510812d4 /pidl/tests/tdr.pl
parentInitial commit. (diff)
downloadsamba-4f5791ebd03eaec1c7da0865a383175b05102712.tar.xz
samba-4f5791ebd03eaec1c7da0865a383175b05102712.zip
Adding upstream version 2:4.17.12+dfsg.upstream/2%4.17.12+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pidl/tests/tdr.pl')
-rwxr-xr-xpidl/tests/tdr.pl49
1 files changed, 49 insertions, 0 deletions
diff --git a/pidl/tests/tdr.pl b/pidl/tests/tdr.pl
new file mode 100755
index 0000000..41a560c
--- /dev/null
+++ b/pidl/tests/tdr.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Samba4::TDR qw(ParserType);
+
+my $tdr = new Parse::Pidl::Samba4::TDR();
+
+$tdr->ParserType({TYPE => "STRUCT", NAME => "foo", PROPERTIES => {public => 1}}, "pull");
+is($tdr->{res}, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v)
+{
+ return NT_STATUS_OK;
+}
+
+");
+is($tdr->{res_hdr}, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v);\n");
+
+
+$tdr = new Parse::Pidl::Samba4::TDR();
+$tdr->ParserType({TYPE => "UNION", NAME => "bar", PROPERTIES => {public => 1}}, "pull");
+is($tdr->{res}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v)
+{
+ switch (level) {
+ }
+ return NT_STATUS_OK;
+
+}
+
+");
+is($tdr->{res_hdr}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v);\n");
+
+$tdr = new Parse::Pidl::Samba4::TDR();
+$tdr->ParserType({TYPE => "UNION", NAME => "bar", PROPERTIES => {}}, "pull");
+is($tdr->{res}, "static NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v)
+{
+ switch (level) {
+ }
+ return NT_STATUS_OK;
+
+}
+
+");
+is($tdr->{res_hdr}, "");