Clean project layout and fix release workflow
Some checks failed
build-windows-exe / build (push) Failing after 1m13s
Some checks failed
build-windows-exe / build (push) Failing after 1m13s
This commit is contained in:
43
internal/app/vrc_log_test.go
Normal file
43
internal/app/vrc_log_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestFindLatestVrchatLogKeepsEmptyNewestFile(t *testing.T) {
|
||||
base := t.TempDir()
|
||||
userProfile := filepath.Join(base, "profile")
|
||||
logDir := filepath.Join(userProfile, "AppData", "LocalLow", "VRChat", "VRChat")
|
||||
if err := os.MkdirAll(logDir, 0o755); err != nil {
|
||||
t.Fatalf("mkdir log dir: %v", err)
|
||||
}
|
||||
t.Setenv("USERPROFILE", userProfile)
|
||||
|
||||
oldPath := filepath.Join(logDir, "output_log_2026-06-29_20-46-23.txt")
|
||||
newPath := filepath.Join(logDir, "output_log_2026-06-30_22-25-51.txt")
|
||||
if err := os.WriteFile(oldPath, []byte("old"), 0o644); err != nil {
|
||||
t.Fatalf("write old log: %v", err)
|
||||
}
|
||||
if err := os.WriteFile(newPath, nil, 0o644); err != nil {
|
||||
t.Fatalf("write new log: %v", err)
|
||||
}
|
||||
oldTime := time.Date(2026, 6, 30, 22, 25, 52, 0, time.Local)
|
||||
newTime := time.Date(2026, 6, 30, 22, 26, 0, 0, time.Local)
|
||||
if err := os.Chtimes(oldPath, oldTime, oldTime); err != nil {
|
||||
t.Fatalf("chtimes old log: %v", err)
|
||||
}
|
||||
if err := os.Chtimes(newPath, newTime, newTime); err != nil {
|
||||
t.Fatalf("chtimes new log: %v", err)
|
||||
}
|
||||
|
||||
got, err := findLatestVrchatLog()
|
||||
if err != nil {
|
||||
t.Fatalf("find latest log: %v", err)
|
||||
}
|
||||
if got != newPath {
|
||||
t.Fatalf("expected newest empty log, got %q want %q", got, newPath)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user