MCPcopy Create free account
hub / github.com/gogs/gogs / TestCurrentUsername

Function TestCurrentUsername

internal/osutil/osutil_test.go:80–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestCurrentUsername(t *testing.T) {
81 if oldUser, ok := os.LookupEnv("USER"); ok {
82 defer func() { t.Setenv("USER", oldUser) }()
83 } else {
84 defer func() { _ = os.Unsetenv("USER") }()
85 }
86
87 t.Setenv("USER", "__TESTING::USERNAME")
88 assert.Equal(t, "__TESTING::USERNAME", CurrentUsername())
89}
90
91func TestIsSymlink(t *testing.T) {
92 // Create a temporary file

Callers

nothing calls this directly

Calls 1

CurrentUsernameFunction · 0.85

Tested by

no test coverage detected