Rev 11391: Add some tests for the header code. in file:///home/jelmer/bzr.samba/pidl-fixes/

Jelmer Vernooij jelmer at samba.org
Thu Feb 8 10:42:38 GMT 2007


At file:///home/jelmer/bzr.samba/pidl-fixes/

------------------------------------------------------------
revno: 11391
revision-id: jelmer at samba.org-20070208104200-7iq7uyqo7h7fohgk
parent: svn-v2:21222 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pidl-fixes
timestamp: Thu 2007-02-08 11:42:00 +0100
message:
  Add some tests for the header code.
added:
  source/pidl/tests/header.pl    header.pl-20070208094205-onb80lvoyh5ciw5r-1
modified:
  source/pidl/TODO               svn-v2:9459 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2fTODO
  source/pidl/lib/Parse/Pidl/Samba4/Header.pm svn-v2:12463 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fSamba4%2fHeader.pm
=== added file 'source/pidl/tests/header.pl'
--- a/source/pidl/tests/header.pl	1970-01-01 00:00:00 +0000
+++ b/source/pidl/tests/header.pl	2007-02-08 10:42:00 +0000
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer at samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::Samba4::Header;
+use Parse::Pidl::IDL qw(parse_string);
+
+sub parse_idl($)
+{
+	my $text = shift;
+	my $idl = Parse::Pidl::IDL::parse_string($text, "nofile");
+	return Parse::Pidl::Samba4::Header::Parse($idl);
+}
+
+is("/* header auto-generated by pidl */\n\n#include <core.h>\n\n", parse_idl(""), "includes work");
+is("/* header auto-generated by pidl */\n\n#include <core.h>\n\n", parse_idl("interface x {}"), "simple empty interface doesn't cause overhead");
+like(parse_idl("interface p { typedef struct { int y; } x; };"),
+     qr/.*#ifndef _HEADER_p\n#define _HEADER_p\n.+\n#endif \/\* _HEADER_p \*\/.*/ms, "ifdefs are created");
+like(parse_idl("interface p { typedef struct { int y; } x; };"),
+     qr/struct x.*{.*int32_t y;.*}.*;/sm, "interface member generated properly");
+like(parse_idl("interface x { void foo (void); };"),
+     qr/struct foo.*{\s+int _dummy_element;\s+};/sm, "void fn contains dummy element");
+like(parse_idl("interface x { void foo ([in] uint32 x); };"),
+     qr/struct foo.*{\s+struct\s+{\s+uint32_t x;\s+} in;\s+};/sm, "fn in arg works");
+like(parse_idl("interface x { void foo ([out] uint32 x); };"),
+     qr/struct foo.*{.*struct\s+{\s+uint32_t x;\s+} out;.*};/sm, "fn out arg works");
+like(parse_idl("interface x { void foo ([in,out] uint32 x); };"),
+     qr/struct foo.*{.*struct\s+{\s+uint32_t x;\s+} in;\s+struct\s+{\s+uint32_t x;\s+} out;.*};/sm, "fn in,out arg works");
+#like(parse_idl("interface x { void foo (uint32 x); };"), qr/struct foo.*{.*struct\s+{\s+uint32_t x;\s+} in;\s+struct\s+{\s+uint32_t x;\s+} out;.*};/sm, "fn with no props implies in,out");

=== modified file 'source/pidl/TODO'
--- a/source/pidl/TODO	2007-02-07 19:03:19 +0000
+++ b/source/pidl/TODO	2007-02-08 10:42:00 +0000
@@ -21,3 +21,8 @@
 - mem_ctx in the interface rather than as struct ndr member.
 
 - real typelibs
+
+- fix [in,out] handling and allocation for samba3:
+ - add inout
+ - make NULL to mean "allocate me"
+ - remove NDR_AUTO_REF_ALLOC flag

=== modified file 'source/pidl/lib/Parse/Pidl/Samba4/Header.pm'
--- a/source/pidl/lib/Parse/Pidl/Samba4/Header.pm	2007-01-22 00:04:59 +0000
+++ b/source/pidl/lib/Parse/Pidl/Samba4/Header.pm	2007-02-08 10:42:00 +0000
@@ -9,7 +9,6 @@
 use strict;
 use Parse::Pidl::Typelist qw(mapType);
 use Parse::Pidl::Util qw(has_property is_constant);
-use Parse::Pidl::NDR qw(GetNextLevel GetPrevLevel);
 use Parse::Pidl::Samba4 qw(is_intree);
 
 use vars qw($VERSION);



More information about the samba-cvs mailing list