2007-02-18 18:44:56 +00:00
#!/usr/bin/perl
# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU General Public License
use strict ;
use warnings ;
use Test::More tests = > 6 ;
use FindBin qw( $RealBin ) ;
use lib "$RealBin" ;
use Util ;
2007-04-22 10:42:33 +00:00
use Parse::Pidl::Samba4::TDR qw( ParserType ) ;
2007-02-18 18:44:56 +00:00
2007-04-22 10:42:33 +00:00
my $ tdr = new Parse::Pidl::Samba4:: TDR ( ) ;
$ tdr - > ParserType ( { TYPE = > "STRUCT" , NAME = > "foo" , PROPERTIES = > { public = > 1 } } , "pull" ) ;
2019-12-01 17:43:20 +13:00
is ( $ tdr - > { res } , " NTSTATUS tdr_pull_foo ( struct tdr_pull * tdr , TALLOC_CTX * mem_ctx , struct foo * v )
2007-02-18 18:44:56 +00:00
{
return NT_STATUS_OK ;
}
" ) ;
2019-12-01 17:43:20 +13:00
is ( $ tdr - > { res_hdr } , "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v);\n" ) ;
2007-02-18 18:44:56 +00:00
2007-04-22 10:42:33 +00:00
$ tdr = new Parse::Pidl::Samba4:: TDR ( ) ;
$ tdr - > ParserType ( { TYPE = > "UNION" , NAME = > "bar" , PROPERTIES = > { public = > 1 } } , "pull" ) ;
2019-12-01 17:43:20 +13:00
is ( $ tdr - > { res } , " NTSTATUS tdr_pull_bar ( struct tdr_pull * tdr , TALLOC_CTX * mem_ctx , int level , union bar * v )
2007-02-18 18:44:56 +00:00
{
switch ( level ) {
}
return NT_STATUS_OK ;
}
" ) ;
2019-12-01 17:43:20 +13:00
is ( $ tdr - > { res_hdr } , "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v);\n" ) ;
2007-02-18 18:44:56 +00:00
2007-04-22 10:42:33 +00:00
$ tdr = new Parse::Pidl::Samba4:: TDR ( ) ;
$ tdr - > ParserType ( { TYPE = > "UNION" , NAME = > "bar" , PROPERTIES = > { } } , "pull" ) ;
2019-12-01 17:43:20 +13:00
is ( $ tdr - > { res } , " static NTSTATUS tdr_pull_bar ( struct tdr_pull * tdr , TALLOC_CTX * mem_ctx , int level , union bar * v )
2007-02-18 18:44:56 +00:00
{
switch ( level ) {
}
return NT_STATUS_OK ;
}
" ) ;
2019-12-01 17:43:20 +13:00
is ( $ tdr - > { res_hdr } , "" ) ;