summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm2
-rwxr-xr-xsource4/pidl/tests/wireshark-conf.pl38
2 files changed, 37 insertions, 3 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
index 9798c7c552..44eb77f836 100644
--- a/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
+++ b/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
@@ -96,7 +96,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
-@EXPORT_OK = qw(ReadConformance ReadConformanceFH);
+@EXPORT_OK = qw(ReadConformance ReadConformanceFH valid_ft_type valid_base_type);
use strict;
diff --git a/source4/pidl/tests/wireshark-conf.pl b/source4/pidl/tests/wireshark-conf.pl
index 8601a91ed9..0e6e1e78ac 100755
--- a/source4/pidl/tests/wireshark-conf.pl
+++ b/source4/pidl/tests/wireshark-conf.pl
@@ -5,12 +5,12 @@
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More tests => 34;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Wireshark::Conformance qw(ReadConformanceFH);
+use Parse::Pidl::Wireshark::Conformance qw(ReadConformanceFH valid_ft_type valid_base_type);
sub parse_conf($)
{
@@ -60,3 +60,37 @@ is_deeply(parse_conf("CODE START\ndata\nCODE END\n"), { override => "data\n" });
is_deeply(parse_conf("CODE START\ndata\nmore data\nCODE END\n"), { override => "data\nmore data\n" });
test_warnings("nofile:1: Unknown command `CODE'\n",
sub { parse_conf("CODE END\n"); } );
+
+is_deeply(parse_conf("TYPE winreg_String dissect_myminregstring FT_STRING BASE_DEC 0 0 2\n"), { types => { winreg_String => {
+ NAME => "winreg_String",
+ POS => { FILE => "nofile", LINE => 1 },
+ USED => 0,
+ DISSECTOR_NAME => "dissect_myminregstring",
+ FT_TYPE => "FT_STRING",
+ BASE_TYPE => "BASE_DEC",
+ MASK => 0,
+ VALSSTRING => 0,
+ ALIGNMENT => 2}}});
+
+ok(valid_ft_type("FT_UINT32"));
+ok(not valid_ft_type("BLA"));
+ok(not valid_ft_type("ft_uint32"));
+ok(valid_ft_type("FT_BLA"));
+
+ok(valid_base_type("BASE_DEC"));
+ok(valid_base_type("BASE_HEX"));
+ok(not valid_base_type("base_dec"));
+ok(not valid_base_type("BLA"));
+ok(not valid_base_type("BASEDEC"));
+
+test_errors("nofile:1: incomplete TYPE command\n",
+ sub { parse_conf("TYPE mytype dissector\n"); });
+
+test_warnings("nofile:1: dissector name does not contain `dissect'\n",
+ sub { parse_conf("TYPE winreg_String myminregstring FT_STRING BASE_DEC 0 0 2\n"); });
+
+test_warnings("nofile:1: invalid FT_TYPE `BLA'\n",
+ sub { parse_conf("TYPE winreg_String dissect_myminregstring BLA BASE_DEC 0 0 2\n"); });
+
+test_warnings("nofile:1: invalid BASE_TYPE `BLOE'\n",
+ sub { parse_conf("TYPE winreg_String dissect_myminregstring FT_UINT32 BLOE 0 0 2\n"); });