Sha256: 815048c5882847ed8e8c6d03f02b3805ab20716f535565205c895ee98ca96d74
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require 'helper' class TestHana < Hana::TestCase def test_split_many pointer = Hana::Pointer.new '/foo/bar/baz' assert_equal %w{ foo bar baz }, pointer.to_a end def test_root pointer = Hana::Pointer.new '/' assert_equal [], pointer.to_a end def test_escape pointer = Hana::Pointer.new '/f^/oo/bar' assert_equal ['f/oo', 'bar'], pointer.to_a pointer = Hana::Pointer.new '/f^^oo/bar' assert_equal ['f^oo', 'bar'], pointer.to_a end def test_eval_hash pointer = Hana::Pointer.new '/foo' assert_equal 'bar', pointer.eval('foo' => 'bar') pointer = Hana::Pointer.new '/foo/bar' assert_equal 'baz', pointer.eval('foo' => { 'bar' => 'baz' }) end def test_eval_array pointer = Hana::Pointer.new '/foo/1' assert_equal 'baz', pointer.eval('foo' => ['bar', 'baz']) pointer = Hana::Pointer.new '/foo/0/bar' assert_equal 'omg', pointer.eval('foo' => [{'bar' => 'omg'}, 'baz']) end def test_eval_number_as_key pointer = Hana::Pointer.new '/foo/1' assert_equal 'baz', pointer.eval('foo' => { '1' => 'baz' }) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hana-1.0.1 | test/test_hana.rb |
hana-1.0.0 | test/test_hana.rb |