Basic Interface - bayashi/actually GitHub Wiki
Assertion interface
Specific interfaces like below.
actually.Got(v).True(t)
actually.Got(v).Expect(vv).Same(t)
Set any value by Got, then call assertion method with *testing.T. If you want to assert 2 objects, then you set one more value by Expect. This is basic interface of Actually.
You can call the two methods Got and Expect in any order.
And all assertion methods for 2 objects on Actually have Same or NotSame prefix.
Fail report
This is a report of actually on fail.
=== RUN Test
foo_test.go:13: Test
Fail reason: Not same value
Type: Expect:string, Got:string
Expected: "foo\nbar\nbug"
Actually got: "foo\nbar\nbaz"
Diff details: --- Expected
+++ Actually got
@@ -2,2 +2,2 @@
bar
-bug
+baz
Trace: /path/to/foo/foo_test.go:13
--- FAIL: Test (0.00s)
Actually's fail report has been implemented for that you can obviously see WHY/HOW THIS TEST WAS FAILED.
ACTUALLY_TRACE_SOURCE
If you set true value (i.e. "1", "true" or "TRUE" etc) into ENV:ACTUALLY_TRACE_SOURCE on running a test, then you can see a piece of source code for each stack trace in fail report.
=== RUN Test
foo_test.go:13: Test
Fail reason: Not same value
Type: Expect:string, Got:string
Expected: "foo\nbar\nbug"
Actually got: "foo\nbar\nbaz"
Diff details: --- Expected
+++ Actually got
@@ -2,2 +2,2 @@
bar
-bug
+baz
Trace: /path/to/foo/foo_test.go:13
10 x := "foo\nbar\nbaz"
11 y := "foo\nbar\nbug"
12
13> a.Got(x).Expect(y).Same(t)
14 }
--- FAIL: Test (0.00s)
See also Helper-functions to make your development cheerful.