github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/utils_test.go (about) 1 package checkpoints 2 3 import ( 4 "fmt" 5 "strings" 6 "testing" 7 ) 8 9 func TestFindCheckpointDefinition_Markdown(t *testing.T) { 10 result := []string{} 11 for _, def := range AllCheckpoints { 12 row := "## " + def.Name + "\n* 前缀:`${" + def.Prefix + "}`\n* 描述:" + def.Description 13 if def.HasParams { 14 row += "\n* 是否有子参数:YES" 15 16 paramOptions := def.Instance.ParamOptions() 17 if paramOptions != nil && len(paramOptions.Options) > 0 { 18 row += "\n* 可选子参数" 19 for _, option := range paramOptions.Options { 20 row += "\n * `" + option.Name + "`:值为 `" + option.Value + "`" 21 } 22 } 23 } else { 24 row += "\n* 是否有子参数:NO" 25 } 26 row += "\n" 27 result = append(result, row) 28 } 29 30 fmt.Print(strings.Join(result, "\n") + "\n") 31 }