Files
goext/langext/os_test.go
T
Mikescher 02d6894ec6
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m34s
[🤖] Add Unit-Tests
2026-04-27 16:31:29 +02:00

29 lines
641 B
Go

package langext
import (
"git.blackforestbytes.com/BlackForestBytes/goext/tst"
"os"
"path/filepath"
"testing"
)
func TestFileExistsTrue(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "f.txt")
if err := os.WriteFile(path, []byte("hi"), 0o644); err != nil {
t.Fatalf("setup failed: %v", err)
}
tst.AssertEqual(t, FileExists(path), true)
}
func TestFileExistsFalse(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "missing.txt")
tst.AssertEqual(t, FileExists(path), false)
}
func TestFileExistsDirectoryReturnsFalse(t *testing.T) {
dir := t.TempDir()
tst.AssertEqual(t, FileExists(dir), false)
}