peco.peco/selection_test.go
Daisuke Maki b848c6c0a2 Implement sticky selection
By default this feature is disabled, keeping backward compatibiity.
This should fix #230
2015-03-17 15:37:51 +09:00

26 lines
486 B
Go

package peco
import "testing"
func TestSelection(t *testing.T) {
s := NewSelection()
alice := NewRawLine("Alice", false)
s.Add(alice)
if s.Len() != 1 {
t.Errorf("expected Len = 1, got %d", s.Len())
}
s.Add(NewRawLine("Bob", false))
if s.Len() != 2 {
t.Errorf("expected Len = 2, got %d", s.Len())
}
s.Add(alice)
if s.Len() != 2 {
t.Errorf("expected Len = 2, got %d", s.Len())
}
s.Remove(alice)
if s.Len() != 1 {
t.Errorf("expected Len = 1, got %d", s.Len())
}
}