Sha256: c03f39c5ef6b1aec59c95add9254ea38e84da2b2ca923c8c06f92aa124f3a934

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

require 'testlib/helper.rb'

class TestGetTextString < Test::Unit::TestCase
  def test_string_sprintf
    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"})
    assert_equal("test, 1", "%{record}, %{num}" % {:num => 1, :record => "test"})
    assert_equal("1, test", "%d, %s" % [1, "test"])
    assert_equal("test, 1", "%2$s, %1$d" % [1, "test"])
    assert_raise(ArgumentError) { "%-%" % [1] }
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
grosser-gettext-2.0.0 test/test_string.rb
gettext-2.0.0 test/test_string.rb