Skip to content

Commit

Permalink
Merge pull request #117 from bayashi/tiny-fix
Browse files Browse the repository at this point in the history
no overwrite package name
  • Loading branch information
bayashi committed Feb 23, 2024
2 parents b8e8bf3 + 5b403dd commit 8684f14
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ func (a *testingA) NoError(t *testing.T, testNames ...string) *testingA {

if a.got != nil {
var reason string
w := w.Got(a.got)
wi := w.Got(a.got)
if !a.isTypeOfError() {
reason = reason_WrongType
w.Message(notice_Label, "It should be type of error")
wi.Message(notice_Label, "It should be type of error")
} else {
reason = reason_UnexpectedlyError
w.Message(notice_Label, "No error")
wi.Message(notice_Label, "No error")
}
return a.fail(w, reason)
return a.fail(wi, reason)
}

return a
Expand Down
8 changes: 4 additions & 4 deletions nil.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func (a *testingA) Nil(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if !a.isNil() {
w := w.Got(a.got)
return a.fail(w, reason_ExpectNilButNotNil)
wi := w.Got(a.got)
return a.fail(wi, reason_ExpectNilButNotNil)
}

return a
Expand All @@ -36,8 +36,8 @@ func (a *testingA) NotNil(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if a.isNil() {
w := w.Got(a.got)
return a.fail(w, reason_ExpectIsNotNil)
wi := w.Got(a.got)
return a.fail(wi, reason_ExpectIsNotNil)
}

return a
Expand Down
32 changes: 16 additions & 16 deletions panic.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ func (a *testingA) Panic(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if !isFuncType(a.got) {
w := w.Got(a.got)
return a.fail(w, reason_GotShouldFuncType)
wi := w.Got(a.got)
return a.fail(wi, reason_GotShouldFuncType)
}

if didPanic, _ := didPanic(a.got.(func())); !didPanic {
w := w.Got(a.got)
return a.fail(w, reason_ExpectPanic)
wi := w.Got(a.got)
return a.fail(wi, reason_ExpectPanic)
}

return a
Expand All @@ -41,25 +41,25 @@ func (a *testingA) PanicMessage(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if !isFuncType(a.got) {
w := w.Got(a.got)
return a.fail(w, reason_GotShouldFuncType)
wi := w.Got(a.got)
return a.fail(wi, reason_GotShouldFuncType)
}

didPanic, panicMessage := didPanic(a.got.(func()))

if !didPanic {
w := w.Got(a.got)
return a.fail(w, reason_ExpectPanic)
wi := w.Got(a.got)
return a.fail(wi, reason_ExpectPanic)
}

if !objectsAreSameType(a.expect, panicMessage) {
w := w.Got(panicMessage).Message(gotFunc_Label, w.Dump(a.got)).Expect(a.expect)
return a.fail(w, reason_PanicButMsgwrongType)
wi := w.Got(panicMessage).Message(gotFunc_Label, w.Dump(a.got)).Expect(a.expect)
return a.fail(wi, reason_PanicButMsgwrongType)
}

if !objectsAreSame(a.expect, panicMessage) {
w := w.Got(panicMessage).Message(gotFunc_Label, w.Dump(a.got)).Expect(a.expect)
return a.fail(w, reason_PanicButMsgDifferent)
wi := w.Got(panicMessage).Message(gotFunc_Label, w.Dump(a.got)).Expect(a.expect)
return a.fail(wi, reason_PanicButMsgDifferent)
}

return a
Expand All @@ -76,13 +76,13 @@ func (a *testingA) NoPanic(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if !isFuncType(a.got) {
w := w.Got(a.got)
return a.fail(w, reason_GotShouldFuncType)
wi := w.Got(a.got)
return a.fail(wi, reason_GotShouldFuncType)
}

if didPanic, panicMessage := didPanic(a.got.(func())); didPanic {
w := w.Got(panicMessage).Message(gotFunc_Label, w.Dump(a.got))
return a.fail(w, reason_ExpectNoPanic)
wi := w.Got(panicMessage).Message(gotFunc_Label, w.Dump(a.got))
return a.fail(wi, reason_ExpectNoPanic)
}

return a
Expand Down
8 changes: 4 additions & 4 deletions true.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func (a *testingA) True(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if !a.isBool() {
w := w.Got(a.got).Message(notice_Label, "It should be boolean")
return a.fail(w, reason_WrongType)
wi := w.Got(a.got).Message(notice_Label, "It should be boolean")
return a.fail(wi, reason_WrongType)
}

if a.got != true {
Expand All @@ -40,8 +40,8 @@ func (a *testingA) False(t *testing.T, testNames ...string) *testingA {
a.t.Helper()

if !a.isBool() {
w := w.Got(a.got).Message(notice_Label, "It should be boolean")
return a.fail(w, reason_WrongType)
wi := w.Got(a.got).Message(notice_Label, "It should be boolean")
return a.fail(wi, reason_WrongType)
}

if a.got != false {
Expand Down

0 comments on commit 8684f14

Please sign in to comment.