Flatten Cache Folder
This commit is contained in:
@@ -42,7 +42,7 @@ func TestBuildNativeGeneratesAndSkipsWikiPages(t *testing.T) {
|
||||
if result.WikiPages != 1 {
|
||||
t.Fatalf("expected one generated entity page, got %d", result.WikiPages)
|
||||
}
|
||||
pagePath := filepath.Join(root, ".cache", "topdata", "wiki", "pages", "skills", "athletics.txt")
|
||||
pagePath := filepath.Join(root, ".cache", "wiki", "pages", "skills", "athletics.txt")
|
||||
got, err := os.ReadFile(pagePath)
|
||||
if err != nil {
|
||||
t.Fatalf("read generated page: %v", err)
|
||||
@@ -54,7 +54,7 @@ func TestBuildNativeGeneratesAndSkipsWikiPages(t *testing.T) {
|
||||
if !strings.Contains(text, "Ability: Strength.") || !strings.Contains(text, " * Climb") {
|
||||
t.Fatalf("expected description to be rendered into wiki page:\n%s", text)
|
||||
}
|
||||
statusPath := filepath.Join(root, ".cache", "topdata", "wiki", "pages", "meta", "wikistatus.txt")
|
||||
statusPath := filepath.Join(root, ".cache", "wiki", "pages", "meta", "wikistatus.txt")
|
||||
statusRaw, err := os.ReadFile(statusPath)
|
||||
if err != nil {
|
||||
t.Fatalf("read status page: %v", err)
|
||||
@@ -62,10 +62,10 @@ func TestBuildNativeGeneratesAndSkipsWikiPages(t *testing.T) {
|
||||
if !strings.Contains(string(statusRaw), "**Vanilla:** 1\\\\") {
|
||||
t.Fatalf("expected wiki status summary to count vanilla page:\n%s", string(statusRaw))
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "topdata", "wiki", "state.json")); err != nil {
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "wiki", "state.json")); err != nil {
|
||||
t.Fatalf("expected state file after first build: %v", err)
|
||||
}
|
||||
stateBefore, err := loadWikiState(filepath.Join(root, ".cache", "topdata", "wiki", "state.json"))
|
||||
stateBefore, err := loadWikiState(filepath.Join(root, ".cache", "wiki", "state.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("read state before second build: %v", err)
|
||||
}
|
||||
@@ -120,7 +120,7 @@ func TestBuildAndPackageBuildsWikiOnlyWhenRequested(t *testing.T) {
|
||||
if result.WikiOutputDir != "" || result.WikiPages != 0 {
|
||||
t.Fatalf("expected wiki generation to be skipped by default, got dir=%q pages=%d", result.WikiOutputDir, result.WikiPages)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "topdata", "wiki", "state.json")); !os.IsNotExist(err) {
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "wiki", "state.json")); !os.IsNotExist(err) {
|
||||
t.Fatalf("expected no wiki state without explicit wiki build, got %v", err)
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func TestBuildAndPackageBuildsWikiOnlyWhenRequested(t *testing.T) {
|
||||
if result.WikiPages != 1 {
|
||||
t.Fatalf("expected one generated wiki page when requested, got %d", result.WikiPages)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "topdata", "wiki", "state.json")); err != nil {
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "wiki", "state.json")); err != nil {
|
||||
t.Fatalf("expected wiki state after explicit wiki build: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ func TestBuildNativeRegeneratesWikiWhenTLKTextChanges(t *testing.T) {
|
||||
if _, err := BuildNative(proj, nil); err != nil {
|
||||
t.Fatalf("BuildNative after text change failed: %v", err)
|
||||
}
|
||||
pagePath := filepath.Join(root, ".cache", "topdata", "wiki", "pages", "skills", "athletics.txt")
|
||||
pagePath := filepath.Join(root, ".cache", "wiki", "pages", "skills", "athletics.txt")
|
||||
got, err := os.ReadFile(pagePath)
|
||||
if err != nil {
|
||||
t.Fatalf("read regenerated page: %v", err)
|
||||
@@ -230,7 +230,7 @@ func TestBuildPackageIgnoresWikiSourcesForFreshness(t *testing.T) {
|
||||
t.Fatalf("BuildNative failed: %v", err)
|
||||
}
|
||||
|
||||
pagePath := filepath.Join(root, ".cache", "topdata", "wiki", "pages", "skills", "athletics.txt")
|
||||
pagePath := filepath.Join(root, ".cache", "wiki", "pages", "skills", "athletics.txt")
|
||||
newTime := time.Now().Add(2 * time.Second)
|
||||
if err := os.Chtimes(pagePath, newTime, newTime); err != nil {
|
||||
t.Fatalf("touch wiki page: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user