pidl: Add more parsing tests.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 12 Jan 2008 20:37:46 +0000 (21:37 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 12 Jan 2008 20:37:46 +0000 (21:37 +0100)
(This used to be commit e44ee3e60ac4eb56cca02b58fdecb171269daca4)

source4/pidl/tests/parse_idl.pl

index 96c7b2adc84de7868b40e88c8a286393fd8af992..d14c374740a87ac9259a73bb1fa1a68175f48620 100755 (executable)
@@ -4,7 +4,7 @@
 # Published under the GNU General Public License
 use strict;
 
-use Test::More tests => 65 * 2 + 3;
+use Test::More tests => 65 * 2 + 5;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util qw(test_errors);
@@ -129,4 +129,20 @@ is_deeply($x,
         [ { 'FILE' => '<quote>', 'DATA' => '"foobar"',
                 'TYPE' => 'CPP_QUOTE', 'LINE' => 0 } ]); 
 
+# A typedef of a struct without body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct x y; }", "<foo>");
 
+is_deeply($x, 
+        [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ 
+                { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => {
+                        TYPE => 'STRUCT', NAME => 'x' } } ], 
+                'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); 
+
+# A typedef of a struct with empty body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct {} y; }", "<foo>");
+
+is_deeply($x, 
+        [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ 
+                { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => {
+                        TYPE => 'STRUCT', ELEMENTS => [] } } ], 
+                'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);