From 665b06ec5bf747c13ff7c5fa9b003d5ca2540709 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 15 Aug 2012 07:26:55 +0000 Subject: sprintf.c: infect * sprintf.c (ruby__sfvextra): the result should be infected by the given strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/-ext-/test_printf.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/-ext-/test_printf.rb b/test/-ext-/test_printf.rb index fc4e065345..4c4001654a 100644 --- a/test/-ext-/test_printf.rb +++ b/test/-ext-/test_printf.rb @@ -28,4 +28,26 @@ class Test_SPrintf < Test::Unit::TestCase end assert_equal("<\u{3042 3044 3046 3048 304a}>", Bug::Printf.s(self)) end + + def test_taint + def self.to_s + super.taint + end + assert_equal({to_s: true, inspect: true}, + { + to_s: Bug::Printf.s(self).tainted?, + inspect: Bug::Printf.v(self).tainted?, + }) + end + + def test_trust + def self.to_s + super.untrust + end + assert_equal({to_s: true, inspect: true}, + { + to_s: Bug::Printf.s(self).untrusted?, + inspect: Bug::Printf.v(self).untrusted?, + }) + end end -- cgit v1.2.3