Files
EdgeNode/internal/waf/checkpoints/utils_test.go
GoEdgeLab 4245c73c47 实现WAF
2020-10-08 15:06:42 +08:00

32 lines
771 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package checkpoints
import (
"fmt"
"strings"
"testing"
)
func TestFindCheckpointDefinition_Markdown(t *testing.T) {
result := []string{}
for _, def := range AllCheckpoints {
row := "## " + def.Name + "\n* 前缀:`${" + def.Prefix + "}`\n* 描述:" + def.Description
if def.HasParams {
row += "\n* 是否有子参数YES"
paramOptions := def.Instance.ParamOptions()
if paramOptions != nil && len(paramOptions.Options) > 0 {
row += "\n* 可选子参数"
for _, option := range paramOptions.Options {
row += "\n * `" + option.Name + "`:值为 `" + option.Value + "`"
}
}
} else {
row += "\n* 是否有子参数NO"
}
row += "\n"
result = append(result, row)
}
fmt.Print(strings.Join(result, "\n") + "\n")
}