From 921b7044920e5309d88c10547a9fe1c8a8c2b8ce Mon Sep 17 00:00:00 2001 From: Vincent Gramer Date: Thu, 22 Feb 2024 14:59:44 +0100 Subject: [PATCH] BUILD/MINOR: fix test generation with quote_fail instrution Signed-off-by: Vincent Gramer --- generate/test.tmpl | 2 +- tests/tcp-check_generated_test.go | 2 +- types/types-other.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generate/test.tmpl b/generate/test.tmpl index 9ff9d35..3a54293 100644 --- a/generate/test.tmpl +++ b/generate/test.tmpl @@ -29,7 +29,7 @@ func Test{{ $StructName }}{{ .Dir }}(t *testing.T) { "{{- $val -}}": false, {{- end }} {{- range $index, $val := .TestFailEscaped}} - `{{- $val -}}`: true, + `{{- $val -}}`: false, {{- end }} } {{- if .HasTable}} diff --git a/tests/tcp-check_generated_test.go b/tests/tcp-check_generated_test.go index 76879b3..d8617d8 100644 --- a/tests/tcp-check_generated_test.go +++ b/tests/tcp-check_generated_test.go @@ -57,7 +57,7 @@ func TestCheckstcp(t *testing.T) { "tcp-check unset-var(txn.from) if x": false, "---": false, "--- ---": false, - `tcp-check set-var-fmt(txn.from) "addr=%[src]:%[src_port] if TRUE"`: true, + `tcp-check set-var-fmt(txn.from) "addr=%[src]:%[src_port]" if TRUE`: false, } parser := &tcp.Checks{} for command, shouldPass := range tests { diff --git a/types/types-other.go b/types/types-other.go index 9b9e02e..2227dd7 100644 --- a/types/types-other.go +++ b/types/types-other.go @@ -923,7 +923,7 @@ type HTTPCheck struct{} //test:fail:tcp-check set-var(check.port) int(1234) if x //test:quote_ok:tcp-check set-var-fmt(check.name) "%H" //test:quote_ok:tcp-check set-var-fmt(txn.from) "addr=%[src]:%[src_port]" -//test:quote_fail:tcp-check set-var-fmt(txn.from) "addr=%[src]:%[src_port] if TRUE" +//test:quote_fail:tcp-check set-var-fmt(txn.from) "addr=%[src]:%[src_port]" if TRUE //test:quote_ok:tcp-check unset-var(txn.from) //test:fail:tcp-check unset-var(txn.from) if x type TCPCheck struct{}