Skip to content

Commit e6f09c6

Browse files
committed
Remove FailNowOn and FailNotNow
1 parent 753e4d0 commit e6f09c6

File tree

4 files changed

+2
-71
lines changed

4 files changed

+2
-71
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestProtoMessages(t *testing.T) {
8989

9090
## Helper Methods
9191

92-
* **FailNow**, **FailNowOn**: Halt the test case immediately when the test fails
92+
* **FailNow**: Halt the test case immediately when the test fails
9393
* **Diff**: Get diff of 2 objects on anywhere
9494
* **Dump**: Get dumped string of objects on anywhere
9595
* **Debug**: Show debug info only on failure

actually_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestExpect(t *testing.T) {
4040
t.Errorf("`Expect()` was broken. Expected:%#v, but Actual:%#v", i, a.expect)
4141
}
4242
if a.failNow != nil && *a.failNow != false {
43-
t.Errorf("`FailNotNow()` was broken. Expected:%#v, but Actual:%#v", false, a.failNow)
43+
t.Errorf("Initial failNow value is wrong. Expected:%#v, but Actual:%#v", false, a.failNow)
4444
}
4545
}
4646

actually_util_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ import (
77
)
88

99
func TestFail(t *testing.T) {
10-
{
11-
a := FailNotNow()
12-
if *a.failNow != false {
13-
t.Errorf("`FailNotNow()` was broken. Expected:%#v, but Actual:%#v", false, a.failNow)
14-
}
15-
}
16-
1710
a := Got(nil)
1811
if a.failNow != nil && *a.failNow != false {
1912
t.Errorf("Default failNow is false, but Actual:%#v", a.failNow)
@@ -24,11 +17,6 @@ func TestFail(t *testing.T) {
2417
t.Errorf("`FailNow()` was broken. Expected:%#v, but Actual:%#v", true, a.failNow)
2518
}
2619

27-
a.FailNotNow()
28-
if *a.failNow != false {
29-
t.Errorf("`FailNotNow()` was broken. Expected:%#v, but Actual:%#v", false, a.failNow)
30-
}
31-
3220
a.t = t
3321

3422
stub()

helpers.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -41,63 +41,6 @@ func FailNow(fn func()) {
4141
fn()
4242
}
4343

44-
// FailNowOn function turns an ENV flag on to stop further test execution immediately if one test fails.
45-
// This switch is enabled within the test. Not only during function.
46-
/*
47-
func Test(t *testing.T) {
48-
actually.FailNowOn(t)
49-
actually.Got(something).Nil(t) // Fail Now
50-
actually.Got(something).Expect(something).Same(t) // Fail Now
51-
}
52-
*/
53-
// Warning: Do not use FailNowOn along with t.Parallel.
54-
func FailNowOn(t *testing.T) {
55-
t.Setenv(envKey_FailNow, envKey_FailNow)
56-
}
57-
58-
// FailNotNowOn function turns an ENV flag off to stop further test execution immediately if one test fails.
59-
// If you want to turn the ENV flag on, then you should call `FailNowOn`.
60-
/*
61-
func Test(t *testing.T) {
62-
// turn on to fail right now
63-
actually.FailNowOn(t)
64-
actually.Got(something).Nil(t) // Fail Now
65-
actually.Got(something).Expect(something).Same(t) // Fail Now
66-
67-
// turn off
68-
actually.FailNotNowOn(t)
69-
actually.Got(something).Nil(t) // NOT Fail Now
70-
actually.Got(something).Expect(something).Same(t) // NOT Fail Now
71-
72-
// Fail Now by FailNow() in the chain
73-
actually.Got(something).FailNow().Nil(t) // Fail Now
74-
75-
// Again, turn on to fail right now
76-
actually.FailNowOn(t)
77-
actually.Got(something).Nil(t) // Fail Now
78-
}
79-
*/
80-
// This switch is enabled within the test. Not only during function.
81-
func FailNotNowOn(t *testing.T) {
82-
t.Setenv(envKey_FailNow, "")
83-
}
84-
85-
// FailNotNow turns a flag off, so that even if the test fails, execution does not stop immediately.
86-
/*
87-
It behaves this way by default. If you want the opposite behavior, call `FailNow` method.
88-
*/
89-
// Deprecated: Anyone uses? This method will be removed in the near future.
90-
func FailNotNow() *testingA {
91-
return &testingA{
92-
failNow: failNowPtr(false),
93-
}
94-
}
95-
func (a *testingA) FailNotNow() *testingA {
96-
a.failNow = failNowPtr(false)
97-
98-
return a
99-
}
100-
10144
// X turns on a flag to show test values as raw in a fail report.
10245
func (a *testingA) X() *testingA {
10346
a.showRawData = true

0 commit comments

Comments
 (0)