Debian Codegraph @

debian/go/src/github.com/prashantv/gostub/utils_for_test.go

raw
1 package gostub
2
3 import (
4 "fmt"
5 "reflect"
6 "strings"
7 "testing"
8 )
9
10 func expectVal(t *testing.T, expected interface{}, got interface{}) {
11 if !reflect.DeepEqual(expected, got) {
12 t.Errorf("expected %v but got %v", expected, got)
13 }
14 }
15
16 func expectPanic(t *testing.T, msg string, expectedPanic string) {
17 if r := recover(); r != nil {
18 got := fmt.Sprint(r)
19 if !strings.Contains(got, expectedPanic) {
20 t.Errorf("panic message expected to contain %q, got %v", expectedPanic, got)
21 }
22 return
23 }
24
25 t.Errorf("%v expected to panic", msg)
26 }