feat: issue #260

Dramatically improves the usefulness of `--search` by outputting
"chunked" results. This removes the need (usually) to search and then
manually open a cheatsheet.
This commit is contained in:
Chris Lane
2020-02-15 15:56:25 -05:00
parent a6c25d4b9c
commit bc623da74b
2 changed files with 9 additions and 14 deletions

View File

@@ -36,7 +36,7 @@ func TestSearchSingleMatch(t *testing.T) {
// mock a cheatsheet
sheet := Sheet{
Text: "The quick brown fox\njumped over\nthe lazy dog.",
Text: "The quick brown fox\njumped over\n\nthe lazy dog.",
}
// compile the search regex
@@ -49,7 +49,7 @@ func TestSearchSingleMatch(t *testing.T) {
matches := sheet.Search(reg)
// specify the expected results
want := "The quick brown fox"
want := "The quick brown fox\njumped over"
// assert that the correct matches were returned
if matches != want {
@@ -67,7 +67,7 @@ func TestSearchMultiMatch(t *testing.T) {
// mock a cheatsheet
sheet := Sheet{
Text: "The quick brown fox\njumped over\nthe lazy dog.",
Text: "The quick brown fox\n\njumped over\n\nthe lazy dog.",
}
// compile the search regex
@@ -80,7 +80,7 @@ func TestSearchMultiMatch(t *testing.T) {
matches := sheet.Search(reg)
// specify the expected results
want := "The quick brown fox\nthe lazy dog."
want := "The quick brown fox\n\nthe lazy dog."
// assert that the correct matches were returned
if !reflect.DeepEqual(matches, want) {