summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-17 09:57:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-17 09:57:12 +0000
commit682f161d636a1519ad6d8308a93ca35e37ab3cee (patch)
tree73cd992d71666aaf470895f27d5b95b3a9b0f996 /test
parentbcc1e704a67722dfcbc3c080f8f2c96db9ed7ce3 (diff)
* test/ostruct/test_ostruct.rb (test_frozen): added assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ostruct/test_ostruct.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 4d56102462..5c140a46ee 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -41,7 +41,11 @@ EOT
assert_equal("#<OpenStruct>", foo.inspect)
foo.bar = 1
foo.baz = 2
- assert_equal("#<OpenStruct bar=1, baz=2>", foo.inspect)
+ foo.foo = 0
+ assert_match(/\A#<OpenStruct (?:(?:foo=0|bar=1|baz=2)(?:, (?!>))?)+>\z/, foo.inspect)
+ assert_match(/ foo=0(?:, |>\z)/, foo.inspect)
+ assert_match(/ bar=1(?:, |>\z)/, foo.inspect)
+ assert_match(/ baz=2(?:, |>\z)/, foo.inspect)
foo = OpenStruct.new
foo.bar = OpenStruct.new
@@ -56,5 +60,7 @@ EOT
o.freeze
assert_raise(TypeError) {o.b = 'b'}
assert_not_respond_to(o, :b)
+ assert_raise(TypeError) {o.a = 'z'}
+ assert_equal('a', o.a)
end
end