test(path): Add a GC recycle validation

This commit is contained in:
Flc゛ 2024-03-12 14:06:51 +08:00
parent 861ffb9181
commit baf4c15e41

View File

@ -6,6 +6,7 @@
package gin
import (
"runtime"
"strings"
"testing"
@ -80,6 +81,8 @@ func TestPathCleanMallocs(t *testing.T) {
t.Skip("skipping malloc count in short mode")
}
runtime.GC()
for _, test := range cleanTests {
allocs := testing.AllocsPerRun(100, func() { cleanPath(test.result) })
assert.EqualValues(t, allocs, 0)