Skip to content

Commit 43afb4f

Browse files
authored
Merge pull request #11 from jrisc/test_str_fmt
Fix Throwf calls by adding formatting directives
2 parents 86160d5 + a7c006a commit 43afb4f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

exc/exc_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ type myException struct {
1616
func TestTry(x *testing.T) {
1717
t := (*test.T)(x)
1818
err := Try(func() {
19-
Throwf("this is a test")
19+
Throwf("%s", "this is a test")
2020
}).Error()
2121
t.Assert(err != nil, "wanted a non nil error got %v", err)
2222
}
2323

2424
func TestTryPropogate(x *testing.T) {
2525
badfunc := func() {
2626
Try(func() {
27-
Throwf("test", "this is a test")
27+
Throwf("test: %s", "this is a test")
2828
}).Unwind()
2929
}
3030
t := (*test.T)(x)
@@ -37,7 +37,7 @@ func TestTryPropogate(x *testing.T) {
3737
func TestTryCatch(x *testing.T) {
3838
t := (*test.T)(x)
3939
err := Try(func() {
40-
Throwf("this is a test")
40+
Throwf("%s", "this is a test")
4141
}).Catch(&Exception{}, func(e Throwable) {
4242
t.Log("Caught", e)
4343
}).Error()
@@ -49,7 +49,7 @@ func TestTryCatch(x *testing.T) {
4949
func TestTryCatchMyExceptionFail(x *testing.T) {
5050
t := (*test.T)(x)
5151
err := Try(func() {
52-
Throwf("this is a test")
52+
Throwf("%s", "this is a test")
5353
}).Catch(&myException{}, func(e Throwable) {
5454
t.Log("Caught", e)
5555
}).Error()
@@ -79,7 +79,7 @@ func TestTryCatchMyExceptionWithException(x *testing.T) {
7979
func TestTryCatchReraise(x *testing.T) {
8080
t := (*test.T)(x)
8181
err := Try(func() {
82-
Throwf("this is a test")
82+
Throwf("%s", "this is a test")
8383
}).Catch(&Exception{}, func(e Throwable) {
8484
t.Log("Caught", e)
8585
Rethrow(e, Errorf("rethrow"))
@@ -93,7 +93,7 @@ func TestTryCatchFinally(x *testing.T) {
9393
t := (*test.T)(x)
9494
finally := false
9595
err := Try(func() {
96-
Throwf("this is a test")
96+
Throwf("%s", "this is a test")
9797
}).Catch(&Exception{}, func(e Throwable) {
9898
t.Log("Caught", e)
9999
}).Finally(func() {
@@ -108,7 +108,7 @@ func TestTryCatchReraiseFinally(x *testing.T) {
108108
t := (*test.T)(x)
109109
finally := false
110110
err := Try(func() {
111-
Throwf("this is a test")
111+
Throwf("%s", "this is a test")
112112
}).Catch(&Exception{}, func(e Throwable) {
113113
t.Log("Caught", e)
114114
Rethrow(e, Errorf("rethrow"))
@@ -124,7 +124,7 @@ func TestTryFinally(x *testing.T) {
124124
t := (*test.T)(x)
125125
finally := false
126126
err := Try(func() {
127-
Throwf("this is a test")
127+
Throwf("%s", "this is a test")
128128
}).Finally(func() {
129129
t.Log("finally")
130130
finally = true

0 commit comments

Comments
 (0)