From 1e1c7063fe7c30ffd501d862002a352c6a017766 Mon Sep 17 00:00:00 2001 From: Adam Wasila Date: Fri, 17 Jan 2020 00:27:39 +0100 Subject: [PATCH] Add test variant for no-hook case --- shutdown_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shutdown_test.go b/shutdown_test.go index 7089dcf..9485331 100644 --- a/shutdown_test.go +++ b/shutdown_test.go @@ -16,6 +16,14 @@ func TestShutdowner(t *testing.T) { atomic.AddInt32(&hookCounter, 1) } + Convey("When no hook is registered and shutdown is called", func() { + s.callShutdownHooks() + + Convey("Hook will not be called on shutdown", func() { + So(hookCounter, ShouldEqual, 1) + }) + }) + Convey("When hook is registered and shutdown is called", func() { s.register(hook) s.callShutdownHooks()