summaryrefslogtreecommitdiff
path: root/test/soap
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-19 13:59:27 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-19 13:59:27 +0000
commitc1e9ce9ca6d888cc18d945c916db4f4acd685d6b (patch)
tree209c33fb227b88fc0dcf17a72beb292fb286e203 /test/soap
parenta15cdb751223ba152ad73b4d39dbc30331c6168c (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@5220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/soap')
-rw-r--r--test/soap/test_property.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/soap/test_property.rb b/test/soap/test_property.rb
index d7d6c2e..f883d0c 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