diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-21 12:35:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:43 -0500 |
commit | b76461f425fbfe425a7c0773626f53e394b48386 (patch) | |
tree | 37767f57cd126e7dc5c391660575f19c16e7f708 /source4/pidl/tests | |
parent | 19afd524443f9ebc0f986d6e8bf6874b477ac176 (diff) | |
download | samba-b76461f425fbfe425a7c0773626f53e394b48386.tar.gz samba-b76461f425fbfe425a7c0773626f53e394b48386.tar.bz2 samba-b76461f425fbfe425a7c0773626f53e394b48386.zip |
r21490: Add some tests for the EJS code
More work on supporting nested types in EJS.
(This used to be commit cb7faeab88952b59add1c814e1881ee9bb88b7ec)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-x | source4/pidl/tests/samba-ejs.pl | 42 |
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, ""); |