package langext import ( "errors" "git.blackforestbytes.com/BlackForestBytes/goext/tst" "testing" ) func TestMustSuccess(t *testing.T) { v := Must(42, nil) tst.AssertEqual(t, v, 42) s := Must("hello", nil) tst.AssertEqual(t, s, "hello") } func TestMustPanics(t *testing.T) { defer func() { if r := recover(); r == nil { t.Errorf("expected panic on error") } }() Must(0, errors.New("boom")) } func TestMustBoolSuccess(t *testing.T) { v := MustBool(42, true) tst.AssertEqual(t, v, 42) } func TestMustBoolPanics(t *testing.T) { defer func() { if r := recover(); r == nil { t.Errorf("expected panic on not ok") } }() MustBool(0, false) }