diff options
| author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-19 13:59:27 +0000 |
|---|---|---|
| committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-19 13:59:27 +0000 |
| commit | 40092cb83be935b369a4d45bf31f8feac83ca0f1 (patch) | |
| tree | 209c33fb227b88fc0dcf17a72beb292fb286e203 /test | |
| parent | 03e97f68c6eea84080263c139add33abd2c5567d (diff) | |
| download | ruby-40092cb83be935b369a4d45bf31f8feac83ca0f1.tar.gz ruby-40092cb83be935b369a4d45bf31f8feac83ca0f1.tar.xz ruby-40092cb83be935b369a4d45bf31f8feac83ca0f1.zip | |
* lib/soap/property.rb (SOAP::Property#load): new method for loading
property value into existing property tree.
* test/soap/test_property.rb: add test.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/soap/test_property.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/soap/test_property.rb b/test/soap/test_property.rb index d7d6c2edf..f883d0c2d 100644 --- a/test/soap/test_property.rb +++ b/test/soap/test_property.rb @@ -32,6 +32,14 @@ client.protocol.http.protocol_version = 1.0 foo\\:bar\\=baz = qux foo\\\\.bar.baz=\tq\\\\ux\ttab a\\ b = 1 +[ppp.qqq.rrr] +sss = 3 +ttt.uuu = 4 + +[ sss.ttt.uuu ] +vvv.www = 5 +[ ] +xxx.yyy.zzz = 6 __EOP__ prop = Property.load(propstr) assert_equal(["1", "2", "3"], prop["a.b"].values.sort) @@ -41,8 +49,38 @@ __EOP__ assert_equal("1.0", prop["client.protocol.http.protocol_version"]) assert_equal("q\\ux\ttab", prop['foo\.bar.baz']) assert_equal("1", prop['a b']) + assert_equal("3", prop['ppp.qqq.rrr.sss']) + assert_equal("4", prop['ppp.qqq.rrr.ttt.uuu']) + assert_equal("5", prop['sss.ttt.uuu.vvv.www']) + assert_equal("6", prop['xxx.yyy.zzz']) end + def test_load + prop = Property.new + hooked = false + prop.add_hook("foo.bar.baz") do |name, value| + assert_equal("foo.bar.baz", name) + assert_equal("123", value) + hooked = true + end + prop.lock + prop["foo.bar"].lock + prop.load("foo.bar.baz = 123") + assert(hooked) + assert_raises(TypeError) do + prop.load("foo.bar.qux = 123") + end + prop.load("foo.baz = 456") + assert_equal("456", prop["foo.baz"]) + end + + def test_initialize + prop = ::SOAP::Property.new + # store is empty + assert_nil(prop["a"]) + # does hook work? + assert_equal(1, prop["a"] = 1) + end def test_initialize prop = ::SOAP::Property.new # store is empty |
