mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
bcc1e704a6
commit
682f161d63
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue