Files
go_blog/config/config_test.go
T
kevin f307781f58 docs: 全部 Go 代码注释汉化
- 48 个 Go 文件所有注释(行注释/块注释/行尾注释,含 _test.go)翻译为中文
- 保留技术标识符:SECURITY_TODO(n)、unsafe-inline、sqlite/mysql、路由参数等
- 代码、字符串字面量、日志消息保持英文原文,零逻辑改动
- go build/vet 通过,go test -count=1 ./... 全绿
2026-08-27 19:03:03 +08:00

23 lines
526 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
import (
"os"
"path/filepath"
"testing"
)
// TestConfigFileCreatedNotWorldReadable 覆盖 SECURITY_TODO #11
// 配置文件(内嵌会话密钥)不得被组/其他用户读取。
func TestConfigFileCreatedNotWorldReadable(t *testing.T) {
path := filepath.Join(t.TempDir(), "config.yaml")
LoadConfig(path)
st, err := os.Stat(path)
if err != nil {
t.Fatalf("config file not created: %v", err)
}
if perm := st.Mode().Perm(); perm != 0640 {
t.Fatalf("config perms = %v, want 0640", perm)
}
}