mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-21 04:17:45 +02:00
Remove outdated TODO + fix TODO to add tests for the table output
This commit is contained in:
parent
423b13733a
commit
6093d06110
@ -309,12 +309,20 @@ echo thisisrecorded`)
|
||||
t.Fatalf("output is missing expected item %#v: %#v", item, out)
|
||||
}
|
||||
}
|
||||
// TODO
|
||||
// match, err = regexp.MatchString(`.*~/.*\s+[a-zA-Z]{3} \d+ 2022 \d\d:\d\d:\d\d PST\s+\d{1,2}ms\s+0\s+echo thisisrecorded.*`, out)
|
||||
// shared.Check(t, err)
|
||||
// if !match {
|
||||
// t.Fatalf("output is missing the row for `echo thisisrecorded`: %v", out)
|
||||
// }
|
||||
|
||||
// Test the actual table output
|
||||
hostnameMatcher := `\S+`
|
||||
tableDividerMatcher := `\s+`
|
||||
pathMatcher := `~/[a-zA-Z_0-9/-]+`
|
||||
datetimeMatcher := `[a-zA-Z]{3}\s\d{2}\s\d{4}\s[0-9:]+\s[A-Z]{3}`
|
||||
runtimeMatcher := `[0-9ms]+`
|
||||
exitCodeMatcher := `0`
|
||||
cmdMatcher := `echo thisisrecorded`
|
||||
match, err := regexp.MatchString(hostnameMatcher+tableDividerMatcher+pathMatcher+tableDividerMatcher+datetimeMatcher+tableDividerMatcher+runtimeMatcher+tableDividerMatcher+exitCodeMatcher+tableDividerMatcher+cmdMatcher+tableDividerMatcher+`\n`, out)
|
||||
shared.Check(t, err)
|
||||
if !match {
|
||||
t.Fatalf("output is missing the row for `echo thisisrecorded`: %v", out)
|
||||
}
|
||||
|
||||
// Test querying for a specific command
|
||||
out = hishtoryQuery(t, tester, "foo")
|
||||
|
@ -70,5 +70,3 @@ func TestParseTimeGenerously(t *testing.T) {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Maybe some dedicated unit tests for Search()
|
||||
|
Loading…
x
Reference in New Issue
Block a user