添加 genv 测试

This commit is contained in:
zdl 2019-06-10 19:50:45 +08:00
parent d5d14b7efc
commit b0b6871bbb

36
g/os/genv/genv_test.go Normal file
View File

@ -0,0 +1,36 @@
package genv_test
import (
"github.com/gogf/gf/g/os/genv"
"github.com/gogf/gf/g/test/gtest"
"os"
"testing"
"time"
)
func Test_Genv_All(t *testing.T) {
gtest.Case(t, func() {
gtest.Assert(os.Environ(), genv.All())
})
}
func Test_Genv_Get(t *testing.T) {
gtest.Case(t, func() {
gtest.AssertEQ("keke", genv.Get("LLL"+time.Now().String(), "keke"))
gtest.AssertEQ("", genv.Get("LLL"+time.Now().String()))
})
}
func Test_Genv_Set(t *testing.T) {
gtest.Case(t, func() {
err := genv.Set("LLL", "keke")
gtest.Assert(err, nil)
})
}
func Test_Genv_Remove(t *testing.T) {
gtest.Case(t, func() {
err := genv.Remove("LLL")
gtest.Assert(err, nil)
})
}