Debian Codegraph @

pkg/filter/lines_test.go

raw symbols SCIP
1 package filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/
2
3 import (
4 "stringsscip-go gomod github.com/golang/go/src go1.18 strings/"
5 "testingscip-go gomod github.com/golang/go/src go1.18 testing/"
6
7 "github.com/ffuf/ffuf/v2/pkg/ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/"
8 )
9
10 func TestNewLineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestNewLineFilter().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
11 f, _ := NewLineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewLineFilter().("200,301,400-410,500")
12 linesRepr := f.Reprscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FilterProvider#Repr.()
13 if !stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Containsscip-go gomod github.com/golang/go/src go1.18 strings/Contains().(linesRepr, "200,301,400-410,500") {
14 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Word filter was expected to have 4 values")
15 }
16 }
17
18 func TestNewLineFilterErrorscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestNewLineFilterError().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
19 _, err := NewLineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewLineFilter().("invalid")
20 if err == nil {
21 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Was expecting an error from errenous input data")
22 }
23 }
24
25 func TestLineFilteringscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestLineFiltering().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
26 f, _ := NewLineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewLineFilter().("200,301,402-450,500")
27 for i, test := range []struct {
28 input int64
29 output bool
30 }{
31 {200, true},
32 {301, true},
33 {500, true},
34 {4, false},
35 {444, true},
36 {302, false},
37 {401, false},
38 {402, true},
39 {450, true},
40 {451, false},
41 } {
42 var data []string
43 for i := int64(0); i < test.input; i++ {
44 data = append(data, "A")
45 }
46 resp := ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#{Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Data.: []byte(stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Joinscip-go gomod github.com/golang/go/src go1.18 strings/Join().(data, "\n"))}
47 filterReturn, _ := f.Filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FilterProvider#Filter.(&resp)
48 if filterReturn != test.output {
49 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Filter test %d: Was expecing filter return value of %t but got %t", i, test.output, filterReturn)
50 }
51 }
52 }