From c8d4fff6cc42e4e5dd48ffcc95e63446432180e8 Mon Sep 17 00:00:00 2001 From: Dave Grijalva Date: Tue, 12 Apr 2016 14:52:39 -0700 Subject: [PATCH] verify that an error is always returned if token.Valid is false (and the reverse) --- parser_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parser_test.go b/parser_test.go index 622a423..8448986 100644 --- a/parser_test.go +++ b/parser_test.go @@ -183,6 +183,10 @@ func TestParser_Parse(t *testing.T) { t.Errorf("[%v] Invalid token passed validation", data.name) } + if (err == nil && !token.Valid) || (err != nil && token.Valid) { + t.Errorf("[%v] Inconsistent behavior between returned error and token.Valid") + } + if data.errors != 0 { if err == nil { t.Errorf("[%v] Expecting error. Didn't get one.", data.name)