summaryrefslogtreecommitdiff
path: root/pidl/tests/samba-ejs.pl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-21 14:51:13 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-21 14:51:13 +0200
commit5209a846a9157e649fcdcb561f7eaf19c8c0e465 (patch)
treeb0a7e52b5646c8eec182dbc391e7934b6804488c /pidl/tests/samba-ejs.pl
parent625359b2e266105022309df8985720108ecd6f67 (diff)
parent2ee8d29d22bcb1c350ab59d71b0aee548489bc9c (diff)
downloadsamba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.gz
samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.bz2
samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
Conflicts: source4/lib/registry/ldb.c source4/rpc_server/winreg/rpc_winreg.c
Diffstat (limited to 'pidl/tests/samba-ejs.pl')
-rwxr-xr-xpidl/tests/samba-ejs.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/pidl/tests/samba-ejs.pl b/pidl/tests/samba-ejs.pl
new file mode 100755
index 0000000000..094d37a103
--- /dev/null
+++ b/pidl/tests/samba-ejs.pl
@@ -0,0 +1,37 @@
+#!/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 => 10;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::Samba4::EJS qw(check_null_pointer
+ fn_declare TypeFunctionName);
+
+my $ejs = new Parse::Pidl::Samba4::EJS();
+
+$ejs->check_null_pointer("bla");
+is($ejs->{res}, "");
+
+$ejs = new Parse::Pidl::Samba4::EJS();
+$ejs->check_null_pointer("*bla");
+is($ejs->{res}, "if (bla == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;\n");
+
+$ejs = new Parse::Pidl::Samba4::EJS();
+$ejs->fn_declare({ PROPERTIES => { public => 1 } }, "myproto(int x)");
+is($ejs->{res}, "_PUBLIC_ myproto(int x)\n");
+is($ejs->{res_hdr}, "myproto(int x);\n");
+
+$ejs = new Parse::Pidl::Samba4::EJS();
+$ejs->fn_declare({ PROPERTIES => {} }, "mybla(int foo)");
+is($ejs->{res}, "static mybla(int foo)\n");
+is($ejs->{res_hdr}, "");
+
+is(TypeFunctionName("ejs_pull", "uint32"), "ejs_pull_uint32");
+is(TypeFunctionName("ejs_pull", {TYPE => "ENUM", NAME => "bar"}), "ejs_pull_ENUM_bar");
+is(TypeFunctionName("ejs_pull", {TYPE => "TYPEDEF", NAME => "bar", DATA => undef}), "ejs_pull_bar");
+is(TypeFunctionName("ejs_push", {TYPE => "STRUCT", NAME => "bar"}), "ejs_push_STRUCT_bar");