summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-30 08:16:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-30 08:16:20 +0000
commit09adba0dc177f2dd09da8ebb93f2f521200c67cb (patch)
tree2b243d298fb15481f5547a7406ace21de16b45fb /test/-ext-
parent6be21c1de0162fe39efe1f6850ad94a7fc6696c1 (diff)
sprintf.c: QUOTE flag
* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-')
-rw-r--r--test/-ext-/test_printf.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/-ext-/test_printf.rb b/test/-ext-/test_printf.rb
index 29f384b..4532c37 100644
--- a/test/-ext-/test_printf.rb
+++ b/test/-ext-/test_printf.rb
@@ -22,6 +22,12 @@ class Test_SPrintf < Test::Unit::TestCase
assert_equal("{<#{self.class}:#{object_id}>}", Bug::Printf.v(self))
end
+ def test_quote
+ assert_equal('["\n"]', Bug::Printf.q("\n"))
+ assert_equal('[aaa]', Bug::Printf.q('aaa'))
+ assert_equal('[a a]', Bug::Printf.q('a a'))
+ end
+
def test_encoding
def self.to_s
"\u{3042 3044 3046 3048 304a}"