From 88f1c0168e0ab2504dfd4fd3ba5e14893879d2a1 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Thu, 21 Dec 2023 17:06:46 -0800 Subject: [PATCH] Move test goldens to testdata/ directory to be more idiomatic, and add assertion that they're all actively being used by the tests (#154) * Move golden files to testdata dir * Add assertion that requires that all goldens are used * Add map init so the map is non-nil * Add print to confirm that tests finished running * Remove colon so that this doesn't match against gotestsum looking for the substring "panic:", which can happen depending on how stdout is buffer * Revert "Remove colon so that this doesn't match against gotestsum looking for the substring "panic:", which can happen depending on how stdout is buffer" This reverts commit b44e53a17bb1592e620e77e39b7dab93e8edafcf. --- Makefile | 2 +- client/client_test.go | 3 +++ .../{lib/goldens => testdata}/TestFish-table | 0 .../TestImportHistory-export | 0 .../TestSortByConsistentTimezone-export | 0 .../TestSortByConsistentTimezone-query | 0 .../TestTimestampFormat-query | 0 .../TestTimestampFormat-tquery | 0 .../{lib/goldens => testdata}/TestTui-AiQuery | 0 .../TestTui-AiQuery-Disabled | 0 .../TestTui-ColoredOutput | 0 .../TestTui-ColoredOutputWithSearch | 0 .../TestTui-ColoredOutputWithSearch-Highlight | 0 .../TestTui-CustomColorScheme | 0 .../TestTui-DefaultColorScheme | 0 .../{lib/goldens => testdata}/TestTui-Delete | 0 .../goldens => testdata}/TestTui-DeleteAgain | 0 .../TestTui-DeleteAgainStill | 0 .../goldens => testdata}/TestTui-DeleteStill | 0 client/{lib/goldens => testdata}/TestTui-Exit | 0 .../TestTui-ExportWithAdditionalEntries | 0 .../goldens => testdata}/TestTui-HelpPage | 0 .../TestTui-HelpPageClosed | 0 .../{lib/goldens => testdata}/TestTui-Initial | 0 .../TestTui-InitialInvalidSearch | 0 .../TestTui-InvalidSearch | 0 .../TestTui-InvalidSearchBecomesValid | 0 .../goldens => testdata}/TestTui-LeftScroll | 0 .../goldens => testdata}/TestTui-LongQuery | 0 .../{lib/goldens => testdata}/TestTui-Offline | 0 .../TestTui-OfflineInvalid | 0 .../{lib/goldens => testdata}/TestTui-Resize | 0 .../goldens => testdata}/TestTui-RightScroll | 0 .../TestTui-RightScrollTwo | 0 .../{lib/goldens => testdata}/TestTui-Search | 0 .../TestTui-SearchBackslash | 0 .../goldens => testdata}/TestTui-SearchQuoted | 0 .../TestTui-SearchUnquoted | 0 .../goldens => testdata}/TestTui-SelectAndCd | 0 .../TestTui-SmallTerminal | 0 .../TestTui-TiniestTerminal | 0 .../goldens => testdata}/TestTui-TinyTerminal | 0 .../TestTui-TinyTerminalHelp | 0 .../testControlR-AdvancedSearch | 0 .../testControlR-ControlC-bash | 0 .../testControlR-ControlC-fish | 0 .../testControlR-ControlC-zsh | 0 .../testControlR-DisplayMultiline-bash | 0 .../testControlR-DisplayMultiline-fish | 0 .../testControlR-DisplayMultiline-zsh | 0 .../goldens => testdata}/testControlR-Final | 0 .../goldens => testdata}/testControlR-Initial | 0 .../testControlR-InitialExport | 0 .../testControlR-InitialSearch | 0 .../testControlR-InitialSearchExpanded | 0 .../testControlR-InitialSearchNoResults | 0 ...olR-InitialSearchNoResultsThenFoundResults | 0 .../goldens => testdata}/testControlR-Search | 0 .../testControlR-SelectMultiline-bash | 0 .../testControlR-SelectMultiline-fish | 0 .../testControlR-SelectMultiline-zsh | 0 .../testControlR-bash-Disabled | 0 .../testControlR-customColumn | 0 .../testControlR-displayedColumns | 0 .../testControlR-fish-Disabled | 0 .../testControlR-zsh-Disabled | 0 .../testCustomColumns-initHistory | 0 .../testCustomColumns-query-isAction=false | 0 .../testCustomColumns-query-isAction=true | 0 .../testCustomColumns-tquery-bash | 0 .../testCustomColumns-tquery-bash-isAction | 0 .../testCustomColumns-tquery-zsh | 0 .../testCustomColumns-tquery-zsh-isAction | 0 .../testDisplayTable-customColumns | 0 .../testDisplayTable-customColumns-2 | 0 .../testDisplayTable-customColumns-3 | 0 ...isplayTable-customColumns-multiLineCommand | 0 ...testDisplayTable-customColumns-trulyCustom | 0 .../testDisplayTable-defaultColumns | 0 .../testIntegrationWithNewDevice-bash | 0 .../testIntegrationWithNewDevice-tablebash | 0 .../testIntegrationWithNewDevice-tablezsh | 0 .../testIntegrationWithNewDevice-zsh | 0 .../goldens => testdata}/testPresaving-query | 0 .../goldens => testdata}/testPresaving-tquery | 0 .../testPresavingOffline-query-missing | 0 .../testPresavingOffline-query-present | 0 .../testRemoveDuplicateRows-enabled-export | 0 .../testRemoveDuplicateRows-enabled-query | 0 .../testRemoveDuplicateRows-enabled-tquery | 0 .../testRemoveDuplicateRows-export | 0 .../testRemoveDuplicateRows-query | 0 .../testRemoveDuplicateRows-tquery | 0 .../testUninstall-post-uninstall | 0 .../testUninstall-post-uninstall-bash | 0 .../testUninstall-post-uninstall-zsh | 0 .../testUninstall-recorded | 0 .../testUninstall-uninstall | 0 .../unittestTable-truncatedTable | 0 .../unittestTable-truncatedTable-right1 | 0 .../unittestTable-truncatedTable-right2 | 0 .../unittestTable-truncatedTable-right3 | 0 shared/testutils/testutils.go | 23 ++++++++++++++++++- 103 files changed, 26 insertions(+), 2 deletions(-) rename client/{lib/goldens => testdata}/TestFish-table (100%) rename client/{lib/goldens => testdata}/TestImportHistory-export (100%) rename client/{lib/goldens => testdata}/TestSortByConsistentTimezone-export (100%) rename client/{lib/goldens => testdata}/TestSortByConsistentTimezone-query (100%) rename client/{lib/goldens => testdata}/TestTimestampFormat-query (100%) rename client/{lib/goldens => testdata}/TestTimestampFormat-tquery (100%) rename client/{lib/goldens => testdata}/TestTui-AiQuery (100%) rename client/{lib/goldens => testdata}/TestTui-AiQuery-Disabled (100%) rename client/{lib/goldens => testdata}/TestTui-ColoredOutput (100%) rename client/{lib/goldens => testdata}/TestTui-ColoredOutputWithSearch (100%) rename client/{lib/goldens => testdata}/TestTui-ColoredOutputWithSearch-Highlight (100%) rename client/{lib/goldens => testdata}/TestTui-CustomColorScheme (100%) rename client/{lib/goldens => testdata}/TestTui-DefaultColorScheme (100%) rename client/{lib/goldens => testdata}/TestTui-Delete (100%) rename client/{lib/goldens => testdata}/TestTui-DeleteAgain (100%) rename client/{lib/goldens => testdata}/TestTui-DeleteAgainStill (100%) rename client/{lib/goldens => testdata}/TestTui-DeleteStill (100%) rename client/{lib/goldens => testdata}/TestTui-Exit (100%) rename client/{lib/goldens => testdata}/TestTui-ExportWithAdditionalEntries (100%) rename client/{lib/goldens => testdata}/TestTui-HelpPage (100%) rename client/{lib/goldens => testdata}/TestTui-HelpPageClosed (100%) rename client/{lib/goldens => testdata}/TestTui-Initial (100%) rename client/{lib/goldens => testdata}/TestTui-InitialInvalidSearch (100%) rename client/{lib/goldens => testdata}/TestTui-InvalidSearch (100%) rename client/{lib/goldens => testdata}/TestTui-InvalidSearchBecomesValid (100%) rename client/{lib/goldens => testdata}/TestTui-LeftScroll (100%) rename client/{lib/goldens => testdata}/TestTui-LongQuery (100%) rename client/{lib/goldens => testdata}/TestTui-Offline (100%) rename client/{lib/goldens => testdata}/TestTui-OfflineInvalid (100%) rename client/{lib/goldens => testdata}/TestTui-Resize (100%) rename client/{lib/goldens => testdata}/TestTui-RightScroll (100%) rename client/{lib/goldens => testdata}/TestTui-RightScrollTwo (100%) rename client/{lib/goldens => testdata}/TestTui-Search (100%) rename client/{lib/goldens => testdata}/TestTui-SearchBackslash (100%) rename client/{lib/goldens => testdata}/TestTui-SearchQuoted (100%) rename client/{lib/goldens => testdata}/TestTui-SearchUnquoted (100%) rename client/{lib/goldens => testdata}/TestTui-SelectAndCd (100%) rename client/{lib/goldens => testdata}/TestTui-SmallTerminal (100%) rename client/{lib/goldens => testdata}/TestTui-TiniestTerminal (100%) rename client/{lib/goldens => testdata}/TestTui-TinyTerminal (100%) rename client/{lib/goldens => testdata}/TestTui-TinyTerminalHelp (100%) rename client/{lib/goldens => testdata}/testControlR-AdvancedSearch (100%) rename client/{lib/goldens => testdata}/testControlR-ControlC-bash (100%) rename client/{lib/goldens => testdata}/testControlR-ControlC-fish (100%) rename client/{lib/goldens => testdata}/testControlR-ControlC-zsh (100%) rename client/{lib/goldens => testdata}/testControlR-DisplayMultiline-bash (100%) rename client/{lib/goldens => testdata}/testControlR-DisplayMultiline-fish (100%) rename client/{lib/goldens => testdata}/testControlR-DisplayMultiline-zsh (100%) rename client/{lib/goldens => testdata}/testControlR-Final (100%) rename client/{lib/goldens => testdata}/testControlR-Initial (100%) rename client/{lib/goldens => testdata}/testControlR-InitialExport (100%) rename client/{lib/goldens => testdata}/testControlR-InitialSearch (100%) rename client/{lib/goldens => testdata}/testControlR-InitialSearchExpanded (100%) rename client/{lib/goldens => testdata}/testControlR-InitialSearchNoResults (100%) rename client/{lib/goldens => testdata}/testControlR-InitialSearchNoResultsThenFoundResults (100%) rename client/{lib/goldens => testdata}/testControlR-Search (100%) rename client/{lib/goldens => testdata}/testControlR-SelectMultiline-bash (100%) rename client/{lib/goldens => testdata}/testControlR-SelectMultiline-fish (100%) rename client/{lib/goldens => testdata}/testControlR-SelectMultiline-zsh (100%) rename client/{lib/goldens => testdata}/testControlR-bash-Disabled (100%) rename client/{lib/goldens => testdata}/testControlR-customColumn (100%) rename client/{lib/goldens => testdata}/testControlR-displayedColumns (100%) rename client/{lib/goldens => testdata}/testControlR-fish-Disabled (100%) rename client/{lib/goldens => testdata}/testControlR-zsh-Disabled (100%) rename client/{lib/goldens => testdata}/testCustomColumns-initHistory (100%) rename client/{lib/goldens => testdata}/testCustomColumns-query-isAction=false (100%) rename client/{lib/goldens => testdata}/testCustomColumns-query-isAction=true (100%) rename client/{lib/goldens => testdata}/testCustomColumns-tquery-bash (100%) rename client/{lib/goldens => testdata}/testCustomColumns-tquery-bash-isAction (100%) rename client/{lib/goldens => testdata}/testCustomColumns-tquery-zsh (100%) rename client/{lib/goldens => testdata}/testCustomColumns-tquery-zsh-isAction (100%) rename client/{lib/goldens => testdata}/testDisplayTable-customColumns (100%) rename client/{lib/goldens => testdata}/testDisplayTable-customColumns-2 (100%) rename client/{lib/goldens => testdata}/testDisplayTable-customColumns-3 (100%) rename client/{lib/goldens => testdata}/testDisplayTable-customColumns-multiLineCommand (100%) rename client/{lib/goldens => testdata}/testDisplayTable-customColumns-trulyCustom (100%) rename client/{lib/goldens => testdata}/testDisplayTable-defaultColumns (100%) rename client/{lib/goldens => testdata}/testIntegrationWithNewDevice-bash (100%) rename client/{lib/goldens => testdata}/testIntegrationWithNewDevice-tablebash (100%) rename client/{lib/goldens => testdata}/testIntegrationWithNewDevice-tablezsh (100%) rename client/{lib/goldens => testdata}/testIntegrationWithNewDevice-zsh (100%) rename client/{lib/goldens => testdata}/testPresaving-query (100%) rename client/{lib/goldens => testdata}/testPresaving-tquery (100%) rename client/{lib/goldens => testdata}/testPresavingOffline-query-missing (100%) rename client/{lib/goldens => testdata}/testPresavingOffline-query-present (100%) rename client/{lib/goldens => testdata}/testRemoveDuplicateRows-enabled-export (100%) rename client/{lib/goldens => testdata}/testRemoveDuplicateRows-enabled-query (100%) rename client/{lib/goldens => testdata}/testRemoveDuplicateRows-enabled-tquery (100%) rename client/{lib/goldens => testdata}/testRemoveDuplicateRows-export (100%) rename client/{lib/goldens => testdata}/testRemoveDuplicateRows-query (100%) rename client/{lib/goldens => testdata}/testRemoveDuplicateRows-tquery (100%) rename client/{lib/goldens => testdata}/testUninstall-post-uninstall (100%) rename client/{lib/goldens => testdata}/testUninstall-post-uninstall-bash (100%) rename client/{lib/goldens => testdata}/testUninstall-post-uninstall-zsh (100%) rename client/{lib/goldens => testdata}/testUninstall-recorded (100%) rename client/{lib/goldens => testdata}/testUninstall-uninstall (100%) rename client/{lib/goldens => testdata}/unittestTable-truncatedTable (100%) rename client/{lib/goldens => testdata}/unittestTable-truncatedTable-right1 (100%) rename client/{lib/goldens => testdata}/unittestTable-truncatedTable-right2 (100%) rename client/{lib/goldens => testdata}/unittestTable-truncatedTable-right3 (100%) diff --git a/Makefile b/Makefile index c23739e..b372783 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ test: ftest: go clean -testcache - TZ='America/Los_Angeles' HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 gotestsum --packages ./... --rerun-fails=0 --format testname -- -p 1 -run "$(FILTER)" -timeout 60m + HISHTORY_FILTERED_TEST=1 TZ='America/Los_Angeles' HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 gotestsum --packages ./... --rerun-fails=0 --format testname -- -p 1 -run "$(FILTER)" -timeout 60m acttest: act push -j test -e .github/push_event.json --reuse --container-architecture linux/amd64 diff --git a/client/client_test.go b/client/client_test.go index db89915..03e5e40 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -53,6 +53,9 @@ func TestMain(m *testing.M) { // Start the tests m.Run() + + // Teardown + testutils.AssertAllGoldensUsed() } var shellTesters []shellTester = []shellTester{bashTester{}, zshTester{}} diff --git a/client/lib/goldens/TestFish-table b/client/testdata/TestFish-table similarity index 100% rename from client/lib/goldens/TestFish-table rename to client/testdata/TestFish-table diff --git a/client/lib/goldens/TestImportHistory-export b/client/testdata/TestImportHistory-export similarity index 100% rename from client/lib/goldens/TestImportHistory-export rename to client/testdata/TestImportHistory-export diff --git a/client/lib/goldens/TestSortByConsistentTimezone-export b/client/testdata/TestSortByConsistentTimezone-export similarity index 100% rename from client/lib/goldens/TestSortByConsistentTimezone-export rename to client/testdata/TestSortByConsistentTimezone-export diff --git a/client/lib/goldens/TestSortByConsistentTimezone-query b/client/testdata/TestSortByConsistentTimezone-query similarity index 100% rename from client/lib/goldens/TestSortByConsistentTimezone-query rename to client/testdata/TestSortByConsistentTimezone-query diff --git a/client/lib/goldens/TestTimestampFormat-query b/client/testdata/TestTimestampFormat-query similarity index 100% rename from client/lib/goldens/TestTimestampFormat-query rename to client/testdata/TestTimestampFormat-query diff --git a/client/lib/goldens/TestTimestampFormat-tquery b/client/testdata/TestTimestampFormat-tquery similarity index 100% rename from client/lib/goldens/TestTimestampFormat-tquery rename to client/testdata/TestTimestampFormat-tquery diff --git a/client/lib/goldens/TestTui-AiQuery b/client/testdata/TestTui-AiQuery similarity index 100% rename from client/lib/goldens/TestTui-AiQuery rename to client/testdata/TestTui-AiQuery diff --git a/client/lib/goldens/TestTui-AiQuery-Disabled b/client/testdata/TestTui-AiQuery-Disabled similarity index 100% rename from client/lib/goldens/TestTui-AiQuery-Disabled rename to client/testdata/TestTui-AiQuery-Disabled diff --git a/client/lib/goldens/TestTui-ColoredOutput b/client/testdata/TestTui-ColoredOutput similarity index 100% rename from client/lib/goldens/TestTui-ColoredOutput rename to client/testdata/TestTui-ColoredOutput diff --git a/client/lib/goldens/TestTui-ColoredOutputWithSearch b/client/testdata/TestTui-ColoredOutputWithSearch similarity index 100% rename from client/lib/goldens/TestTui-ColoredOutputWithSearch rename to client/testdata/TestTui-ColoredOutputWithSearch diff --git a/client/lib/goldens/TestTui-ColoredOutputWithSearch-Highlight b/client/testdata/TestTui-ColoredOutputWithSearch-Highlight similarity index 100% rename from client/lib/goldens/TestTui-ColoredOutputWithSearch-Highlight rename to client/testdata/TestTui-ColoredOutputWithSearch-Highlight diff --git a/client/lib/goldens/TestTui-CustomColorScheme b/client/testdata/TestTui-CustomColorScheme similarity index 100% rename from client/lib/goldens/TestTui-CustomColorScheme rename to client/testdata/TestTui-CustomColorScheme diff --git a/client/lib/goldens/TestTui-DefaultColorScheme b/client/testdata/TestTui-DefaultColorScheme similarity index 100% rename from client/lib/goldens/TestTui-DefaultColorScheme rename to client/testdata/TestTui-DefaultColorScheme diff --git a/client/lib/goldens/TestTui-Delete b/client/testdata/TestTui-Delete similarity index 100% rename from client/lib/goldens/TestTui-Delete rename to client/testdata/TestTui-Delete diff --git a/client/lib/goldens/TestTui-DeleteAgain b/client/testdata/TestTui-DeleteAgain similarity index 100% rename from client/lib/goldens/TestTui-DeleteAgain rename to client/testdata/TestTui-DeleteAgain diff --git a/client/lib/goldens/TestTui-DeleteAgainStill b/client/testdata/TestTui-DeleteAgainStill similarity index 100% rename from client/lib/goldens/TestTui-DeleteAgainStill rename to client/testdata/TestTui-DeleteAgainStill diff --git a/client/lib/goldens/TestTui-DeleteStill b/client/testdata/TestTui-DeleteStill similarity index 100% rename from client/lib/goldens/TestTui-DeleteStill rename to client/testdata/TestTui-DeleteStill diff --git a/client/lib/goldens/TestTui-Exit b/client/testdata/TestTui-Exit similarity index 100% rename from client/lib/goldens/TestTui-Exit rename to client/testdata/TestTui-Exit diff --git a/client/lib/goldens/TestTui-ExportWithAdditionalEntries b/client/testdata/TestTui-ExportWithAdditionalEntries similarity index 100% rename from client/lib/goldens/TestTui-ExportWithAdditionalEntries rename to client/testdata/TestTui-ExportWithAdditionalEntries diff --git a/client/lib/goldens/TestTui-HelpPage b/client/testdata/TestTui-HelpPage similarity index 100% rename from client/lib/goldens/TestTui-HelpPage rename to client/testdata/TestTui-HelpPage diff --git a/client/lib/goldens/TestTui-HelpPageClosed b/client/testdata/TestTui-HelpPageClosed similarity index 100% rename from client/lib/goldens/TestTui-HelpPageClosed rename to client/testdata/TestTui-HelpPageClosed diff --git a/client/lib/goldens/TestTui-Initial b/client/testdata/TestTui-Initial similarity index 100% rename from client/lib/goldens/TestTui-Initial rename to client/testdata/TestTui-Initial diff --git a/client/lib/goldens/TestTui-InitialInvalidSearch b/client/testdata/TestTui-InitialInvalidSearch similarity index 100% rename from client/lib/goldens/TestTui-InitialInvalidSearch rename to client/testdata/TestTui-InitialInvalidSearch diff --git a/client/lib/goldens/TestTui-InvalidSearch b/client/testdata/TestTui-InvalidSearch similarity index 100% rename from client/lib/goldens/TestTui-InvalidSearch rename to client/testdata/TestTui-InvalidSearch diff --git a/client/lib/goldens/TestTui-InvalidSearchBecomesValid b/client/testdata/TestTui-InvalidSearchBecomesValid similarity index 100% rename from client/lib/goldens/TestTui-InvalidSearchBecomesValid rename to client/testdata/TestTui-InvalidSearchBecomesValid diff --git a/client/lib/goldens/TestTui-LeftScroll b/client/testdata/TestTui-LeftScroll similarity index 100% rename from client/lib/goldens/TestTui-LeftScroll rename to client/testdata/TestTui-LeftScroll diff --git a/client/lib/goldens/TestTui-LongQuery b/client/testdata/TestTui-LongQuery similarity index 100% rename from client/lib/goldens/TestTui-LongQuery rename to client/testdata/TestTui-LongQuery diff --git a/client/lib/goldens/TestTui-Offline b/client/testdata/TestTui-Offline similarity index 100% rename from client/lib/goldens/TestTui-Offline rename to client/testdata/TestTui-Offline diff --git a/client/lib/goldens/TestTui-OfflineInvalid b/client/testdata/TestTui-OfflineInvalid similarity index 100% rename from client/lib/goldens/TestTui-OfflineInvalid rename to client/testdata/TestTui-OfflineInvalid diff --git a/client/lib/goldens/TestTui-Resize b/client/testdata/TestTui-Resize similarity index 100% rename from client/lib/goldens/TestTui-Resize rename to client/testdata/TestTui-Resize diff --git a/client/lib/goldens/TestTui-RightScroll b/client/testdata/TestTui-RightScroll similarity index 100% rename from client/lib/goldens/TestTui-RightScroll rename to client/testdata/TestTui-RightScroll diff --git a/client/lib/goldens/TestTui-RightScrollTwo b/client/testdata/TestTui-RightScrollTwo similarity index 100% rename from client/lib/goldens/TestTui-RightScrollTwo rename to client/testdata/TestTui-RightScrollTwo diff --git a/client/lib/goldens/TestTui-Search b/client/testdata/TestTui-Search similarity index 100% rename from client/lib/goldens/TestTui-Search rename to client/testdata/TestTui-Search diff --git a/client/lib/goldens/TestTui-SearchBackslash b/client/testdata/TestTui-SearchBackslash similarity index 100% rename from client/lib/goldens/TestTui-SearchBackslash rename to client/testdata/TestTui-SearchBackslash diff --git a/client/lib/goldens/TestTui-SearchQuoted b/client/testdata/TestTui-SearchQuoted similarity index 100% rename from client/lib/goldens/TestTui-SearchQuoted rename to client/testdata/TestTui-SearchQuoted diff --git a/client/lib/goldens/TestTui-SearchUnquoted b/client/testdata/TestTui-SearchUnquoted similarity index 100% rename from client/lib/goldens/TestTui-SearchUnquoted rename to client/testdata/TestTui-SearchUnquoted diff --git a/client/lib/goldens/TestTui-SelectAndCd b/client/testdata/TestTui-SelectAndCd similarity index 100% rename from client/lib/goldens/TestTui-SelectAndCd rename to client/testdata/TestTui-SelectAndCd diff --git a/client/lib/goldens/TestTui-SmallTerminal b/client/testdata/TestTui-SmallTerminal similarity index 100% rename from client/lib/goldens/TestTui-SmallTerminal rename to client/testdata/TestTui-SmallTerminal diff --git a/client/lib/goldens/TestTui-TiniestTerminal b/client/testdata/TestTui-TiniestTerminal similarity index 100% rename from client/lib/goldens/TestTui-TiniestTerminal rename to client/testdata/TestTui-TiniestTerminal diff --git a/client/lib/goldens/TestTui-TinyTerminal b/client/testdata/TestTui-TinyTerminal similarity index 100% rename from client/lib/goldens/TestTui-TinyTerminal rename to client/testdata/TestTui-TinyTerminal diff --git a/client/lib/goldens/TestTui-TinyTerminalHelp b/client/testdata/TestTui-TinyTerminalHelp similarity index 100% rename from client/lib/goldens/TestTui-TinyTerminalHelp rename to client/testdata/TestTui-TinyTerminalHelp diff --git a/client/lib/goldens/testControlR-AdvancedSearch b/client/testdata/testControlR-AdvancedSearch similarity index 100% rename from client/lib/goldens/testControlR-AdvancedSearch rename to client/testdata/testControlR-AdvancedSearch diff --git a/client/lib/goldens/testControlR-ControlC-bash b/client/testdata/testControlR-ControlC-bash similarity index 100% rename from client/lib/goldens/testControlR-ControlC-bash rename to client/testdata/testControlR-ControlC-bash diff --git a/client/lib/goldens/testControlR-ControlC-fish b/client/testdata/testControlR-ControlC-fish similarity index 100% rename from client/lib/goldens/testControlR-ControlC-fish rename to client/testdata/testControlR-ControlC-fish diff --git a/client/lib/goldens/testControlR-ControlC-zsh b/client/testdata/testControlR-ControlC-zsh similarity index 100% rename from client/lib/goldens/testControlR-ControlC-zsh rename to client/testdata/testControlR-ControlC-zsh diff --git a/client/lib/goldens/testControlR-DisplayMultiline-bash b/client/testdata/testControlR-DisplayMultiline-bash similarity index 100% rename from client/lib/goldens/testControlR-DisplayMultiline-bash rename to client/testdata/testControlR-DisplayMultiline-bash diff --git a/client/lib/goldens/testControlR-DisplayMultiline-fish b/client/testdata/testControlR-DisplayMultiline-fish similarity index 100% rename from client/lib/goldens/testControlR-DisplayMultiline-fish rename to client/testdata/testControlR-DisplayMultiline-fish diff --git a/client/lib/goldens/testControlR-DisplayMultiline-zsh b/client/testdata/testControlR-DisplayMultiline-zsh similarity index 100% rename from client/lib/goldens/testControlR-DisplayMultiline-zsh rename to client/testdata/testControlR-DisplayMultiline-zsh diff --git a/client/lib/goldens/testControlR-Final b/client/testdata/testControlR-Final similarity index 100% rename from client/lib/goldens/testControlR-Final rename to client/testdata/testControlR-Final diff --git a/client/lib/goldens/testControlR-Initial b/client/testdata/testControlR-Initial similarity index 100% rename from client/lib/goldens/testControlR-Initial rename to client/testdata/testControlR-Initial diff --git a/client/lib/goldens/testControlR-InitialExport b/client/testdata/testControlR-InitialExport similarity index 100% rename from client/lib/goldens/testControlR-InitialExport rename to client/testdata/testControlR-InitialExport diff --git a/client/lib/goldens/testControlR-InitialSearch b/client/testdata/testControlR-InitialSearch similarity index 100% rename from client/lib/goldens/testControlR-InitialSearch rename to client/testdata/testControlR-InitialSearch diff --git a/client/lib/goldens/testControlR-InitialSearchExpanded b/client/testdata/testControlR-InitialSearchExpanded similarity index 100% rename from client/lib/goldens/testControlR-InitialSearchExpanded rename to client/testdata/testControlR-InitialSearchExpanded diff --git a/client/lib/goldens/testControlR-InitialSearchNoResults b/client/testdata/testControlR-InitialSearchNoResults similarity index 100% rename from client/lib/goldens/testControlR-InitialSearchNoResults rename to client/testdata/testControlR-InitialSearchNoResults diff --git a/client/lib/goldens/testControlR-InitialSearchNoResultsThenFoundResults b/client/testdata/testControlR-InitialSearchNoResultsThenFoundResults similarity index 100% rename from client/lib/goldens/testControlR-InitialSearchNoResultsThenFoundResults rename to client/testdata/testControlR-InitialSearchNoResultsThenFoundResults diff --git a/client/lib/goldens/testControlR-Search b/client/testdata/testControlR-Search similarity index 100% rename from client/lib/goldens/testControlR-Search rename to client/testdata/testControlR-Search diff --git a/client/lib/goldens/testControlR-SelectMultiline-bash b/client/testdata/testControlR-SelectMultiline-bash similarity index 100% rename from client/lib/goldens/testControlR-SelectMultiline-bash rename to client/testdata/testControlR-SelectMultiline-bash diff --git a/client/lib/goldens/testControlR-SelectMultiline-fish b/client/testdata/testControlR-SelectMultiline-fish similarity index 100% rename from client/lib/goldens/testControlR-SelectMultiline-fish rename to client/testdata/testControlR-SelectMultiline-fish diff --git a/client/lib/goldens/testControlR-SelectMultiline-zsh b/client/testdata/testControlR-SelectMultiline-zsh similarity index 100% rename from client/lib/goldens/testControlR-SelectMultiline-zsh rename to client/testdata/testControlR-SelectMultiline-zsh diff --git a/client/lib/goldens/testControlR-bash-Disabled b/client/testdata/testControlR-bash-Disabled similarity index 100% rename from client/lib/goldens/testControlR-bash-Disabled rename to client/testdata/testControlR-bash-Disabled diff --git a/client/lib/goldens/testControlR-customColumn b/client/testdata/testControlR-customColumn similarity index 100% rename from client/lib/goldens/testControlR-customColumn rename to client/testdata/testControlR-customColumn diff --git a/client/lib/goldens/testControlR-displayedColumns b/client/testdata/testControlR-displayedColumns similarity index 100% rename from client/lib/goldens/testControlR-displayedColumns rename to client/testdata/testControlR-displayedColumns diff --git a/client/lib/goldens/testControlR-fish-Disabled b/client/testdata/testControlR-fish-Disabled similarity index 100% rename from client/lib/goldens/testControlR-fish-Disabled rename to client/testdata/testControlR-fish-Disabled diff --git a/client/lib/goldens/testControlR-zsh-Disabled b/client/testdata/testControlR-zsh-Disabled similarity index 100% rename from client/lib/goldens/testControlR-zsh-Disabled rename to client/testdata/testControlR-zsh-Disabled diff --git a/client/lib/goldens/testCustomColumns-initHistory b/client/testdata/testCustomColumns-initHistory similarity index 100% rename from client/lib/goldens/testCustomColumns-initHistory rename to client/testdata/testCustomColumns-initHistory diff --git a/client/lib/goldens/testCustomColumns-query-isAction=false b/client/testdata/testCustomColumns-query-isAction=false similarity index 100% rename from client/lib/goldens/testCustomColumns-query-isAction=false rename to client/testdata/testCustomColumns-query-isAction=false diff --git a/client/lib/goldens/testCustomColumns-query-isAction=true b/client/testdata/testCustomColumns-query-isAction=true similarity index 100% rename from client/lib/goldens/testCustomColumns-query-isAction=true rename to client/testdata/testCustomColumns-query-isAction=true diff --git a/client/lib/goldens/testCustomColumns-tquery-bash b/client/testdata/testCustomColumns-tquery-bash similarity index 100% rename from client/lib/goldens/testCustomColumns-tquery-bash rename to client/testdata/testCustomColumns-tquery-bash diff --git a/client/lib/goldens/testCustomColumns-tquery-bash-isAction b/client/testdata/testCustomColumns-tquery-bash-isAction similarity index 100% rename from client/lib/goldens/testCustomColumns-tquery-bash-isAction rename to client/testdata/testCustomColumns-tquery-bash-isAction diff --git a/client/lib/goldens/testCustomColumns-tquery-zsh b/client/testdata/testCustomColumns-tquery-zsh similarity index 100% rename from client/lib/goldens/testCustomColumns-tquery-zsh rename to client/testdata/testCustomColumns-tquery-zsh diff --git a/client/lib/goldens/testCustomColumns-tquery-zsh-isAction b/client/testdata/testCustomColumns-tquery-zsh-isAction similarity index 100% rename from client/lib/goldens/testCustomColumns-tquery-zsh-isAction rename to client/testdata/testCustomColumns-tquery-zsh-isAction diff --git a/client/lib/goldens/testDisplayTable-customColumns b/client/testdata/testDisplayTable-customColumns similarity index 100% rename from client/lib/goldens/testDisplayTable-customColumns rename to client/testdata/testDisplayTable-customColumns diff --git a/client/lib/goldens/testDisplayTable-customColumns-2 b/client/testdata/testDisplayTable-customColumns-2 similarity index 100% rename from client/lib/goldens/testDisplayTable-customColumns-2 rename to client/testdata/testDisplayTable-customColumns-2 diff --git a/client/lib/goldens/testDisplayTable-customColumns-3 b/client/testdata/testDisplayTable-customColumns-3 similarity index 100% rename from client/lib/goldens/testDisplayTable-customColumns-3 rename to client/testdata/testDisplayTable-customColumns-3 diff --git a/client/lib/goldens/testDisplayTable-customColumns-multiLineCommand b/client/testdata/testDisplayTable-customColumns-multiLineCommand similarity index 100% rename from client/lib/goldens/testDisplayTable-customColumns-multiLineCommand rename to client/testdata/testDisplayTable-customColumns-multiLineCommand diff --git a/client/lib/goldens/testDisplayTable-customColumns-trulyCustom b/client/testdata/testDisplayTable-customColumns-trulyCustom similarity index 100% rename from client/lib/goldens/testDisplayTable-customColumns-trulyCustom rename to client/testdata/testDisplayTable-customColumns-trulyCustom diff --git a/client/lib/goldens/testDisplayTable-defaultColumns b/client/testdata/testDisplayTable-defaultColumns similarity index 100% rename from client/lib/goldens/testDisplayTable-defaultColumns rename to client/testdata/testDisplayTable-defaultColumns diff --git a/client/lib/goldens/testIntegrationWithNewDevice-bash b/client/testdata/testIntegrationWithNewDevice-bash similarity index 100% rename from client/lib/goldens/testIntegrationWithNewDevice-bash rename to client/testdata/testIntegrationWithNewDevice-bash diff --git a/client/lib/goldens/testIntegrationWithNewDevice-tablebash b/client/testdata/testIntegrationWithNewDevice-tablebash similarity index 100% rename from client/lib/goldens/testIntegrationWithNewDevice-tablebash rename to client/testdata/testIntegrationWithNewDevice-tablebash diff --git a/client/lib/goldens/testIntegrationWithNewDevice-tablezsh b/client/testdata/testIntegrationWithNewDevice-tablezsh similarity index 100% rename from client/lib/goldens/testIntegrationWithNewDevice-tablezsh rename to client/testdata/testIntegrationWithNewDevice-tablezsh diff --git a/client/lib/goldens/testIntegrationWithNewDevice-zsh b/client/testdata/testIntegrationWithNewDevice-zsh similarity index 100% rename from client/lib/goldens/testIntegrationWithNewDevice-zsh rename to client/testdata/testIntegrationWithNewDevice-zsh diff --git a/client/lib/goldens/testPresaving-query b/client/testdata/testPresaving-query similarity index 100% rename from client/lib/goldens/testPresaving-query rename to client/testdata/testPresaving-query diff --git a/client/lib/goldens/testPresaving-tquery b/client/testdata/testPresaving-tquery similarity index 100% rename from client/lib/goldens/testPresaving-tquery rename to client/testdata/testPresaving-tquery diff --git a/client/lib/goldens/testPresavingOffline-query-missing b/client/testdata/testPresavingOffline-query-missing similarity index 100% rename from client/lib/goldens/testPresavingOffline-query-missing rename to client/testdata/testPresavingOffline-query-missing diff --git a/client/lib/goldens/testPresavingOffline-query-present b/client/testdata/testPresavingOffline-query-present similarity index 100% rename from client/lib/goldens/testPresavingOffline-query-present rename to client/testdata/testPresavingOffline-query-present diff --git a/client/lib/goldens/testRemoveDuplicateRows-enabled-export b/client/testdata/testRemoveDuplicateRows-enabled-export similarity index 100% rename from client/lib/goldens/testRemoveDuplicateRows-enabled-export rename to client/testdata/testRemoveDuplicateRows-enabled-export diff --git a/client/lib/goldens/testRemoveDuplicateRows-enabled-query b/client/testdata/testRemoveDuplicateRows-enabled-query similarity index 100% rename from client/lib/goldens/testRemoveDuplicateRows-enabled-query rename to client/testdata/testRemoveDuplicateRows-enabled-query diff --git a/client/lib/goldens/testRemoveDuplicateRows-enabled-tquery b/client/testdata/testRemoveDuplicateRows-enabled-tquery similarity index 100% rename from client/lib/goldens/testRemoveDuplicateRows-enabled-tquery rename to client/testdata/testRemoveDuplicateRows-enabled-tquery diff --git a/client/lib/goldens/testRemoveDuplicateRows-export b/client/testdata/testRemoveDuplicateRows-export similarity index 100% rename from client/lib/goldens/testRemoveDuplicateRows-export rename to client/testdata/testRemoveDuplicateRows-export diff --git a/client/lib/goldens/testRemoveDuplicateRows-query b/client/testdata/testRemoveDuplicateRows-query similarity index 100% rename from client/lib/goldens/testRemoveDuplicateRows-query rename to client/testdata/testRemoveDuplicateRows-query diff --git a/client/lib/goldens/testRemoveDuplicateRows-tquery b/client/testdata/testRemoveDuplicateRows-tquery similarity index 100% rename from client/lib/goldens/testRemoveDuplicateRows-tquery rename to client/testdata/testRemoveDuplicateRows-tquery diff --git a/client/lib/goldens/testUninstall-post-uninstall b/client/testdata/testUninstall-post-uninstall similarity index 100% rename from client/lib/goldens/testUninstall-post-uninstall rename to client/testdata/testUninstall-post-uninstall diff --git a/client/lib/goldens/testUninstall-post-uninstall-bash b/client/testdata/testUninstall-post-uninstall-bash similarity index 100% rename from client/lib/goldens/testUninstall-post-uninstall-bash rename to client/testdata/testUninstall-post-uninstall-bash diff --git a/client/lib/goldens/testUninstall-post-uninstall-zsh b/client/testdata/testUninstall-post-uninstall-zsh similarity index 100% rename from client/lib/goldens/testUninstall-post-uninstall-zsh rename to client/testdata/testUninstall-post-uninstall-zsh diff --git a/client/lib/goldens/testUninstall-recorded b/client/testdata/testUninstall-recorded similarity index 100% rename from client/lib/goldens/testUninstall-recorded rename to client/testdata/testUninstall-recorded diff --git a/client/lib/goldens/testUninstall-uninstall b/client/testdata/testUninstall-uninstall similarity index 100% rename from client/lib/goldens/testUninstall-uninstall rename to client/testdata/testUninstall-uninstall diff --git a/client/lib/goldens/unittestTable-truncatedTable b/client/testdata/unittestTable-truncatedTable similarity index 100% rename from client/lib/goldens/unittestTable-truncatedTable rename to client/testdata/unittestTable-truncatedTable diff --git a/client/lib/goldens/unittestTable-truncatedTable-right1 b/client/testdata/unittestTable-truncatedTable-right1 similarity index 100% rename from client/lib/goldens/unittestTable-truncatedTable-right1 rename to client/testdata/unittestTable-truncatedTable-right1 diff --git a/client/lib/goldens/unittestTable-truncatedTable-right2 b/client/testdata/unittestTable-truncatedTable-right2 similarity index 100% rename from client/lib/goldens/unittestTable-truncatedTable-right2 rename to client/testdata/unittestTable-truncatedTable-right2 diff --git a/client/lib/goldens/unittestTable-truncatedTable-right3 b/client/testdata/unittestTable-truncatedTable-right3 similarity index 100% rename from client/lib/goldens/unittestTable-truncatedTable-right3 rename to client/testdata/unittestTable-truncatedTable-right3 diff --git a/shared/testutils/testutils.go b/shared/testutils/testutils.go index 261d1a5..04404dd 100644 --- a/shared/testutils/testutils.go +++ b/shared/testutils/testutils.go @@ -27,9 +27,11 @@ const ( ) var initialWd string +var usedGoldens map[string]bool func init() { initialWd = getInitialWd() + usedGoldens = make(map[string]bool) } func getInitialWd() string { @@ -358,9 +360,28 @@ func persistLog() { checkError(err) } +func AssertAllGoldensUsed() { + if os.Getenv("HISHTORY_FILTERED_TEST") != "" { + return + } + goldensDir := path.Join(initialWd, "client/testdata/") + files, err := os.ReadDir(goldensDir) + if err != nil { + panic(fmt.Errorf("failed to list files in %s: %w", goldensDir, err)) + } + for _, f := range files { + _, present := usedGoldens[path.Base(f.Name())] + if !present && !strings.Contains(f.Name(), "unittestTable-truncatedTable") { + panic(fmt.Errorf("golden file %v was never used", path.Base(f.Name()))) + } + } + fmt.Println("Validated that all goldens in testdata/ were referenced!") +} + func CompareGoldens(t testing.TB, out, goldenName string) { + usedGoldens[goldenName] = true out = normalizeHostnames(out) - goldenPath := path.Join(initialWd, "client/lib/goldens/", goldenName) + goldenPath := path.Join(initialWd, "client/testdata/", goldenName) expected, err := os.ReadFile(goldenPath) expected = []byte(normalizeHostnames(string(expected))) if err != nil {