Sha256: dd7366a97472092993461d3096bae6bade4206520bdb4f1f9b4393f7972b6056

Contents?: true

Size: 596 Bytes

Versions: 22

Compression:

Stored size: 596 Bytes

Contents

require 'test/unit'
require 'gettext'

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"])
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 test/gettext_test_string.rb
gettext-1.9.0-mswin32 test/gettext_test_string.rb
gettext-1.8.0-mswin32 test/gettext_test_string.rb
gettext-1.7.0-mswin32 test/gettext_test_string.rb
gettext-1.6.0-mswin32 test/gettext_test_string.rb
gettext-1.5.0-mswin32 test/gettext_test_string.rb
gettext-1.4.0-mswin32 test/gettext_test_string.rb
gettext-1.3.0-mswin32 test/gettext_test_string.rb
gettext-1.2.0-mswin32 test/gettext_test_string.rb
gettext-1.1.1-mswin32 test/gettext_test_string.rb
gettext-1.1.0-mswin32 test/gettext_test_string.rb
gettext-1.1.1 test/gettext_test_string.rb
gettext-1.10.0 test/gettext_test_string.rb
gettext-1.1.0 test/gettext_test_string.rb
gettext-1.2.0 test/gettext_test_string.rb
gettext-1.5.0 test/gettext_test_string.rb
gettext-1.3.0 test/gettext_test_string.rb
gettext-1.4.0 test/gettext_test_string.rb
gettext-1.8.0 test/gettext_test_string.rb
gettext-1.6.0 test/gettext_test_string.rb