go17/book/config/load_test.go
2024-11-16 17:53:04 +08:00

20 lines
432 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package config_test
import (
"testing"
"gitlab.com/go-course-project/go17/book/config"
)
// LoadConfigFromYaml
// go test 它自动帮你写来一个main函数然后把测试逻辑装进去, 然后编译允许
func TestLoadConfigFromYaml(t *testing.T) {
if err := config.LoadConfigFromYaml("application.yaml"); err != nil {
// 报错测试失败,并且结束
t.Fatal(err)
}
// 加载成功
t.Log(config.Get())
}