1234567891011121314151617181920212223242526272829303132333435 |
- // Copyright 2020 The Gogs Authors. All rights reserved.
- // Use of this source code is governed by a MIT-style
- // license that can be found in the LICENSE file.
- package conf
- import (
- "testing"
- "github.com/stretchr/testify/assert"
- )
- func Test_i18n_DateLang(t *testing.T) {
- c := &i18nConf{
- dateLangs: map[string]string{
- "en-US": "en",
- "zh-CN": "zh",
- },
- }
- tests := []struct {
- lang string
- want string
- }{
- {lang: "en-US", want: "en"},
- {lang: "zh-CN", want: "zh"},
- {lang: "jp-JP", want: "en"},
- }
- for _, test := range tests {
- t.Run("", func(t *testing.T) {
- assert.Equal(t, test.want, c.DateLang(test.lang))
- })
- }
- }
|