mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 03:47:54 +02:00
Update AssertAllGoldensUsed to use an allowlist of goldens that may not be referenced in GH actions
This commit is contained in:
parent
abd7ee7fb2
commit
e5764c6f07
27
client/testdata/testPresaving-tquery
vendored
27
client/testdata/testPresaving-tquery
vendored
@ -1,27 +0,0 @@
|
|||||||
Search Query: > sleep 13371337 -export -tquery
|
|
||||||
|
|
||||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
||||||
│ CWD Runtime Command │
|
|
||||||
│─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
|
|
||||||
│ / N/A sleep 13371337 │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
│ │
|
|
||||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
||||||
hiSHtory: Search your shell history • ctrl+h help
|
|
@ -11,6 +11,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -360,6 +361,13 @@ func persistLog() {
|
|||||||
checkError(err)
|
checkError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var UNUSED_GOLDENS []string = []string{"TestTui-Exit", "testControlR-ControlC-bash", "testControlR-ControlC-fish",
|
||||||
|
"testControlR-ControlC-zsh", "testControlR-SelectMultiline-bash", "testControlR-SelectMultiline-fish",
|
||||||
|
"testControlR-SelectMultiline-zsh", "testControlR-bash-Disabled", "testControlR-fish-Disabled",
|
||||||
|
"testControlR-zsh-Disabled", "testCustomColumns-query-isAction=false", "testCustomColumns-tquery-bash",
|
||||||
|
"testCustomColumns-tquery-zsh", "testUninstall-post-uninstall-bash",
|
||||||
|
"testUninstall-post-uninstall-zsh"}
|
||||||
|
|
||||||
func AssertAllGoldensUsed() {
|
func AssertAllGoldensUsed() {
|
||||||
if os.Getenv("HISHTORY_FILTERED_TEST") != "" {
|
if os.Getenv("HISHTORY_FILTERED_TEST") != "" {
|
||||||
return
|
return
|
||||||
@ -370,9 +378,10 @@ func AssertAllGoldensUsed() {
|
|||||||
panic(fmt.Errorf("failed to list files in %s: %w", goldensDir, err))
|
panic(fmt.Errorf("failed to list files in %s: %w", goldensDir, err))
|
||||||
}
|
}
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
_, present := usedGoldens[path.Base(f.Name())]
|
goldenName := path.Base(f.Name())
|
||||||
if !present && !strings.Contains(f.Name(), "unittestTable-truncatedTable") && !strings.Contains(f.Name(), "TestTui-ColoredOutput") {
|
_, present := usedGoldens[goldenName]
|
||||||
err = fmt.Errorf("golden file %v was never used", path.Base(f.Name()))
|
if !present && !slices.Contains(UNUSED_GOLDENS, goldenName) {
|
||||||
|
err = fmt.Errorf("golden file %v was never used", goldenName)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
// TODO: Add a panic(err) here too
|
// TODO: Add a panic(err) here too
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user