From b2baae245bc6b9056df09d52795164dd8e87ada6 Mon Sep 17 00:00:00 2001 From: mjarkk Date: Thu, 14 Oct 2021 13:45:15 +0200 Subject: [PATCH] bytecode: fix bytecode tests --- bytecode/bytecode_test.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/bytecode/bytecode_test.go b/bytecode/bytecode_test.go index e32b51d..59527a7 100644 --- a/bytecode/bytecode_test.go +++ b/bytecode/bytecode_test.go @@ -3,7 +3,6 @@ package bytecode import ( "encoding/hex" "fmt" - "hash/fnv" "strings" "sync" "testing" @@ -12,13 +11,8 @@ import ( ) func parseQuery(query string) ([]byte, []error) { - i := ParserCtx{ - Res: []byte{}, - FragmentLocations: []int{}, - Query: []byte(query), - Errors: []error{}, - Hasher: fnv.New32(), - } + i := NewParserCtx() + i.Query = []byte(query) i.ParseQueryToBytecode(nil) return i.Res, i.Errors } @@ -764,13 +758,7 @@ func injectCodeSurviveTest(baseQuery string, extraChars ...[][]byte) { for _, charsToInject := range toTest { go func(baseQuery []byte, charsToInject [][]byte) { - parser := ParserCtx{ - Res: []byte{}, - FragmentLocations: []int{}, - Query: []byte{}, - Errors: []error{}, - Hasher: fnv.New32(), - } + parser := NewParserCtx() for i := range baseQuery { tilIndex := baseQuery[:i]