Skip to content

Commit 3e1345e

Browse files
authored
Merge pull request #94 from maxatome/fix-comments
Fix comments
2 parents cfdcf93 + 12da14e commit 3e1345e

File tree

7 files changed

+22
-3
lines changed

7 files changed

+22
-3
lines changed

helpers/tdhttp/test_api.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import (
2424
"github.com/maxatome/go-testdeep/td"
2525
)
2626

27+
// TestAPI allows to test one HTTP API. See NewTestAPI function to
28+
// create a new instance and get some examples of use.
2729
type TestAPI struct {
2830
t *td.T
2931
handler http.Handler
@@ -644,7 +646,7 @@ func (t *TestAPI) CmpXMLBody(expectedBody interface{}) *TestAPI {
644646
return t.CmpMarshaledBody(xml.Unmarshal, expectedBody)
645647
}
646648

647-
// CmpNoBody tests that the last request response body is empty.
649+
// NoBody tests that the last request response body is empty.
648650
//
649651
// It fails if no request has been sent yet.
650652
func (t *TestAPI) NoBody() *TestAPI {

internal/anchors/anchor.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@ type anchor struct {
1818
Operator reflect.Value // Operator is a td.TestDeep behind
1919
}
2020

21+
// Info gathers all anchors information.
2122
type Info struct {
2223
sync.Mutex
2324
index int
2425
persist bool
2526
anchors map[interface{}]anchor
2627
}
2728

29+
// NewInfo returns a new instance of *Info.
2830
func NewInfo() *Info {
2931
return &Info{
3032
anchors: map[interface{}]anchor{},
3133
}
3234
}
3335

36+
// AddAnchor anchors a new operator op, with type typ then returns the
37+
// anchor value.
3438
func (i *Info) AddAnchor(typ reflect.Type, op reflect.Value) reflect.Value {
3539
i.Lock()
3640
defer i.Unlock()
@@ -49,18 +53,22 @@ func (i *Info) AddAnchor(typ reflect.Type, op reflect.Value) reflect.Value {
4953
return anc
5054
}
5155

56+
// DoAnchorsPersist returns true if anchors are persistent across tests.
5257
func (i *Info) DoAnchorsPersist() bool {
5358
i.Lock()
5459
defer i.Unlock()
5560
return i.persist
5661
}
5762

63+
// SetAnchorsPersist enables or disables anchors persistence.
5864
func (i *Info) SetAnchorsPersist(persist bool) {
5965
i.Lock()
6066
defer i.Unlock()
6167
i.persist = persist
6268
}
6369

70+
// ResetAnchors removes all anchors if persistence is disabled or
71+
// force is true.
6472
func (i *Info) ResetAnchors(force bool) {
6573
i.Lock()
6674
defer i.Unlock()

internal/anchors/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ type anchorableType struct {
2121
builder reflect.Value
2222
}
2323

24+
// AnchorableTypes contains all non-native types that can be
25+
// anchorable. See AddAnchorableStructType to add a new type to it.
2426
var AnchorableTypes []anchorableType
2527

2628
func init() {

internal/ctxerr/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (c Context) MergeErrors() *Error {
107107
return (*c.Errors)[0]
108108
}
109109

110-
// CannotCompare returns a generic error used when the access of
110+
// CannotCompareError returns a generic error used when the access of
111111
// unexported fields cannot be overridden.
112112
func (c Context) CannotCompareError() *Error {
113113
if c.BooleanError {

internal/test/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type TestingT struct {
1919
HasFailed bool
2020
}
2121

22+
// NewTestingT returns a new instance of *TestingT.
2223
func NewTestingT() *TestingT {
2324
return &TestingT{}
2425
}
@@ -49,6 +50,7 @@ type TestingFT struct {
4950
name string
5051
}
5152

53+
// NewTestingFT returns a new instance of *TestingFT.
5254
func NewTestingFT(name string) *TestingFT {
5355
return &TestingFT{name: name}
5456
}

internal/util/tag.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import (
1212
)
1313

1414
var (
15-
ErrTagEmpty = errors.New("A tag cannot be empty")
15+
// ErrTagEmpty is the error returned by CheckTag for an empty tag.
16+
ErrTagEmpty = errors.New("A tag cannot be empty")
17+
// ErrTagInvalid is the error returned by CheckTag for an invalid tag.
1618
ErrTagInvalid = errors.New("Invalid tag, should match (Letter|_)(Letter|_|Number)*")
1719
)
1820

21+
// CheckTag checks that tag is a valid tag (see operator Tag) or not.
1922
func CheckTag(tag string) error {
2023
if tag == "" {
2124
return ErrTagEmpty

td/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ type ContextConfig struct {
6060
BeLax bool
6161
}
6262

63+
// Equal returns true if both ContextConfig are equal. Only public
64+
// fields are taken into account to check equality.
6365
func (c ContextConfig) Equal(o ContextConfig) bool {
6466
return c.RootName == o.RootName &&
6567
c.MaxErrors == o.MaxErrors &&

0 commit comments

Comments
 (0)