File: scanner_test.go

package info (click to toggle)
golang-github-alecthomas-kong 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 620 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package kong

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestScannerTake(t *testing.T) {
	s := Scan("a", "b", "c")
	require.Equal(t, s.Pop().Value, "a")
	require.Equal(t, s.Pop().Value, "b")
	require.Equal(t, s.Pop().Value, "c")
	require.Equal(t, s.Pop().Type, EOLToken)
}

func TestScannerPeek(t *testing.T) {
	s := Scan("a", "b", "c")
	require.Equal(t, s.Peek().Value, "a")
	require.Equal(t, s.Pop().Value, "a")
	require.Equal(t, s.Peek().Value, "b")
	require.Equal(t, s.Pop().Value, "b")
	require.Equal(t, s.Peek().Value, "c")
	require.Equal(t, s.Pop().Value, "c")
	require.Equal(t, s.Peek().Type, EOLToken)
}