Revert "Revert all commits since v0.223 to enable me to release a patch on top of v0.223"

This reverts commit 68ed9f2d5d.
This commit is contained in:
David Dworken
2023-09-29 18:21:23 -07:00
parent 68ed9f2d5d
commit 0b57034c39
17 changed files with 567 additions and 254 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/ddworken/hishtory/shared/testutils"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
)
type operation struct {
@@ -79,11 +80,11 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
switchToDevice(&devices, op.device)
if op.cmd != "" {
_, err := tester.RunInteractiveShellRelaxed(t, op.cmd)
testutils.Check(t, err)
require.NoError(t, err)
}
if op.redactQuery != "" {
_, err := tester.RunInteractiveShellRelaxed(t, `HISHTORY_REDACT_FORCE=1 hishtory redact `+op.redactQuery)
testutils.Check(t, err)
require.NoError(t, err)
}
// Calculate the expected output of hishtory export
@@ -111,7 +112,7 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
// Run hishtory export and check the output
out, err := tester.RunInteractiveShellRelaxed(t, `hishtory export -export -pipefail`)
testutils.Check(t, err)
require.NoError(t, err)
expectedOutput := keyToCommands[op.device.key]
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch for input=%#v key=%s (-expected +got):\n%s\nout=%#v", input, op.device.key, diff, out)
@@ -122,7 +123,7 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
for _, op := range ops {
switchToDevice(&devices, op.device)
out, err := tester.RunInteractiveShellRelaxed(t, `hishtory export -export -pipefail`)
testutils.Check(t, err)
require.NoError(t, err)
expectedOutput := keyToCommands[op.device.key]
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch for key=%s (-expected +got):\n%s\nout=%#v", op.device.key, diff, out)