[Libguestfs] [PATCH 3/7] perl: Add test for "special" keys and values

Hilko Bengen
Fri, 10 Jan 2014 23:12:48 -0000

---
 perl/t/130-special.t | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 perl/t/130-special.t

diff --git a/perl/t/130-special.t b/perl/t/130-special.t
new file mode 100644
index 0000000..c25af7e
--- /dev/null
+++ b/perl/t/130-special.t
@@ -0,0 +1,34 @@
+# hivex Perl bindings -*- perl -*-
+
+use strict;
+use warnings;
+use utf8::all; # so the strings in this file are interpreted correctly.
+use Test::More;
+
+use Win::Hivex;
+
+my $srcdir = $ENV{srcdir} || ".";
+my $h = Win::Hivex->open ("$srcdir/../images/special");
+ok $h, 'hive opened correctly';
+my $root = $h->root;
+ok $root, 'root node found';
+my ($node, $value);
+
+my @nodes = $h->node_children( $root );
+
+($node) = grep { $h->node_name($_) eq 'abcd_äöüß' } @nodes;
+ok $node, q<'abcd_äöüß' (node) has been found>;
+($value) = grep { $h->value_key($_) eq 'abcd_äöüß' }
$h->node_values($node);
+ok $value, q<'abcd_äöüß\abcd_äöüß' (value) has been found>;
+
+($node) = grep { $h->node_name($_) eq "zero\0key" } @nodes;
+ok $node, 'key has been found';
+($value) = grep { $h->value_key($_) eq "zero\0val" }
$h->node_values($node);
+ok $value, 'value has been found';
+
+($node) = grep { $h->node_name($_) eq 'weird™' } @nodes;
+ok $node, q<'weird™' (node) has been found>;
+($value) = grep { $h->value_key($_) eq 'symbols $£₤₧€' }
$h->node_values($node);
+ok $value, q<'weird™\symbols $£₤₧€' (value) has been found>;
+
+done_testing;
--
1.8.5.2