mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-23 00:34:27 +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 "))
|
|
}
|