Skip to content

Commit

Permalink
enhancing unittest for missing localization text
Browse files Browse the repository at this point in the history
  • Loading branch information
MJacred committed Jan 9, 2020
1 parent 71f6d8d commit 75e169f
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions v2/goi18n/merge_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,50 @@ func TestMerge(t *testing.T) {
"active.en-US.toml": []byte("1HelloMessage = \"Hello\"\n"),
},
},
{
name: "single identity, one localization text after missing one",
sourceLanguage: language.AmericanEnglish,
inFiles: map[string][]byte{
"one.en-US.toml": []byte(`
1HelloMessage = ""
Body = "Finally some text!"
`),
},
outFiles: map[string][]byte{
"active.en-US.toml": []byte(`Body = "Finally some text!"
`),
},
},
{
name: "single identity, one localization text before missing one",
sourceLanguage: language.AmericanEnglish,
inFiles: map[string][]byte{
"one.en-US.toml": []byte(`
Body = "Some text!"
1HelloMessage = ""
`),
},
outFiles: map[string][]byte{
"active.en-US.toml": []byte(`Body = "Some text!"
`),
},
},
{
name: "single identity, missing localization text between two localizations",
sourceLanguage: language.AmericanEnglish,
inFiles: map[string][]byte{
"one.en-US.toml": []byte(`
Body = "Some text!"
1HelloMessage = ""
Footer = "Some more text!"
`),
},
outFiles: map[string][]byte{
"active.en-US.toml": []byte(`Body = "Some text!"
Footer = "Some more text!"
`),
},
},
{
name: "plural identity",
sourceLanguage: language.AmericanEnglish,
Expand All @@ -52,6 +96,24 @@ other = "{{.Count}} unread emails"
description = "Message that tells the user how many unread emails they have"
one = "{{.Count}} unread email"
other = "{{.Count}} unread emails"
`),
},
},
{
name: "plural identity, missing localization text",
sourceLanguage: language.AmericanEnglish,
inFiles: map[string][]byte{
"active.en-US.toml": []byte(`
Body = "Some text!"
[MissingTranslation]
description = "I wonder what it was?!"
one = ""
other = ""
`),
},
outFiles: map[string][]byte{
"active.en-US.toml": expectFile(`Body = "Some text!"
`),
},
},
Expand Down

0 comments on commit 75e169f

Please sign in to comment.