Change project layout and use go.mod

This commit is contained in:
Zachary Yedidia
2019-02-03 23:17:24 -05:00
parent c7f2c9c704
commit 0612af1590
103 changed files with 154 additions and 194 deletions

View File

@@ -0,0 +1,35 @@
package buffer
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestStack(t *testing.T) {
s := new(TEStack)
e1 := &TextEvent{
EventType: TextEventReplace,
Time: time.Now(),
}
e2 := &TextEvent{
EventType: TextEventInsert,
Time: time.Now(),
}
s.Push(e1)
s.Push(e2)
p := s.Peek()
assert.Equal(t, p.EventType, TextEventInsert)
p = s.Pop()
assert.Equal(t, p.EventType, TextEventInsert)
p = s.Peek()
assert.Equal(t, p.EventType, TextEventReplace)
p = s.Pop()
assert.Equal(t, p.EventType, TextEventReplace)
p = s.Pop()
assert.Nil(t, p)
p = s.Peek()
assert.Nil(t, p)
}