test/test_string.rb in gettext-3.2.9 vs test/test_string.rb in gettext-3.3.0
- old
+ new
@@ -1,9 +1,9 @@
-# -*- coding: utf-8 -*-
-
class TestGetTextString < Test::Unit::TestCase
class TestFormat < self
+ include GetTextTestUtils
+
def test_basic
assert_equal("foo is a number", "%{msg} is a number" % {:msg => "foo"})
assert_equal("bar is a number", "%s is a number" % ["bar"])
assert_equal("bar is a number", "%s is a number" % "bar")
assert_equal("1, test", "%{num}, %{record}" % {:num => 1, :record => "test"})
@@ -20,19 +20,23 @@
assert_equal("a { b }", "%{foo+foo} { %{bar bar-} }" % {"foo+foo".to_sym => "a", "bar bar-".to_sym => "b"})
end
def test_percent
assert_equal("% 1", "%% %<num>d" % {:num => 1.0})
- assert_equal("%{num} %<num>d", "%%{num} %%<num>d" % {:num => 1})
+ suppress_warning do
+ assert_equal("%{num} %<num>d", "%%{num} %%<num>d" % {:num => 1})
+ end
end
def test_percent_in_replacement
assert_equal("%<not_translated>s", "%{msg}" % { :msg => '%<not_translated>s', :not_translated => 'should not happen' })
end
def test_no_placeholder
- assert_equal("aaa", "aaa" % {:num => 1})
- assert_equal("bbb", "bbb" % [1])
+ suppress_warning do
+ assert_equal("aaa", "aaa" % {:num => 1})
+ assert_equal("bbb", "bbb" % [1])
+ end
end
def test_ruby19_style
assert_equal("1", "%<num>d" % {:num => 1})
assert_equal("0b1", "%<num>#b" % {:num => 1})