[Libguestfs] [PATCH 3/3] ruby: Add test for "special" keys and values
Richard W.M. Jones
rjones at redhat.com
Mon Jan 13 13:25:40 UTC 2014
On Mon, Jan 13, 2014 at 01:07:13PM +0100, Hilko Bengen wrote:
> ---
> 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
ACK to all three of these ruby patches.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
More information about the Libguestfs
mailing list