regedit: Fix syntax for deleting registry keys (RHBZ#737944).
[hivex.git] / perl / t / 560-regedit-import.t
index b0c5254..effb024 100644 (file)
@@ -18,7 +18,6 @@
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-use Encode qw(from_to);
 use IO::Scalar;
 
 use Test::More tests => 16;
 use IO::Scalar;
 
 use Test::More tests => 16;
@@ -55,7 +54,7 @@ $expected = '[\]
 
 [\C]
 "Key1"=hex(2):48,00,65,00,6c,00,6c,00,6f,00
 
 [\C]
 "Key1"=hex(2):48,00,65,00,6c,00,6c,00,6f,00
-"Key2"=hex(2):48,00,65,00,6c,00,6c,00,6f,00
+"Key2"=hex(2):48,00,65,00,6c,00,6c,00,6f,00,00,00
 "Key3"=hex(3):48,00,65,00,6c,00,6c,00,6f,00,48,00,65,00,6c,00,6c,00,6f,00
 "Key4"=dword:ff123456
 
 "Key3"=hex(3):48,00,65,00,6c,00,6c,00,6f,00,48,00,65,00,6c,00,6c,00,6f,00
 "Key4"=dword:ff123456
 
@@ -67,16 +66,16 @@ $data = '
 [\A]
 @="Hello"
 
 [\A]
 @="Hello"
 
--[\B]
+[-\B]
 ';
 $expected = '[\]
 
 [\A]
 ';
 $expected = '[\]
 
 [\A]
-@=hex(1):48,00,65,00,6c,00,6c,00,6f,00
+@=hex(1):48,00,65,00,6c,00,6c,00,6f,00,00,00
 
 [\C]
 "Key1"=hex(2):48,00,65,00,6c,00,6c,00,6f,00
 
 [\C]
 "Key1"=hex(2):48,00,65,00,6c,00,6c,00,6f,00
-"Key2"=hex(2):48,00,65,00,6c,00,6c,00,6f,00
+"Key2"=hex(2):48,00,65,00,6c,00,6c,00,6f,00,00,00
 "Key3"=hex(3):48,00,65,00,6c,00,6c,00,6f,00,48,00,65,00,6c,00,6c,00,6f,00
 "Key4"=dword:ff123456
 
 "Key3"=hex(3):48,00,65,00,6c,00,6c,00,6f,00,48,00,65,00,6c,00,6c,00,6f,00
 "Key4"=dword:ff123456
 
@@ -88,7 +87,7 @@ $data = '
 [\A]
 @=-
 
 [\A]
 @=-
 
--[\C]
+[-\C]
 
 [\A\B]
 ';
 
 [\A\B]
 ';
@@ -102,12 +101,18 @@ $expected = '[\]
 
 run_test ($data, $expected);
 
 
 run_test ($data, $expected);
 
+# In the next test, the value of ValueContainingEscapes in the
+# imported data is \\W\\, which will become \W\ in the final hive.
+# However Perl has complex and inconsistent rules on quoting
+# backslashes.  See:
+# http://en.wikibooks.org/wiki/Perl_Programming/Strings#Single_Quoted_Strings
 $data = '
 [\A]
 "NotExistant"=-
 
 [\A\B]
 "Key\"Containing\"Quotes"=hex(0):
 $data = '
 [\A]
 "NotExistant"=-
 
 [\A\B]
 "Key\"Containing\"Quotes"=hex(0):
+"ValueContainingEscapes"="\\\\W\\\\"
 ';
 $expected = '[\]
 
 ';
 $expected = '[\]
 
@@ -115,6 +120,7 @@ $expected = '[\]
 
 [\A\B]
 "Key\"Containing\"Quotes"=hex(0):
 
 [\A\B]
 "Key\"Containing\"Quotes"=hex(0):
+"ValueContainingEscapes"=hex(1):5c,00,57,00,5c,00,00,00
 
 ';
 
 
 ';
 
@@ -123,8 +129,9 @@ run_test ($data, $expected);
 $data = '
 [\A\B]
 "Key\"Containing\"Quotes"=-
 $data = '
 [\A\B]
 "Key\"Containing\"Quotes"=-
+"ValueContainingEscapes"=-
 
 
--[\A]
+[-\A]
 ';
 $expected = '[\]
 
 ';
 $expected = '[\]