(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestCopyFallback(t *testing.T) { |
| 50 | ctx := context.Background() |
| 51 | s := newTestStore(t) |
| 52 | in, err := s.Create(ctx, "Cpy", "", "body\n") |
| 53 | if err != nil { |
| 54 | t.Fatalf("Create: %v", err) |
| 55 | } |
| 56 | old := symlinkFunc |
| 57 | symlinkFunc = func(string, string) error { return privilegeErr{} } |
| 58 | defer func() { symlinkFunc = old }() |
| 59 | |
| 60 | ins, err := s.Install(ctx, in.ID, "claude", "user", "") |
| 61 | if err != nil { |
| 62 | t.Fatalf("Install: %v", err) |
| 63 | } |
| 64 | if ins.LinkKind != "copy" { |
| 65 | t.Fatalf("expected copy, got %s", ins.LinkKind) |
| 66 | } |
| 67 | data, err := os.ReadFile(ins.TargetPath) |
| 68 | if err != nil { |
| 69 | t.Fatalf("ReadFile: %v", err) |
| 70 | } |
| 71 | if string(data) != "body\n" { |
| 72 | t.Fatalf("copied content = %q", data) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestConflictTargetExists(t *testing.T) { |
| 77 | ctx := context.Background() |
nothing calls this directly
no test coverage detected