summaryrefslogtreecommitdiff
path: root/source4/pidl/tests/samba-ejs.pl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/tests/samba-ejs.pl')
-rwxr-xr-xsource4/pidl/tests/samba-ejs.pl42
1 files changed, 42 insertions, 0 deletions
diff --git a/source4/pidl/tests/samba-ejs.pl b/source4/pidl/tests/samba-ejs.pl
new file mode 100755
index 0000000000..350cba571c
--- /dev/null
+++ b/source4/pidl/tests/samba-ejs.pl
@@ -0,0 +1,42 @@
+#!/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 => 13;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::Samba4::EJS qw(get_pointer_to get_value_of check_null_pointer
+ $res $res_hdr fn_declare);
+
+is("&foo", get_pointer_to("foo"));
+is("&(&foo)", get_pointer_to(get_pointer_to("foo")));
+is("*foo", get_pointer_to("**foo"));
+is("foo", get_pointer_to("*foo"));
+
+is("foo", get_value_of("&foo"));
+is("*foo", get_value_of("foo"));
+is("**foo", get_value_of("*foo"));
+
+$res = "";
+check_null_pointer("bla");
+is($res, "");
+
+$res = "";
+check_null_pointer("*bla");
+is($res, "if (bla == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;\n");
+
+$res = "";
+$res_hdr = "";
+fn_declare({ PROPERTIES => { public => 1 } }, "myproto(int x)");
+is($res, "_PUBLIC_ myproto(int x)\n");
+is($res_hdr, "myproto(int x);\n");
+
+$res = "";
+$res_hdr = "";
+fn_declare({ PROPERTIES => {} }, "mybla(int foo)");
+is($res, "static mybla(int foo)\n");
+is($res_hdr, "");