Skip to content

Commit

Permalink
Add unmock test
Browse files Browse the repository at this point in the history
  • Loading branch information
lesiw committed Aug 12, 2024
1 parent 7257048 commit a389842
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/testdata/m0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ func TestStub(t *testing.T) {
}
}

func TestUnmock(t *testing.T) {
t.Cleanup(func() { pkg.SimpleCalled = false })
var m0 M0
m0._Simple_Stub()
m0.Simple()
if pkg.SimpleCalled {
t.Error("want mock, got Simple() call")
}
m0._Simple_Do(nil)
m0.Simple()
if !pkg.SimpleCalled {
t.Error("want Simple() call, got mock")
}
}

func TestOneResult(t *testing.T) {
var m0 M0
want := errors.New("error result")
Expand Down

0 comments on commit a389842

Please sign in to comment.