pidl: add copy of pidl to 3-3-test in order to regenerate librpc code.
[Samba/gbeck.git] / source / pidl / tests / samba-ejs.pl
blob094d37a103b5babf41cb42663916652be113d733
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 => 10;
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(check_null_pointer
13 fn_declare TypeFunctionName);
15 my $ejs = new Parse::Pidl::Samba4::EJS();
17 $ejs->check_null_pointer("bla");
18 is($ejs->{res}, "");
20 $ejs = new Parse::Pidl::Samba4::EJS();
21 $ejs->check_null_pointer("*bla");
22 is($ejs->{res}, "if (bla == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;\n");
24 $ejs = new Parse::Pidl::Samba4::EJS();
25 $ejs->fn_declare({ PROPERTIES => { public => 1 } }, "myproto(int x)");
26 is($ejs->{res}, "_PUBLIC_ myproto(int x)\n");
27 is($ejs->{res_hdr}, "myproto(int x);\n");
29 $ejs = new Parse::Pidl::Samba4::EJS();
30 $ejs->fn_declare({ PROPERTIES => {} }, "mybla(int foo)");
31 is($ejs->{res}, "static mybla(int foo)\n");
32 is($ejs->{res_hdr}, "");
34 is(TypeFunctionName("ejs_pull", "uint32"), "ejs_pull_uint32");
35 is(TypeFunctionName("ejs_pull", {TYPE => "ENUM", NAME => "bar"}), "ejs_pull_ENUM_bar");
36 is(TypeFunctionName("ejs_pull", {TYPE => "TYPEDEF", NAME => "bar", DATA => undef}), "ejs_pull_bar");
37 is(TypeFunctionName("ejs_push", {TYPE => "STRUCT", NAME => "bar"}), "ejs_push_STRUCT_bar");