diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-29 22:24:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-29 22:24:20 +0800 |
commit | 8796df8218aa306f1431c17233fbcc3e0811cc4e (patch) | |
tree | 07ba5f0e62ed68064143f029217c82c80f9b652c /internal/conf/static_test.go | |
parent | 17ae0ed3eef54d96bd179ff7fec0540cf3024748 (diff) |
conf: add unit tests (#5954)
* conf: add tests for utils.go
* conf: add tests for static.go
* mock os/exec
* Run tests on Windows
* appveyor: fix gcc not found
* computed: add unit tests
* log: add unit tests
* log: fix tests on Windows
* conf: add some tests
* Finish adding tests
* Cover more cases
* Add tests for testutil
* Add more tests
Diffstat (limited to 'internal/conf/static_test.go')
-rw-r--r-- | internal/conf/static_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/conf/static_test.go b/internal/conf/static_test.go new file mode 100644 index 00000000..e9b9cb02 --- /dev/null +++ b/internal/conf/static_test.go @@ -0,0 +1,35 @@ +// 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)) + }) + } +} |