summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-16 05:37:14 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-04-16 08:37:14 -0400
commit6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch)
tree3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go
parentbf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff)
downloadchat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go')
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go75
1 files changed, 0 insertions, 75 deletions
diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go b/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go
deleted file mode 100644
index 425a6b62d..000000000
--- a/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_command_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package main
-
-import (
- "bytes"
- "io/ioutil"
- "os"
- "testing"
-)
-
-func TestMergeExecuteJSON(t *testing.T) {
- files := []string{
- "testdata/input/en-us.one.json",
- "testdata/input/en-us.two.json",
- "testdata/input/fr-fr.json",
- "testdata/input/ar-ar.one.json",
- "testdata/input/ar-ar.two.json",
- }
- testMergeExecute(t, files)
-}
-
-func TestMergeExecuteYAML(t *testing.T) {
- files := []string{
- "testdata/input/yaml/en-us.one.yaml",
- "testdata/input/yaml/en-us.two.json",
- "testdata/input/yaml/fr-fr.json",
- "testdata/input/yaml/ar-ar.one.json",
- "testdata/input/yaml/ar-ar.two.json",
- }
- testMergeExecute(t, files)
-}
-
-func testMergeExecute(t *testing.T, files []string) {
- resetDir(t, "testdata/output")
-
- mc := &mergeCommand{
- translationFiles: files,
- sourceLanguage: "en-us",
- outdir: "testdata/output",
- format: "json",
- flat: false,
- }
- if err := mc.execute(); err != nil {
- t.Fatal(err)
- }
-
- expectEqualFiles(t, "testdata/output/en-us.all.json", "testdata/expected/en-us.all.json")
- expectEqualFiles(t, "testdata/output/ar-ar.all.json", "testdata/expected/ar-ar.all.json")
- expectEqualFiles(t, "testdata/output/fr-fr.all.json", "testdata/expected/fr-fr.all.json")
- expectEqualFiles(t, "testdata/output/en-us.untranslated.json", "testdata/expected/en-us.untranslated.json")
- expectEqualFiles(t, "testdata/output/ar-ar.untranslated.json", "testdata/expected/ar-ar.untranslated.json")
- expectEqualFiles(t, "testdata/output/fr-fr.untranslated.json", "testdata/expected/fr-fr.untranslated.json")
-}
-
-func resetDir(t *testing.T, dir string) {
- if err := os.RemoveAll(dir); err != nil {
- t.Fatal(err)
- }
- if err := os.Mkdir(dir, 0777); err != nil {
- t.Fatal(err)
- }
-}
-
-func expectEqualFiles(t *testing.T, expectedName, actualName string) {
- actual, err := ioutil.ReadFile(actualName)
- if err != nil {
- t.Fatal(err)
- }
- expected, err := ioutil.ReadFile(expectedName)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(actual, expected) {
- t.Errorf("contents of files did not match: %s, %s", expectedName, actualName)
- }
-}