Skip to content

Commit

Permalink
feat: pass basic test again
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoust committed Nov 14, 2023
1 parent d393ec9 commit a009d02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/sessions/search/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func Search(events []sessions.Event, pattern string, progress chan<- int) (resul

if len(nextFull) > 0 {
realAddress := address
realAddress.Offset++
if realAddress == nextFull[0].Begin {
fullEnd := nextFull[0]
fullEnd.Appearances[0].To = cell.Vec2
Expand All @@ -315,6 +314,7 @@ func Search(events []sessions.Event, pattern string, progress chan<- int) (resul
matchIndex++
result := SearchResult{}
result.Begin = full.End
result.Begin.Offset--
appearance := Appearance{}
appearance.Begin = result.Begin
appearance.From = cell.Vec2
Expand Down
12 changes: 5 additions & 7 deletions pkg/sessions/search/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ func TestGetPartial(t *testing.T) {
}

func TestBasic(t *testing.T) {
results, err := Search(
makeWrites(
sim := sessions.NewSimulator().
Add(
"foo",
"bar",
"baz",
),
"bar",
nil,
)
)
results, err := Search(sim.Events(), "bar", nil)
require.NoError(t, err)
require.Equal(t, 1, len(results))
require.Equal(t, SearchResult{
Expand All @@ -59,7 +57,7 @@ func TestBasic(t *testing.T) {
C: 3,
},
To: geom.Vec2{
C: 6,
C: 5,
},
},
},
Expand Down

0 comments on commit a009d02

Please sign in to comment.