| 1 | package utilsscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 5 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 6 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 7 | |
| 8 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 9 | ) |
| 10 | |
| 11 | const ( |
| 12 | upperStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/upperStr. = "/REPOS/GOFIBER/FIBER/ISSUES/187643/COMMENTS/REPOS/GOFIBER/FIBER/ISSUES/COMMENTS" |
| 13 | lowerStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/lowerStr. = "/repos/gofiber/fiber/issues/187643/comments/repos/gofiber/fiber/issues/comments" |
| 14 | ) |
| 15 | |
| 16 | // Shared test cases for TrimSpace benchmarks |
| 17 | var trimSpaceBenchmarkCasesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases. = []struct { |
| 18 | namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name. string |
| 19 | inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input. string |
| 20 | }{ |
| 21 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "empty", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: ""}, |
| 22 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "spaces", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " "}, |
| 23 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "ascii-word", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " fiber "}, |
| 24 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "auth-header-bearer", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " Bearer abc.def.ghi "}, |
| 25 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "auth-header-basic", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: "\tBasic QWxhZGRpbjpvcGVuIHNlc2FtZQ== "}, |
| 26 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "accept-encoding", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " gzip, deflate, br "}, |
| 27 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "content-type", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " application/json "}, |
| 28 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "x-forwarded-for", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " 203.0.113.5, 198.51.100.7 "}, |
| 29 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "query-params", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " user=alice&id=42 "}, |
| 30 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "ascii-long", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: " " + stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 strings/Repeat().("fiber utils ", 8) + " "}, |
| 31 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "no-trim", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: "fiber"}, |
| 32 | {namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name.: "mixed-whitespace", inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.: "\n\t fiber utils \r\n"}, |
| 33 | } |
| 34 | |
| 35 | func Test_EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_EqualFold().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 36 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 37 | testCases := []struct { |
| 38 | Expected bool |
| 39 | S1 string |
| 40 | S2 string |
| 41 | }{ |
| 42 | {Expected: true, S1: "/MY/NAME/IS/:PARAM/*", S2: "/my/name/is/:param/*"}, |
| 43 | {Expected: true, S1: "/MY/NAME/IS/:PARAM/*", S2: "/my/name/is/:param/*"}, |
| 44 | {Expected: true, S1: "/MY1/NAME/IS/:PARAM/*", S2: "/MY1/NAME/IS/:PARAM/*"}, |
| 45 | {Expected: false, S1: "/my2/name/is/:param/*", S2: "/my2/name"}, |
| 46 | {Expected: false, S1: "/dddddd", S2: "eeeeee"}, |
| 47 | {Expected: false, S1: "\na", S2: "*A"}, |
| 48 | {Expected: true, S1: "/MY3/NAME/IS/:PARAM/*", S2: "/my3/name/is/:param/*"}, |
| 49 | {Expected: true, S1: "/MY4/NAME/IS/:PARAM/*", S2: "/my4/nAME/IS/:param/*"}, |
| 50 | } |
| 51 | |
| 52 | for _, tc := range testCases { |
| 53 | res := EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/EqualFold().(tc.S1, tc.S2) |
| 54 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, tc.Expected, res, "string") |
| 55 | |
| 56 | res = EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/EqualFold().([]byte(tc.S1), []byte(tc.S2)) |
| 57 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, tc.Expected, res, "bytes") |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | func Benchmark_EqualFoldBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_EqualFoldBytes().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 62 | left := []byte(upperStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/upperStr.) |
| 63 | right := []byte(lowerStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/lowerStr.) |
| 64 | var res bool |
| 65 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 66 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 67 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 68 | res = EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/EqualFold().(left, right) |
| 69 | } |
| 70 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 71 | }) |
| 72 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 73 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 74 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 75 | res = bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.EqualFoldscip-go gomod github.com/golang/go/src go1.25.0 bytes/EqualFold().(left, right) |
| 76 | } |
| 77 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | // go test -v -run=^$ -bench=Benchmark_EqualFold -benchmem -count=4 ./utils/ |
| 82 | func Benchmark_EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_EqualFold().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 83 | var res bool |
| 84 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 85 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 86 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 87 | res = EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/EqualFold().(upperStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/upperStr., lowerStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/lowerStr.) |
| 88 | } |
| 89 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 90 | }) |
| 91 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 92 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 93 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 94 | res = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.EqualFoldscip-go gomod github.com/golang/go/src go1.25.0 strings/EqualFold().(upperStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/upperStr., lowerStrscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/lowerStr.) |
| 95 | } |
| 96 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 97 | }) |
| 98 | } |
| 99 | |
| 100 | func Test_TrimRightscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_TrimRight().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 101 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 102 | testCases := []struct { |
| 103 | S1 string |
| 104 | S2 string |
| 105 | Cutset byte |
| 106 | }{ |
| 107 | {S1: "/test//////", S2: "/test", Cutset: '/'}, |
| 108 | {S1: "/test", S2: "/test", Cutset: '/'}, |
| 109 | {S1: " ", S2: "", Cutset: ' '}, |
| 110 | {S1: " ", S2: "", Cutset: ' '}, |
| 111 | {S1: "", S2: "", Cutset: ' '}, |
| 112 | } |
| 113 | |
| 114 | for _, tc := range testCases { |
| 115 | res := TrimRightscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimRight().(tc.S1, tc.Cutset) |
| 116 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, tc.S2, res, "string") |
| 117 | |
| 118 | resB := TrimRightscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimRight().([]byte(tc.S1), tc.Cutset) |
| 119 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, []byte(tc.S2), resB, "bytes") |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | func Benchmark_TrimRightscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimRight().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 124 | var res string |
| 125 | word := "foobar " |
| 126 | expected := "foobar" |
| 127 | |
| 128 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 129 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 130 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 131 | res = TrimRightscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimRight().(word, ' ') |
| 132 | } |
| 133 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 134 | }) |
| 135 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 136 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 137 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 138 | res = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimRightscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimRight().(word, " ") |
| 139 | } |
| 140 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 141 | }) |
| 142 | } |
| 143 | |
| 144 | func Benchmark_TrimRightBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimRightBytes().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 145 | var res []byte |
| 146 | word := []byte("foobar ") |
| 147 | expected := []byte("foobar") |
| 148 | |
| 149 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 150 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 151 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 152 | res = TrimRightscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimRight().(word, ' ') |
| 153 | } |
| 154 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 155 | }) |
| 156 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 157 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 158 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 159 | res = bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.TrimRightscip-go gomod github.com/golang/go/src go1.25.0 bytes/TrimRight().(word, " ") |
| 160 | } |
| 161 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 162 | }) |
| 163 | } |
| 164 | |
| 165 | func Test_TrimLeftscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_TrimLeft().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 166 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 167 | testCases := []struct { |
| 168 | S1 string |
| 169 | S2 string |
| 170 | Cutset byte |
| 171 | }{ |
| 172 | {S1: "////test/", S2: "test/", Cutset: '/'}, |
| 173 | {S1: "test/", S2: "test/", Cutset: '/'}, |
| 174 | {S1: " ", S2: "", Cutset: ' '}, |
| 175 | {S1: " ", S2: "", Cutset: ' '}, |
| 176 | {S1: "", S2: "", Cutset: ' '}, |
| 177 | } |
| 178 | |
| 179 | for _, tc := range testCases { |
| 180 | res := TrimLeftscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimLeft().(tc.S1, tc.Cutset) |
| 181 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, tc.S2, res, "string") |
| 182 | |
| 183 | resB := TrimLeftscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimLeft().([]byte(tc.S1), tc.Cutset) |
| 184 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, []byte(tc.S2), resB, "bytes") |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func Benchmark_TrimLeftscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimLeft().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 189 | var res string |
| 190 | word := " foobar" |
| 191 | expected := "foobar" |
| 192 | |
| 193 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 194 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 195 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 196 | res = TrimLeftscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimLeft().(word, ' ') |
| 197 | } |
| 198 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 199 | }) |
| 200 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 201 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 202 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 203 | res = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimLeftscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimLeft().(word, " ") |
| 204 | } |
| 205 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 206 | }) |
| 207 | } |
| 208 | |
| 209 | func Benchmark_TrimLeftBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimLeftBytes().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 210 | var res []byte |
| 211 | word := []byte(" foobar") |
| 212 | expected := []byte("foobar") |
| 213 | |
| 214 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 215 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 216 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 217 | res = TrimLeftscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimLeft().(word, ' ') |
| 218 | } |
| 219 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 220 | }) |
| 221 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 222 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 223 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 224 | res = bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.TrimLeftscip-go gomod github.com/golang/go/src go1.25.0 bytes/TrimLeft().(word, " ") |
| 225 | } |
| 226 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 227 | }) |
| 228 | } |
| 229 | |
| 230 | func Test_Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_Trim().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 231 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 232 | testCases := []struct { |
| 233 | S1 string |
| 234 | S2 string |
| 235 | Cutset byte |
| 236 | }{ |
| 237 | {S1: " test ", S2: "test", Cutset: ' '}, |
| 238 | {S1: "test", S2: "test", Cutset: ' '}, |
| 239 | {S1: ".test", S2: "test", Cutset: '.'}, |
| 240 | {S1: " ", S2: "", Cutset: ' '}, |
| 241 | {S1: " ", S2: "", Cutset: ' '}, |
| 242 | {S1: "", S2: "", Cutset: ' '}, |
| 243 | } |
| 244 | |
| 245 | for _, tc := range testCases { |
| 246 | res := Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Trim().(tc.S1, tc.Cutset) |
| 247 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, tc.S2, res, "string") |
| 248 | |
| 249 | resB := Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Trim().([]byte(tc.S1), tc.Cutset) |
| 250 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, []byte(tc.S2), resB, "bytes") |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | func Benchmark_Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_Trim().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 255 | var res string |
| 256 | word := " foobar " |
| 257 | expected := "foobar" |
| 258 | |
| 259 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 260 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 261 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 262 | res = Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Trim().(word, ' ') |
| 263 | } |
| 264 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 265 | }) |
| 266 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 267 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 268 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 269 | res = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Trimscip-go gomod github.com/golang/go/src go1.25.0 strings/Trim().(word, " ") |
| 270 | } |
| 271 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 272 | }) |
| 273 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default.trimspace", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 274 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 275 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 276 | res = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(word) |
| 277 | } |
| 278 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 279 | }) |
| 280 | } |
| 281 | |
| 282 | func Benchmark_TrimBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimBytes().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 283 | var res []byte |
| 284 | word := []byte(" foobar ") |
| 285 | expected := []byte("foobar") |
| 286 | |
| 287 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 288 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 289 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 290 | res = Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Trim().(word, ' ') |
| 291 | } |
| 292 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 293 | }) |
| 294 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 295 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 296 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 297 | res = bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Trimscip-go gomod github.com/golang/go/src go1.25.0 bytes/Trim().(word, " ") |
| 298 | } |
| 299 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 300 | }) |
| 301 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default.trimspace", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 302 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 303 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 304 | res = bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 bytes/TrimSpace().(word) |
| 305 | } |
| 306 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(b, expected, res) |
| 307 | }) |
| 308 | } |
| 309 | |
| 310 | func Test_Trim_Edgescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_Trim_Edge().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 311 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 312 | |
| 313 | cases := []struct { |
| 314 | input string |
| 315 | cut byte |
| 316 | exp string |
| 317 | }{ |
| 318 | {"foobar", 'x', "foobar"}, |
| 319 | {"", ' ', ""}, |
| 320 | {"xxfoobarxx", 'x', "foobar"}, |
| 321 | } |
| 322 | for _, c := range cases { |
| 323 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(c.input, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 324 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 325 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, c.exp, Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Trim().(c.input, c.cut)) |
| 326 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, []byte(c.exp), Trimscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Trim().([]byte(c.input), c.cut)) |
| 327 | }) |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | func Test_TrimSpacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_TrimSpace().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 332 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 333 | testCases := []struct { |
| 334 | name string |
| 335 | input string |
| 336 | }{ |
| 337 | {name: "empty", input: ""}, |
| 338 | {name: "spaces", input: " "}, |
| 339 | {name: "tabs", input: "\t\t"}, |
| 340 | {name: "ascii-word", input: " fiber "}, |
| 341 | {name: "auth-header-bearer", input: " Bearer abc.def.ghi "}, |
| 342 | {name: "auth-header-basic", input: "\tBasic QWxhZGRpbjpvcGVuIHNlc2FtZQ== "}, |
| 343 | {name: "accept-encoding", input: " gzip, deflate, br "}, |
| 344 | {name: "content-type-json", input: " application/json "}, |
| 345 | {name: "x-forwarded-for", input: " 203.0.113.5, 198.51.100.7 "}, |
| 346 | {name: "query-params", input: " user=alice&id=42 "}, |
| 347 | {name: "ascii-long", input: " " + stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 strings/Repeat().("fiber utils ", 8) + " "}, |
| 348 | {name: "mixed-whitespace", input: "\n\t fiber utils \r\n"}, |
| 349 | {name: "no-trim", input: "fiber"}, |
| 350 | {name: "utf8-valid", input: " Hello, 世界! "}, |
| 351 | } |
| 352 | |
| 353 | for _, tc := range testCases { |
| 354 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 355 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 356 | // Test string variant - must match strings.TrimSpace |
| 357 | result := TrimSpacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimSpace().(tc.input) |
| 358 | stdResult := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(tc.input) |
| 359 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, stdResult, result, "TrimSpace should match strings.TrimSpace for %s", tc.name) |
| 360 | |
| 361 | // Test []byte variant - must match bytes.TrimSpace |
| 362 | resultBytes := TrimSpacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimSpace().([]byte(tc.input)) |
| 363 | stdResultBytes := bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 bytes/TrimSpace().([]byte(tc.input)) |
| 364 | // bytes.Equal treats nil and empty slices as equal |
| 365 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Equalscip-go gomod github.com/golang/go/src go1.25.0 bytes/Equal().(stdResultBytes, resultBytes), "TrimSpace should match bytes.TrimSpace for %s", tc.name) |
| 366 | }) |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | func Benchmark_TrimSpacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimSpace().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 371 | for _, tc := range trimSpaceBenchmarkCasesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases. { |
| 372 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber/"+tc.namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name., func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 373 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 374 | b.SetBytesscip-go gomod github.com/golang/go/src go1.25.0 testing/B#SetBytes().(int64(len(tc.inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.))) |
| 375 | b.ResetTimerscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ResetTimer().() |
| 376 | var res string |
| 377 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 378 | res = TrimSpacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimSpace().(tc.inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.) |
| 379 | } |
| 380 | _ = res |
| 381 | }) |
| 382 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default/"+tc.namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name., func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 383 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 384 | b.SetBytesscip-go gomod github.com/golang/go/src go1.25.0 testing/B#SetBytes().(int64(len(tc.inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.))) |
| 385 | b.ResetTimerscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ResetTimer().() |
| 386 | var res string |
| 387 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 388 | res = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(tc.inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.) |
| 389 | } |
| 390 | _ = res |
| 391 | }) |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | func Benchmark_TrimSpaceBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_TrimSpaceBytes().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 396 | for _, tc := range trimSpaceBenchmarkCasesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases. { |
| 397 | input := []byte(tc.inputscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:input.) |
| 398 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber/"+tc.namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name., func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 399 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 400 | b.SetBytesscip-go gomod github.com/golang/go/src go1.25.0 testing/B#SetBytes().(int64(len(input))) |
| 401 | b.ResetTimerscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ResetTimer().() |
| 402 | var res []byte |
| 403 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 404 | res = TrimSpacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/TrimSpace().(input) |
| 405 | } |
| 406 | _ = res |
| 407 | }) |
| 408 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default/"+tc.namescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/trimSpaceBenchmarkCases:name., func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 409 | b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().() |
| 410 | b.SetBytesscip-go gomod github.com/golang/go/src go1.25.0 testing/B#SetBytes().(int64(len(input))) |
| 411 | b.ResetTimerscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ResetTimer().() |
| 412 | var res []byte |
| 413 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 414 | res = bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 bytes/TrimSpace().(input) |
| 415 | } |
| 416 | _ = res |
| 417 | }) |
| 418 | } |
| 419 | } |