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

Hilko Bengen bengen at hilluzination.de
Mon Jan 13 12:07:13 UTC 2014


---
 ruby/tests/tc_130_special.rb | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 ruby/tests/tc_130_special.rb

diff --git a/ruby/tests/tc_130_special.rb b/ruby/tests/tc_130_special.rb
new file mode 100644
index 0000000..0623f4d
--- /dev/null
+++ b/ruby/tests/tc_130_special.rb
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# -*- ruby -*-
+
+require 'test/unit'
+require 'hivex'
+
+class TestRLenValue < Test::Unit::TestCase
+  def test_RLenValue
+    h = Hivex::open(File::join(ENV['abs_srcdir'], '..', 'images', 'special'), {})
+    assert_not_nil(h)
+
+    root = h.root()
+    assert_not_nil(root)
+
+    nodes = h.node_children (root)
+    node = nodes.find { |n| h.node_name(n) == "abcd_äöüß" }
+    assert node != nil
+    value = h.node_values(node).find { |v| h.value_key(v) == "abcd_äöüß" }
+    assert value != nil
+    node = nodes.find { |n| h.node_name(n) == "zero\0key" }
+    assert node != nil
+    value = h.node_values(node).find { |v| h.value_key(v) == "zero\0val" }
+    assert value != nil
+    node = nodes.find { |n| h.node_name(n) == "weird™" }
+    assert node != nil
+    value = h.node_values(node).find { |v| h.value_key(v) == "symbols $£₤₧€" }
+    assert value != nil
+
+  end
+end
-- 
1.8.5.2




More information about the Libguestfs mailing list