diff --git a/cmd/miqt-rcc/integration_test.go b/cmd/miqt-rcc/integration_test.go index fd495a08..48225883 100644 --- a/cmd/miqt-rcc/integration_test.go +++ b/cmd/miqt-rcc/integration_test.go @@ -118,6 +118,13 @@ replace github.com/mappu/miqt => ` + filepath.Clean(RccDir+`/../../`) + ` t.Run("Go generate", func(t *testing.T) { + // Check timestamp before generation + + fiBefore, err := os.Stat(filepath.Join(td, `resources.go`)) + if err != nil { + t.Fatal(err) + } + // Verify that `go generate` works regenCmd := exec.Command(`go`, `generate`) @@ -134,6 +141,17 @@ replace github.com/mappu/miqt => ` + filepath.Clean(RccDir+`/../../`) + ` t.Fatal(err) } + // Verify that the resources.go file was actually replaced + + fiAfter, err := os.Stat(filepath.Join(td, `resources.go`)) + if err != nil { + t.Fatal(err) + } + + if !fiAfter.ModTime().After(fiBefore.ModTime()) { + t.Errorf("expected mtime %v to be after original mtime %v", fiAfter.ModTime(), fiBefore.ModTime()) + } + // Verify the go:embed line accurately used a relative path if !strings.Contains(string(goResult), "//go:embed resources.rcc\n") {