test/test_string.rb in gettext-2.0.4 vs test/test_string.rb in gettext-2.1.0

- old
+ new

@@ -10,10 +10,17 @@ assert_equal("1, test", "%d, %s" % [1, "test"]) assert_equal("test, 1", "%2$s, %1$d" % [1, "test"]) assert_raise(ArgumentError) { "%-%" % [1] } end + def test_sprintf_placeholder_include_non_english + assert_equal("a", "%{foo+foo}" % {"foo+foo".to_sym => "a"}) + assert_equal("a", "%{foo.foo}" % {"foo.foo".to_sym => "a"}) + assert_equal("a }", "%{foo+foo} }" % {"foo+foo".to_sym => "a"}) + 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}) end @@ -37,9 +44,10 @@ assert_equal("foo", "%<msg>s" % {:msg => "foo"}) assert_equal("1.000000", "%<num>f" % {:num => 1.0}) assert_equal(" 1", "%<num>3.0f" % {:num => 1.0}) assert_equal("100.00", "%<num>2.2f" % {:num => 100.0}) assert_equal("0x64", "%<num>#x" % {:num => 100.0}) + assert_equal("a", "%<foo.foo>s" % {"foo.foo".to_sym => "a"}) assert_raise(ArgumentError) { "%<num>,d" % {:num => 100} } assert_raise(ArgumentError) { "%<num>/d" % {:num => 100} } end def test_sprintf_old_style