test/test_i18n.rb in review-2.1.0 vs test/test_i18n.rb in review-2.2.0

- old
+ new

@@ -179,9 +179,26 @@ assert_equal "3―12:", I18n.t("format_number_header", [3, 12]) end end end + def test_format_with_mismatched_number_of_arguments + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + file = File.join(dir, "locale.yml") + + File.open(file, "w"){|f| f.write %Q|locale: ja\nformat_number_header: "%2$d"| } + I18n.setup("ja") + assert_equal "10", I18n.t("format_number_header", [1, 10]) + + File.open(file, "w"){|f| f.write %Q|locale: ja\nformat_number_header: "%2$d-%1$d"| } + I18n.setup("ja") + # ERROR: returns raw format + assert_equal "%2$d-%1$d", I18n.t("format_number_header", [1]) + end + end + end + def test_ja I18n.setup("ja") assert_equal "図", I18n.t("image") assert_equal "表", I18n.t("table") assert_equal "第1章", I18n.t("chapter", 1)