diff options
Diffstat (limited to 'source4/pidl/tests/samba-ejs.pl')
-rwxr-xr-x | source4/pidl/tests/samba-ejs.pl | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/source4/pidl/tests/samba-ejs.pl b/source4/pidl/tests/samba-ejs.pl index 39fc22329c..adc00e224f 100755 --- a/source4/pidl/tests/samba-ejs.pl +++ b/source4/pidl/tests/samba-ejs.pl @@ -10,7 +10,7 @@ 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 TypeFunctionName); + fn_declare TypeFunctionName); is("&foo", get_pointer_to("foo")); is("&(&foo)", get_pointer_to(get_pointer_to("foo"))); @@ -21,25 +21,24 @@ 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, ""); +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"); |