r21490: Add some tests for the EJS code
[Samba/ekacnet.git] / source / pidl / tests / samba-ejs.pl
blob350cba571c019f0f3577e483ec7369b4afaa7759
1 #!/usr/bin/perl
2 # (C) 2007 Jelmer Vernooij <jelmer@samba.org>
3 # Published under the GNU General Public License
4 use strict;
5 use warnings;
7 use Test::More tests => 13;
8 use FindBin qw($RealBin);
9 use lib "$RealBin";
10 use Util;
11 use Parse::Pidl::Util qw(MyDumper);
12 use Parse::Pidl::Samba4::EJS qw(get_pointer_to get_value_of check_null_pointer
13 $res $res_hdr fn_declare);
15 is("&foo", get_pointer_to("foo"));
16 is("&(&foo)", get_pointer_to(get_pointer_to("foo")));
17 is("*foo", get_pointer_to("**foo"));
18 is("foo", get_pointer_to("*foo"));
20 is("foo", get_value_of("&foo"));
21 is("*foo", get_value_of("foo"));
22 is("**foo", get_value_of("*foo"));
24 $res = "";
25 check_null_pointer("bla");
26 is($res, "");
28 $res = "";
29 check_null_pointer("*bla");
30 is($res, "if (bla == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;\n");
32 $res = "";
33 $res_hdr = "";
34 fn_declare({ PROPERTIES => { public => 1 } }, "myproto(int x)");
35 is($res, "_PUBLIC_ myproto(int x)\n");
36 is($res_hdr, "myproto(int x);\n");
38 $res = "";
39 $res_hdr = "";
40 fn_declare({ PROPERTIES => {} }, "mybla(int foo)");
41 is($res, "static mybla(int foo)\n");
42 is($res_hdr, "");