mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
26 lines
486 B
Go
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())
|
|
}
|
|
}
|