mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-01 20:53:13 +01:00
17 lines
559 B
Go
17 lines
559 B
Go
|
package tui
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestCalculateWordBoundaries(t *testing.T) {
|
||
|
require.Equal(t, []int{0, 3}, calculateWordBoundaries("foo"))
|
||
|
require.Equal(t, []int{0, 3, 7}, calculateWordBoundaries("foo bar"))
|
||
|
require.Equal(t, []int{0, 3, 7}, calculateWordBoundaries("foo-bar"))
|
||
|
require.Equal(t, []int{0, 3, 7, 11}, calculateWordBoundaries("foo-bar baz"))
|
||
|
require.Equal(t, []int{0, 3, 10, 16}, calculateWordBoundaries("foo-- -bar - baz"))
|
||
|
require.Equal(t, []int{0, 3}, calculateWordBoundaries("foo "))
|
||
|
}
|