@@ -30,59 +30,59 @@ import (
30
30
31
31
// All can be used as a parameter for expected.Output to group a set of comparators.
32
32
func All (comparators ... test.Comparator ) test.Comparator {
33
- return func (stdout , info string , t * testing.T ) {
33
+ return func (stdout , _ string , t * testing.T ) {
34
34
t .Helper ()
35
35
36
36
for _ , comparator := range comparators {
37
- comparator (stdout , info , t )
37
+ comparator (stdout , "" , t )
38
38
}
39
39
}
40
40
}
41
41
42
42
// Contains can be used as a parameter for expected.Output and ensures a comparison string is found contained in the
43
43
// output.
44
44
func Contains (compare string ) test.Comparator {
45
- return func (stdout , info string , t * testing.T ) {
45
+ return func (stdout , _ string , t * testing.T ) {
46
46
t .Helper ()
47
- assertive .Contains (assertive .WithFailLater (t ), stdout , compare , info )
47
+ assertive .Contains (assertive .WithFailLater (t ), stdout , compare , "Inspecting output (contains)" )
48
48
}
49
49
}
50
50
51
51
// DoesNotContain is to be used for expected.Output to ensure a comparison string is NOT found in the output.
52
52
func DoesNotContain (compare string ) test.Comparator {
53
- return func (stdout , info string , t * testing.T ) {
53
+ return func (stdout , _ string , t * testing.T ) {
54
54
t .Helper ()
55
- assertive .DoesNotContain (assertive .WithFailLater (t ), stdout , compare , info )
55
+ assertive .DoesNotContain (assertive .WithFailLater (t ), stdout , compare , "Inspecting output (does not contain)" )
56
56
}
57
57
}
58
58
59
59
// Equals is to be used for expected.Output to ensure it is exactly the output.
60
60
func Equals (compare string ) test.Comparator {
61
- return func (stdout , info string , t * testing.T ) {
61
+ return func (stdout , _ string , t * testing.T ) {
62
62
t .Helper ()
63
- assertive .IsEqual (assertive .WithFailLater (t ), stdout , compare , info )
63
+ assertive .IsEqual (assertive .WithFailLater (t ), stdout , compare , "Inspecting output (equals)" )
64
64
}
65
65
}
66
66
67
67
// Match is to be used for expected.Output to ensure we match a regexp.
68
68
func Match (reg * regexp.Regexp ) test.Comparator {
69
- return func (stdout , info string , t * testing.T ) {
69
+ return func (stdout , _ string , t * testing.T ) {
70
70
t .Helper ()
71
- assertive .Match (assertive .WithFailLater (t ), stdout , reg , info )
71
+ assertive .Match (assertive .WithFailLater (t ), stdout , reg , "Inspecting output (match)" )
72
72
}
73
73
}
74
74
75
75
// JSON allows to verify that the output can be marshalled into T, and optionally can be further verified by a provided
76
76
// method.
77
77
func JSON [T any ](obj T , verifier func (T , string , tig.T )) test.Comparator {
78
- return func (stdout , info string , t * testing.T ) {
78
+ return func (stdout , _ string , t * testing.T ) {
79
79
t .Helper ()
80
80
81
81
err := json .Unmarshal ([]byte (stdout ), & obj )
82
- assertive .ErrorIsNil (assertive .WithFailLater (t ), err , "failed to unmarshal JSON from stdout" )
82
+ assertive .ErrorIsNil (assertive .WithSilentSuccess (t ), err , "Unmarshalling JSON from stdout must succeed " )
83
83
84
84
if verifier != nil && err == nil {
85
- verifier (obj , info , t )
85
+ verifier (obj , "Inspecting output (JSON)" , t )
86
86
}
87
87
}
88
88
}
0 commit comments