tpl: Polish i18n tests - hugo - [fork] hugo port for 9front
 (HTM) git clone git@git.drkhsh.at/hugo.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 2071d470e69a9aa7e8393fc9a0eb917f37c4606c
 (DIR) parent e7e2a1ca023073022ce9a4f694253d5592d5c104
 (HTM) Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Tue, 20 Sep 2016 13:22:56 +0200
       
       tpl: Polish i18n tests
       
       * Make the type/var names more specific. They live in the test namespace, but there are other tests there.
       * Camel case variable
       * Small change suggested by Golint
       
       Diffstat:
         M tpl/template_i18n_test.go           |      72 ++++++++++++++++----------------
       
       1 file changed, 36 insertions(+), 36 deletions(-)
       ---
 (DIR) diff --git a/tpl/template_i18n_test.go b/tpl/template_i18n_test.go
       @@ -21,24 +21,24 @@ import (
                "github.com/stretchr/testify/assert"
        )
        
       -type test struct {
       -        data                              map[string][]byte
       -        args                              interface{}
       -        lang, id, expected, expected_flag string
       +type i18nTest struct {
       +        data                             map[string][]byte
       +        args                             interface{}
       +        lang, id, expected, expectedFlag string
        }
        
       -var tests []test = []test{
       +var i18nTests = []i18nTest{
                // All translations present
                {
                        data: map[string][]byte{
                                "en.yaml": []byte("- id: \"hello\"\n  translation: \"Hello, World!\""),
                                "es.yaml": []byte("- id: \"hello\"\n  translation: \"¡Hola, Mundo!\""),
                        },
       -                args:          nil,
       -                lang:          "es",
       -                id:            "hello",
       -                expected:      "¡Hola, Mundo!",
       -                expected_flag: "¡Hola, Mundo!",
       +                args:         nil,
       +                lang:         "es",
       +                id:           "hello",
       +                expected:     "¡Hola, Mundo!",
       +                expectedFlag: "¡Hola, Mundo!",
                },
                // Translation missing in current language but present in default
                {
       @@ -46,11 +46,11 @@ var tests []test = []test{
                                "en.yaml": []byte("- id: \"hello\"\n  translation: \"Hello, World!\""),
                                "es.yaml": []byte("- id: \"goodbye\"\n  translation: \"¡Adiós, Mundo!\""),
                        },
       -                args:          nil,
       -                lang:          "es",
       -                id:            "hello",
       -                expected:      "Hello, World!",
       -                expected_flag: "[i18n] hello",
       +                args:         nil,
       +                lang:         "es",
       +                id:           "hello",
       +                expected:     "Hello, World!",
       +                expectedFlag: "[i18n] hello",
                },
                // Translation missing in default language but present in current
                {
       @@ -58,11 +58,11 @@ var tests []test = []test{
                                "en.yaml": []byte("- id: \"goodybe\"\n  translation: \"Goodbye, World!\""),
                                "es.yaml": []byte("- id: \"hello\"\n  translation: \"¡Hola, Mundo!\""),
                        },
       -                args:          nil,
       -                lang:          "es",
       -                id:            "hello",
       -                expected:      "¡Hola, Mundo!",
       -                expected_flag: "¡Hola, Mundo!",
       +                args:         nil,
       +                lang:         "es",
       +                id:           "hello",
       +                expected:     "¡Hola, Mundo!",
       +                expectedFlag: "¡Hola, Mundo!",
                },
                // Translation missing in both default and current language
                {
       @@ -70,22 +70,22 @@ var tests []test = []test{
                                "en.yaml": []byte("- id: \"goodbye\"\n  translation: \"Goodbye, World!\""),
                                "es.yaml": []byte("- id: \"goodbye\"\n  translation: \"¡Adiós, Mundo!\""),
                        },
       -                args:          nil,
       -                lang:          "es",
       -                id:            "hello",
       -                expected:      "",
       -                expected_flag: "[i18n] hello",
       +                args:         nil,
       +                lang:         "es",
       +                id:           "hello",
       +                expected:     "",
       +                expectedFlag: "[i18n] hello",
                },
                // Default translation file missing or empty
                {
                        data: map[string][]byte{
                                "en.yaml": []byte(""),
                        },
       -                args:          nil,
       -                lang:          "es",
       -                id:            "hello",
       -                expected:      "",
       -                expected_flag: "[i18n] hello",
       +                args:         nil,
       +                lang:         "es",
       +                id:           "hello",
       +                expected:     "",
       +                expectedFlag: "[i18n] hello",
                },
                // Context provided
                {
       @@ -98,10 +98,10 @@ var tests []test = []test{
                        }{
                                50,
                        },
       -                lang:          "es",
       -                id:            "wordCount",
       -                expected:      "¡Hola, 50 gente!",
       -                expected_flag: "¡Hola, 50 gente!",
       +                lang:         "es",
       +                id:           "wordCount",
       +                expected:     "¡Hola, 50 gente!",
       +                expectedFlag: "¡Hola, 50 gente!",
                },
        }
        
       @@ -134,9 +134,9 @@ func TestI18nTranslate(t *testing.T) {
                for _, enablePlaceholders := range []bool{false, true} {
                        viper.Set("EnableMissingTranslationPlaceholders", enablePlaceholders)
        
       -                for _, test := range tests {
       +                for _, test := range i18nTests {
                                if enablePlaceholders {
       -                                expected = test.expected_flag
       +                                expected = test.expectedFlag
                                } else {
                                        expected = test.expected
                                }