Debian Codegraph @

token/token_test.go

raw
1 package token
2
3 import (
4 "bytes"
5 "reflect"
6 "testing"
7 )
8
9 func TestTokenValue(t *testing.T) {
10 token := New(ALPHA_NUMERIC, []byte("abc"), 0)
11
12 if !bytes.Equal(token.Value(), []byte("abc")) {
13 t.Logf("Expected Value to return %q, got %q\n", "abc", token.Value())
14 t.Fail()
15 }
16 }
17
18 func TestTokenType(t *testing.T) {
19 token := New(ALPHA_NUMERIC, []byte("abc"), 0)
20
21 if !reflect.DeepEqual(token.Type(), ALPHA_NUMERIC) {
22 t.Logf("Expected Type to return %q, got %q\n", ALPHA_NUMERIC, token.Type())
23 t.Fail()
24 }
25 }
26
27 func TestTokenPos(t *testing.T) {
28 token := New(ALPHA_NUMERIC, []byte("abc"), 0)
29
30 if !reflect.DeepEqual(token.Pos(), 0) {
31 t.Logf("Expected Type to return %d, got %d\n", 0, token.Pos())
32 t.Fail()
33 }
34 }