Remove gotestyourself.
This commit is contained in:
@@ -91,6 +91,8 @@ func (s *Scanner) Pop() Token {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PopValue token, or panic with Error.
|
// PopValue token, or panic with Error.
|
||||||
|
//
|
||||||
|
// "context" is used to assist the user if the value can not be popped, eg. "expected <context> value but got <type>"
|
||||||
func (s *Scanner) PopValue(context string) string {
|
func (s *Scanner) PopValue(context string) string {
|
||||||
t := s.Pop()
|
t := s.Pop()
|
||||||
if !t.IsValue() {
|
if !t.IsValue() {
|
||||||
|
|||||||
+12
-12
@@ -3,24 +3,24 @@ package kong
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gotestyourself/gotestyourself/assert"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestScannerTake(t *testing.T) {
|
func TestScannerTake(t *testing.T) {
|
||||||
s := Scan("a", "b", "c")
|
s := Scan("a", "b", "c")
|
||||||
assert.Assert(t, s.Pop().Value == "a")
|
require.Equal(t, s.Pop().Value, "a")
|
||||||
assert.Assert(t, s.Pop().Value == "b")
|
require.Equal(t, s.Pop().Value, "b")
|
||||||
assert.Assert(t, s.Pop().Value == "c")
|
require.Equal(t, s.Pop().Value, "c")
|
||||||
assert.Assert(t, s.Pop().Type == EOLToken)
|
require.Equal(t, s.Pop().Type, EOLToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestScannerPeek(t *testing.T) {
|
func TestScannerPeek(t *testing.T) {
|
||||||
s := Scan("a", "b", "c")
|
s := Scan("a", "b", "c")
|
||||||
assert.Assert(t, s.Peek().Value == "a")
|
require.Equal(t, s.Peek().Value, "a")
|
||||||
assert.Assert(t, s.Pop().Value == "a")
|
require.Equal(t, s.Pop().Value, "a")
|
||||||
assert.Assert(t, s.Peek().Value == "b")
|
require.Equal(t, s.Peek().Value, "b")
|
||||||
assert.Assert(t, s.Pop().Value == "b")
|
require.Equal(t, s.Pop().Value, "b")
|
||||||
assert.Assert(t, s.Peek().Value == "c")
|
require.Equal(t, s.Peek().Value, "c")
|
||||||
assert.Assert(t, s.Pop().Value == "c")
|
require.Equal(t, s.Pop().Value, "c")
|
||||||
assert.Assert(t, s.Peek().Type == EOLToken)
|
require.Equal(t, s.Peek().Type, EOLToken)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user