| 1 | // Copyright (c) 2018, Maxime Soulé |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // This source code is licensed under the BSD-style license found in the |
| 5 | // LICENSE file in the root directory of this source tree. |
| 6 | |
| 7 | package tdscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/ |
| 8 | |
| 9 | import ( |
| 10 | "reflectscip-go gomod github.com/golang/go/src go1.18 reflect/" |
| 11 | |
| 12 | "github.com/maxatome/go-testdeep/internal/ctxerrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/ctxerr`/" |
| 13 | ) |
| 14 | |
| 15 | type tdIgnorescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore# struct { |
| 16 | baseOKNilscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#baseOKNil. |
| 17 | } |
| 18 | |
| 19 | // summary(Ignore): allows to ignore a comparison |
| 20 | // input(Ignore): all |
| 21 | |
| 22 | // Ignore operator is always true, whatever data is. It is useful when |
| 23 | // comparing a slice with [Slice] and wanting to ignore some indexes, |
| 24 | // for example (if you don't want to use [SuperSliceOf]). Or comparing |
| 25 | // a struct with [SStruct] and wanting to ignore some fields: |
| 26 | // |
| 27 | // td.Cmp(t, got, td.SStruct( |
| 28 | // Person{ |
| 29 | // Name: "John Doe", |
| 30 | // }, |
| 31 | // td.StructFields{ |
| 32 | // Age: td.Between(40, 45), |
| 33 | // Children: td.Ignore(), |
| 34 | // }), |
| 35 | // ) |
| 36 | func Ignorescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/Ignore().() TestDeepscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/TestDeep# { |
| 37 | return &tdIgnorescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#{ |
| 38 | baseOKNilscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#baseOKNil.: newBaseOKNilscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/newBaseOKNil().(3), |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func (i *tdIgnorescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#) Matchscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#Match().(ctx ctxerrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/ctxerr`/.Contextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/ctxerr`/Context#, got reflectscip-go gomod github.com/golang/go/src go1.18 reflect/.Valuescip-go gomod github.com/golang/go/src go1.18 reflect/Value#) *ctxerrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/ctxerr`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/ctxerr`/Error# { |
| 43 | return nil |
| 44 | } |
| 45 | |
| 46 | func (i *tdIgnorescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#) Stringscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/tdIgnore#String().() string { |
| 47 | return "Ignore()" |
| 48 | } |