diff options
Diffstat (limited to 'sdk/testing.go')
-rw-r--r-- | sdk/testing.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sdk/testing.go b/sdk/testing.go index e57f1f79d..ae1e44888 100644 --- a/sdk/testing.go +++ b/sdk/testing.go @@ -217,6 +217,22 @@ func (h *TestHelper) AssertDeepEquals(message string, expected interface{}, actu } } +func (h *TestHelper) AssertPanic(message string, funcThatShouldPanic func()) { + h.t.Helper() + panicked := false + func() { + defer func() { + if x := recover(); x != nil { + panicked = true + } + }() + funcThatShouldPanic() + }() + if !panicked { + h.t.Error(message) + } +} + // Encapsulates result of processing an SDK definition. Provides support for // checking the state of the build structures. type testSdkResult struct { |