(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestReadFileHappy(t *testing.T) { |
| 14 | dir := t.TempDir() |
| 15 | path := filepath.Join(dir, "hello.txt") |
| 16 | content := "line one\nline two with 'quotes' and $dollar and `backticks`\n" |
| 17 | if err := os.WriteFile(path, []byte(content), 0o644); err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | got := ReadFile(path) |
| 21 | if got != content { |
| 22 | t.Fatalf("read content mismatch:\n got %q\nwant %q", got, content) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | func TestReadFileEmptyPath(t *testing.T) { |
| 27 | if got := ReadFile(""); got != "(empty path)" { |
nothing calls this directly
no test coverage detected