summaryrefslogtreecommitdiff
path: root/source4/pidl/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-14 12:44:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:14 -0500
commite50dc79226bcb722485019533033500b0e145a46 (patch)
treeed0e6cc065511b73936ceaa418726f6549c6d816 /source4/pidl/tests
parent86c5fe1990361ef35ebf1d71226ee0a63af9e999 (diff)
downloadsamba-e50dc79226bcb722485019533033500b0e145a46.tar.gz
samba-e50dc79226bcb722485019533033500b0e145a46.tar.bz2
samba-e50dc79226bcb722485019533033500b0e145a46.zip
r21332: Fix bug in pidl that prevented value(0) from working. Bug reported by metze.
(This used to be commit 8212a3b8e0d3d59264f659c3f657b165ececefeb)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-xsource4/pidl/tests/samba-ndr.pl24
1 files changed, 22 insertions, 2 deletions
diff --git a/source4/pidl/tests/samba-ndr.pl b/source4/pidl/tests/samba-ndr.pl
index a6d74beea9..db261d4492 100755
--- a/source4/pidl/tests/samba-ndr.pl
+++ b/source4/pidl/tests/samba-ndr.pl
@@ -4,12 +4,12 @@
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 20;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer GenerateFunctionInEnv GenerateFunctionOutEnv);
+use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer GenerateFunctionInEnv GenerateFunctionOutEnv GenerateStructEnv EnvSubstituteValue);
my $output;
sub print_fn($) { my $x = shift; $output.=$x; }
@@ -152,3 +152,23 @@ is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionOutEnv($fn));
$fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] };
is_deeply({ }, GenerateFunctionInEnv($fn));
+
+$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
+is_deeply({ foo => "r->foo", bar => "r->bar", this => "r" }, GenerateStructEnv($fn));
+
+$fn = { ELEMENTS => [ { NAME => "foo", PROPERTIES => { value => 3 }} ] };
+
+my $env = GenerateStructEnv($fn);
+EnvSubstituteValue($env, $fn);
+is_deeply($env, { foo => 3, this => "r" });
+
+$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
+$env = GenerateStructEnv($fn);
+EnvSubstituteValue($env, $fn);
+is_deeply($env, { foo => 'r->foo', bar => 'r->bar', this => "r" });
+
+$fn = { ELEMENTS => [ { NAME => "foo", PROPERTIES => { value => 0 }} ] };
+
+$env = GenerateStructEnv($fn);
+EnvSubstituteValue($env, $fn);
+is_deeply($env, { foo => 0, this => "r" });