MCPcopy Index your code
hub / github.com/micro-editor/micro / TestStack

Function TestStack

internal/buffer/stack_test.go:10–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestStack(t *testing.T) {
11 s := new(TEStack)
12 e1 := &TextEvent{
13 EventType: TextEventReplace,
14 Time: time.Now(),
15 }
16 e2 := &TextEvent{
17 EventType: TextEventInsert,
18 Time: time.Now(),
19 }
20 s.Push(e1)
21 s.Push(e2)
22
23 p := s.Peek()
24 assert.Equal(t, p.EventType, TextEventInsert)
25 p = s.Pop()
26 assert.Equal(t, p.EventType, TextEventInsert)
27 p = s.Peek()
28 assert.Equal(t, p.EventType, TextEventReplace)
29 p = s.Pop()
30 assert.Equal(t, p.EventType, TextEventReplace)
31 p = s.Pop()
32 assert.Nil(t, p)
33 p = s.Peek()
34 assert.Nil(t, p)
35}

Callers

nothing calls this directly

Calls 3

PushMethod · 0.80
PeekMethod · 0.80
PopMethod · 0.80

Tested by

no test coverage detected