diff --git a/ja_JP/ja_JP_test.go b/ja_JP/ja_JP_test.go index 6129fd4d6..4d7d8b925 100644 --- a/ja_JP/ja_JP_test.go +++ b/ja_JP/ja_JP_test.go @@ -25,16 +25,16 @@ func TestPluralsRange(t *testing.T) { tests := []struct { expected locales.PluralRule }{ - // { - // expected: locales.PluralRuleOther, - // }, + { + expected: locales.PluralRuleOther, + }, } rules := trans.PluralsRange() - // expected := 1 - // if len(rules) != expected { - // t.Errorf("Expected '%d' Got '%d'", expected, len(rules)) - // } + expected := 1 + if len(rules) != expected { + t.Errorf("Expected '%d' Got '%d'", expected, len(rules)) + } for _, tt := range tests { @@ -59,25 +59,16 @@ func TestPluralsOrdinal(t *testing.T) { tests := []struct { expected locales.PluralRule }{ - // { - // expected: locales.PluralRuleOne, - // }, - // { - // expected: locales.PluralRuleTwo, - // }, - // { - // expected: locales.PluralRuleFew, - // }, - // { - // expected: locales.PluralRuleOther, - // }, + { + expected: locales.PluralRuleOther, + }, } rules := trans.PluralsOrdinal() - // expected := 4 - // if len(rules) != expected { - // t.Errorf("Expected '%d' Got '%d'", expected, len(rules)) - // } + expected := 1 + if len(rules) != expected { + t.Errorf("Expected '%d' Got '%d'", expected, len(rules)) + } for _, tt := range tests { @@ -102,19 +93,16 @@ func TestPluralsCardinal(t *testing.T) { tests := []struct { expected locales.PluralRule }{ - // { - // expected: locales.PluralRuleOne, - // }, - // { - // expected: locales.PluralRuleOther, - // }, + { + expected: locales.PluralRuleOther, + }, } rules := trans.PluralsCardinal() - // expected := 2 - // if len(rules) != expected { - // t.Errorf("Expected '%d' Got '%d'", expected, len(rules)) - // } + expected := 1 + if len(rules) != expected { + t.Errorf("Expected '%d' Got '%d'", expected, len(rules)) + } for _, tt := range tests { @@ -143,13 +131,13 @@ func TestRangePlurals(t *testing.T) { v2 uint64 expected locales.PluralRule }{ - // { - // num1: 1, - // v1: 1, - // num2: 2, - // v2: 2, - // expected: locales.PluralRuleOther, - // }, + { + num1: 1, + v1: 1, + num2: 2, + v2: 2, + expected: locales.PluralRuleOther, + }, } for _, tt := range tests { @@ -169,26 +157,11 @@ func TestOrdinalPlurals(t *testing.T) { v uint64 expected locales.PluralRule }{ - // { - // num: 1, - // v: 0, - // expected: locales.PluralRuleOne, - // }, - // { - // num: 2, - // v: 0, - // expected: locales.PluralRuleTwo, - // }, - // { - // num: 3, - // v: 0, - // expected: locales.PluralRuleFew, - // }, - // { - // num: 4, - // v: 0, - // expected: locales.PluralRuleOther, - // }, + { + num: 1, + v: 0, + expected: locales.PluralRuleOther, + }, } for _, tt := range tests { @@ -208,16 +181,11 @@ func TestCardinalPlurals(t *testing.T) { v uint64 expected locales.PluralRule }{ - // { - // num: 1, - // v: 0, - // expected: locales.PluralRuleOne, - // }, - // { - // num: 4, - // v: 0, - // expected: locales.PluralRuleOther, - // }, + { + num: 1, + v: 0, + expected: locales.PluralRuleOther, + }, } for _, tt := range tests { @@ -668,25 +636,25 @@ func TestMonthsWide(t *testing.T) { func TestFmtTimeFull(t *testing.T) { - // loc, err := time.LoadLocation("America/Toronto") - // if err != nil { - // t.Errorf("Expected '' Got '%s'", err) - // } + loc, err := time.LoadLocation("Asia/Tokyo") + if err != nil { + t.Errorf("Expected '' Got '%s'", err) + } - // fixed := time.FixedZone("OTHER", -4) + fixed := time.FixedZone("OTHER", -4) tests := []struct { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 5, 1, 0, loc), - // expected: "9:05:01 am Eastern Standard Time", - // }, - // { - // t: time.Date(2016, 02, 03, 20, 5, 1, 0, fixed), - // expected: "8:05:01 pm OTHER", - // }, + { + t: time.Date(2016, 02, 03, 9, 5, 1, 0, loc), + expected: "9時05分01秒 日本標準時", + }, + { + t: time.Date(2016, 02, 03, 20, 5, 1, 0, fixed), + expected: "20時05分01秒 OTHER", + }, } trans := New() @@ -701,23 +669,23 @@ func TestFmtTimeFull(t *testing.T) { func TestFmtTimeLong(t *testing.T) { - // loc, err := time.LoadLocation("America/Toronto") - // if err != nil { - // t.Errorf("Expected '' Got '%s'", err) - // } + loc, err := time.LoadLocation("Asia/Tokyo") + if err != nil { + t.Errorf("Expected '' Got '%s'", err) + } tests := []struct { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 5, 1, 0, loc), - // expected: "9:05:01 am EST", - // }, - // { - // t: time.Date(2016, 02, 03, 20, 5, 1, 0, loc), - // expected: "8:05:01 pm EST", - // }, + { + t: time.Date(2016, 02, 03, 9, 5, 1, 0, loc), + expected: "9:05:01 JST", + }, + { + t: time.Date(2016, 02, 03, 20, 5, 1, 0, loc), + expected: "20:05:01 JST", + }, } trans := New() @@ -736,14 +704,14 @@ func TestFmtTimeMedium(t *testing.T) { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC), - // expected: "9:05:01 am", - // }, - // { - // t: time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC), - // expected: "8:05:01 pm", - // }, + { + t: time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC), + expected: "9:05:01", + }, + { + t: time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC), + expected: "20:05:01", + }, } trans := New() @@ -762,14 +730,14 @@ func TestFmtTimeShort(t *testing.T) { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC), - // expected: "9:05 am", - // }, - // { - // t: time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC), - // expected: "8:05 pm", - // }, + { + t: time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC), + expected: "9:05", + }, + { + t: time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC), + expected: "20:05", + }, } trans := New() @@ -788,10 +756,10 @@ func TestFmtDateFull(t *testing.T) { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), - // expected: "Wednesday, February 3, 2016", - // }, + { + t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), + expected: "2016年2月3日水曜日", + }, } trans := New() @@ -810,10 +778,10 @@ func TestFmtDateLong(t *testing.T) { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), - // expected: "February 3, 2016", - // }, + { + t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), + expected: "2016年2月3日", + }, } trans := New() @@ -832,10 +800,10 @@ func TestFmtDateMedium(t *testing.T) { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), - // expected: "Feb 3, 2016", - // }, + { + t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), + expected: "2016/02/03", + }, } trans := New() @@ -854,14 +822,14 @@ func TestFmtDateShort(t *testing.T) { t time.Time expected string }{ - // { - // t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), - // expected: "2/3/16", - // }, - // { - // t: time.Date(-500, 02, 03, 9, 0, 1, 0, time.UTC), - // expected: "2/3/500", - // }, + { + t: time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC), + expected: "2016/02/03", + }, + { + t: time.Date(-500, 02, 03, 9, 0, 1, 0, time.UTC), + expected: "500/02/03", + }, } trans := New() @@ -881,46 +849,41 @@ func TestFmtNumber(t *testing.T) { v uint64 expected string }{ - // { - // num: 1123456.5643, - // v: 2, - // expected: "1,123,456.56", - // }, - // { - // num: 1123456.5643, - // v: 1, - // expected: "1,123,456.6", - // }, - // { - // num: 221123456.5643, - // v: 3, - // expected: "221,123,456.564", - // }, - // { - // num: -221123456.5643, - // v: 3, - // expected: "-221,123,456.564", - // }, - // { - // num: -221123456.5643, - // v: 3, - // expected: "-221,123,456.564", - // }, - // { - // num: 0, - // v: 2, - // expected: "0.00", - // }, - // { - // num: -0, - // v: 2, - // expected: "0.00", - // }, - // { - // num: -0, - // v: 2, - // expected: "0.00", - // }, + { + num: 1123456.5643, + v: 2, + expected: "1,123,456.56", + }, + { + num: 1123456.5643, + v: 1, + expected: "1,123,456.6", + }, + { + num: 221123456.5643, + v: 3, + expected: "221,123,456.564", + }, + { + num: -221123456.5643, + v: 3, + expected: "-221,123,456.564", + }, + { + num: -221123456.5643, + v: 3, + expected: "-221,123,456.564", + }, + { + num: 0, + v: 2, + expected: "0.00", + }, + { + num: -0, + v: 2, + expected: "0.00", + }, } trans := New() @@ -941,60 +904,48 @@ func TestFmtCurrency(t *testing.T) { currency currency.Type expected string }{ - // { - // num: 1123456.5643, - // v: 2, - // currency: currency.USD, - // expected: "$1,123,456.56", - // }, - // { - // num: 1123456.5643, - // v: 1, - // currency: currency.USD, - // expected: "$1,123,456.60", - // }, - // { - // num: 221123456.5643, - // v: 3, - // currency: currency.USD, - // expected: "$221,123,456.564", - // }, - // { - // num: -221123456.5643, - // v: 3, - // currency: currency.USD, - // expected: "-$221,123,456.564", - // }, - // { - // num: -221123456.5643, - // v: 3, - // currency: currency.CAD, - // expected: "-CAD 221,123,456.564", - // }, - // { - // num: 0, - // v: 2, - // currency: currency.USD, - // expected: "$0.00", - // }, - // { - // num: -0, - // v: 2, - // currency: currency.USD, - // expected: "$0.00", - // }, - // { - // num: -0, - // v: 2, - // currency: currency.CAD, - // expected: "CAD 0.00", - // }, - // { - // num: 1.23, - // v: 0, - // currency: currency.USD, - // expected: "$1.00", - // }, + { + num: 1123456.5643, + v: 2, + currency: currency.JPY, + expected: "JPY1,123,456.56", + }, + { + num: 1123456.5643, + v: 1, + currency: currency.JPY, + expected: "JPY1,123,456.60", + }, + { + num: 221123456.5643, + v: 3, + currency: currency.JPY, + expected: "JPY221,123,456.564", + }, + { + num: -221123456.5643, + v: 3, + currency: currency.JPY, + expected: "-JPY221,123,456.564", + }, + { + num: 0, + v: 2, + currency: currency.JPY, + expected: "JPY0.00", + }, + { + num: -0, + v: 2, + currency: currency.JPY, + expected: "JPY0.00", + }, + { + num: 1.23, + v: 0, + currency: currency.JPY, + expected: "JPY1.00", + }, } trans := New() @@ -1015,54 +966,42 @@ func TestFmtAccounting(t *testing.T) { currency currency.Type expected string }{ - // { - // num: 1123456.5643, - // v: 2, - // currency: currency.USD, - // expected: "$1,123,456.56", - // }, - // { - // num: 1123456.5643, - // v: 1, - // currency: currency.USD, - // expected: "$1,123,456.60", - // }, - // { - // num: 221123456.5643, - // v: 3, - // currency: currency.USD, - // expected: "$221,123,456.564", - // }, - // { - // num: -221123456.5643, - // v: 3, - // currency: currency.USD, - // expected: "($221,123,456.564)", - // }, - // { - // num: -221123456.5643, - // v: 3, - // currency: currency.CAD, - // expected: "(CAD 221,123,456.564)", - // }, - // { - // num: -0, - // v: 2, - // currency: currency.USD, - // expected: "$0.00", - // }, - // { - // num: -0, - // v: 2, - // currency: currency.CAD, - // expected: "CAD 0.00", - // }, - // { - // num: 1.23, - // v: 0, - // currency: currency.USD, - // expected: "$1.00", - // }, + { + num: 1123456.5643, + v: 2, + currency: currency.JPY, + expected: "JPY1,123,456.56", + }, + { + num: 1123456.5643, + v: 1, + currency: currency.JPY, + expected: "JPY1,123,456.60", + }, + { + num: 221123456.5643, + v: 3, + currency: currency.JPY, + expected: "JPY221,123,456.564", + }, + { + num: -221123456.5643, + v: 3, + currency: currency.JPY, + expected: "(JPY221,123,456.564)", + }, + { + num: -0, + v: 2, + currency: currency.JPY, + expected: "JPY0.00", + }, + { + num: 1.23, + v: 0, + currency: currency.JPY, + expected: "JPY1.00", + }, } trans := New() @@ -1082,31 +1021,31 @@ func TestFmtPercent(t *testing.T) { v uint64 expected string }{ - // { - // num: 15, - // v: 0, - // expected: "15%", - // }, - // { - // num: 15, - // v: 2, - // expected: "15.00%", - // }, - // { - // num: 434.45, - // v: 0, - // expected: "434%", - // }, - // { - // num: 34.4, - // v: 2, - // expected: "34.40%", - // }, - // { - // num: -34, - // v: 0, - // expected: "-34%", - // }, + { + num: 15, + v: 0, + expected: "15%", + }, + { + num: 15, + v: 2, + expected: "15.00%", + }, + { + num: 434.45, + v: 0, + expected: "434%", + }, + { + num: 34.4, + v: 2, + expected: "34.40%", + }, + { + num: -34, + v: 0, + expected: "-34%", + }, } trans := New()