From 7f447978a29e1abd371de144802b5470d0f7d7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Sat, 28 Oct 2017 23:15:48 +0300 Subject: [PATCH] Fixing tests to compare recovered value with the error instead of nil --- server/server/stack_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/server/stack_test.go b/server/server/stack_test.go index a97867d..9ac88ee 100644 --- a/server/server/stack_test.go +++ b/server/server/stack_test.go @@ -39,7 +39,7 @@ func TestStringStack_CanPush(t *testing.T) { func TestStringStack_StackOverflows(t *testing.T) { defer func() { - if r := recover(); r == nil { + if r := recover(); r != StackOverflowError { t.Errorf("StringStack: Capacity of 0 doesn't overflow on Push()!") } }() @@ -50,7 +50,7 @@ func TestStringStack_StackOverflows(t *testing.T) { func TestStringStack_InvalidType(t *testing.T) { defer func() { - if r := recover(); r == nil { + if r := recover(); r != StackInvalidTypeError { t.Errorf("StringStack: Push() pushed a non-string type.") } }() @@ -118,7 +118,7 @@ func TestStringStack_Top(t *testing.T) { func TestStringStack_TopUnderflow(t *testing.T) { defer func() { - if r := recover(); r == nil { + if r := recover(); r != StackUnderflowError { t.Errorf("StringStack: Top() on empty stack didn't underflow.") } }()