Commit 6c2abbbf authored by Kirill Smelkov's avatar Kirill Smelkov

raisef: Fix it wrt erraddcallingcontext()

like in 302aaaea (raiseif: Fix it wrt erraddcallingcontext()) now fix
raisef, which I originally overlooked.
parent 3a7b390c
...@@ -61,7 +61,7 @@ func raise(arg interface{}) { ...@@ -61,7 +61,7 @@ func raise(arg interface{}) {
// raise formatted string // raise formatted string
func raisef(format string, a ...interface{}) { func raisef(format string, a ...interface{}) {
raise(fmt.Sprintf(format, a...)) panic(aserror(fmt.Sprintf(format, a...)))
} }
// raise if err != nil // raise if err != nil
......
...@@ -116,11 +116,20 @@ func do_raise3if1() { ...@@ -116,11 +116,20 @@ func do_raise3if1() {
do_raise3if() do_raise3if()
} }
func do_raise4f() {
raisef("%d", 4)
}
func do_raise4f1() {
do_raise4f()
}
func TestErrAddCallingContext(t *testing.T) { func TestErrAddCallingContext(t *testing.T) {
var tests = []struct{ f func(); wanterrcontext string } { var tests = []struct{ f func(); wanterrcontext string } {
{do_raise11, "do_raise11: do_raise1: 1"}, {do_raise11, "do_raise11: do_raise1: 1"},
{do_raise3if1, "do_raise3if1: do_raise3if: 3"}, {do_raise3if1, "do_raise3if1: do_raise3if: 3"},
{do_raise4f1, "do_raise4f1: do_raise4f: 4"},
} }
for _, tt := range tests { for _, tt := range tests {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment