summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-25 08:41:36 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-25 08:41:36 +0000
commit45c322bfdb3f6d38a006aef9ce3e4654db9bc8ed (patch)
tree8d5cd2782c02e62d371e437e3d9c083902de1ee3 /test
parentc3d27c35fef49e70603fdf532fee51d1cd75f650 (diff)
merge revision(s) 22372:
* test/ostruct/test_ostruct.rb (test_frozen): added assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@25917 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