ruby-changes:24661
From: nobu <ko1@a...>
Date: Thu, 16 Aug 2012 11:52:19 +0900 (JST)
Subject: [ruby-changes:24661] nobu:r36712 (trunk): test_printf.rb: need to be infected
nobu 2012-08-16 11:52:09 +0900 (Thu, 16 Aug 2012) New Revision: 36712 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36712 Log: test_printf.rb: need to be infected * test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use plain object so that the results of to_s and inspect are infected. [ruby-dev:46053] [Bug #6881] Modified files: trunk/ChangeLog trunk/test/-ext-/test_printf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36711) +++ ChangeLog (revision 36712) @@ -1,3 +1,9 @@ +Thu Aug 16 11:52:06 2012 Nobuyoshi Nakada <nobu@r...> + + * test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use + plain object so that the results of to_s and inspect are infected. + [ruby-dev:46053] [Bug #6881] + Thu Aug 16 09:46:07 2012 Nobuyoshi Nakada <nobu@r...> * strftime.c: remove unnecessary macros to check traditional C. Index: test/-ext-/test_printf.rb =================================================================== --- test/-ext-/test_printf.rb (revision 36711) +++ test/-ext-/test_printf.rb (revision 36712) @@ -30,24 +30,20 @@ end def test_taint - def self.to_s - super.taint - end + obj = Object.new.taint assert_equal({to_s: true, inspect: true}, { - to_s: Bug::Printf.s(self).tainted?, - inspect: Bug::Printf.v(self).tainted?, + to_s: Bug::Printf.s(obj).tainted?, + inspect: Bug::Printf.v(obj).tainted?, }) end - def test_trust - def self.to_s - super.untrust - end + def test_untrust + obj = Object.new.untrust assert_equal({to_s: true, inspect: true}, { - to_s: Bug::Printf.s(self).untrusted?, - inspect: Bug::Printf.v(self).untrusted?, + to_s: Bug::Printf.s(obj).untrusted?, + inspect: Bug::Printf.v(obj).untrusted?, }) end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/