MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestReadFileHappy

Function TestReadFileHappy

internal/tools/read_test.go:13–24  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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
26func TestReadFileEmptyPath(t *testing.T) {
27 if got := ReadFile(""); got != "(empty path)" {

Callers

nothing calls this directly

Calls 1

ReadFileFunction · 0.85

Tested by

no test coverage detected