summaryrefslogtreecommitdiff
path: root/source4/pidl/tests
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-xsource4/pidl/tests/ndr_string.pl31
1 files changed, 30 insertions, 1 deletions
diff --git a/source4/pidl/tests/ndr_string.pl b/source4/pidl/tests/ndr_string.pl
index e8e37be8c1..00ccbb31bb 100755
--- a/source4/pidl/tests/ndr_string.pl
+++ b/source4/pidl/tests/ndr_string.pl
@@ -4,7 +4,7 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 2 * 8;
+use Test::More tests => 3 * 8;
use FindBin qw($RealBin);
use lib "$RealBin/../lib";
use lib "$RealBin";
@@ -53,3 +53,32 @@ test_samba4_ndr("string-ascii-pull",
if (r.in.data[4] != 0)
return 4;
');
+
+test_samba4_ndr("string-out",
+'
+ [public] void TestString([out,string] uint8 **data);
+',
+'
+ uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
+ \'f\', \'o\', \'o\', 0 };
+ DATA_BLOB b = { data, 8 };
+ struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
+ struct TestString r;
+ char *str = NULL;
+ r.out.data = &str;
+
+ if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
+ return 1;
+
+ if (r.out.data == NULL)
+ return 2;
+
+ if (*r.out.data == NULL)
+ return 3;
+
+ if (strncmp(r.out.data, "foo", 3) != 0)
+ return 3;
+
+ if (r.in.data[4] != 0)
+ return 4;
+');