diff options
Diffstat (limited to 'source4/pidl/tests/Util.pm')
-rw-r--r-- | source4/pidl/tests/Util.pm | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/source4/pidl/tests/Util.pm b/source4/pidl/tests/Util.pm index d8ae30f3c3..fdd3c421f6 100644 --- a/source4/pidl/tests/Util.pm +++ b/source4/pidl/tests/Util.pm @@ -6,10 +6,28 @@ package Util; require Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(test_samba4_ndr); +@EXPORT = qw(test_samba4_ndr test_warnings test_errors); use strict; +use FindBin qw($RealBin); +use lib "$RealBin/../lib"; + +use Parse::Pidl; +my $warnings = ""; +sub Parse::Pidl::warning($$) +{ + my ($e, $l) = @_; + $warnings .= "$e->{FILE}:$e->{LINE}: $l\n"; +}; + +my $errors = ""; +sub Parse::Pidl::error($$) +{ + my ($e, $l) = @_; + $errors .= "$e->{FILE}:$e->{LINE}: $l\n"; +}; + use Test::More; use Parse::Pidl::IDL; use Parse::Pidl::NDR; @@ -84,4 +102,25 @@ SKIP: { } } +sub test_warnings($$) +{ + my ($exp, $code) = @_; + + $warnings = ""; + + $code->(); + + is($warnings, $exp); +} + + +sub test_errors($$) +{ + my ($exp, $code) = @_; + $errors = ""; + $code->(); + + is($errors, $exp); +} + 1; |