Files
tutti/services/tuttid/data/workspace/local_recent_darwin_test.go
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

49 lines
1.5 KiB
Go

//go:build darwin
package workspace
import (
"fmt"
"strings"
"testing"
)
func TestFinderRecentSpotlightQueryKeepsOlderOpenedFiles(t *testing.T) {
if strings.Contains(finderRecentSpotlightQuery, "$time") {
t.Fatalf("query = %q, want no rolling date window", finderRecentSpotlightQuery)
}
if !strings.Contains(finderRecentSpotlightQuery, "kMDItemLastUsedDate == *") {
t.Fatalf("query = %q, want all opened files", finderRecentSpotlightQuery)
}
}
func TestFinderRecentSpotlightQueryExcludesFinderNoise(t *testing.T) {
for _, predicate := range []string{
"kMDItemContentTypeTree != 'public.folder'",
"kMDItemFSName != '*.download'cd",
} {
if !strings.Contains(finderRecentSpotlightQuery, predicate) {
t.Fatalf("query = %q, want predicate %q", finderRecentSpotlightQuery, predicate)
}
}
}
func TestParseSpotlightRecentCandidatesKeepsUnrankedResultsPastOldCap(t *testing.T) {
const candidateCount = 450
var output strings.Builder
for index := 0; index < candidateCount; index++ {
fmt.Fprintf(&output, "/workspace/file-%03d.txt\n", index)
}
paths, err := parseSpotlightRecentCandidates(strings.NewReader(output.String()))
if err != nil {
t.Fatalf("parseSpotlightRecentCandidates: %v", err)
}
if len(paths) != candidateCount {
t.Fatalf("candidate count = %d, want %d", len(paths), candidateCount)
}
if got := paths[candidateCount-1]; got != "/workspace/file-449.txt" {
t.Fatalf("last candidate = %q, want final unranked Spotlight hit", got)
}
}