ruby-changes:10804
From: nobu <ko1@a...>
Date: Tue, 17 Feb 2009 18:57:28 +0900 (JST)
Subject: [ruby-changes:10804] Ruby:r22372 (trunk, ruby_1_8): * test/ostruct/test_ostruct.rb (test_frozen): added assertions.
nobu 2009-02-17 18:57:12 +0900 (Tue, 17 Feb 2009) New Revision: 22372 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22372 Log: * test/ostruct/test_ostruct.rb (test_frozen): added assertions. Modified files: branches/ruby_1_8/test/ostruct/test_ostruct.rb trunk/test/ostruct/test_ostruct.rb Index: test/ostruct/test_ostruct.rb =================================================================== --- test/ostruct/test_ostruct.rb (revision 22371) +++ test/ostruct/test_ostruct.rb (revision 22372) @@ -41,5 +41,7 @@ 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 Index: ruby_1_8/test/ostruct/test_ostruct.rb =================================================================== --- ruby_1_8/test/ostruct/test_ostruct.rb (revision 22371) +++ ruby_1_8/test/ostruct/test_ostruct.rb (revision 22372) @@ -41,7 +41,11 @@ 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/