mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-15 05:50:27 +08:00
增加生成文档的测试用例
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package firewallconfigs_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRuleCheckpoint_Markdown(t *testing.T) {
|
||||||
|
var result = []string{}
|
||||||
|
for _, def := range firewallconfigs.AllCheckpoints {
|
||||||
|
def.Description = strings.ReplaceAll(def.Description, "<code-label>", "`")
|
||||||
|
def.Description = strings.ReplaceAll(def.Description, "</code-label>", "`")
|
||||||
|
|
||||||
|
var row = "## " + def.Name + "\n"
|
||||||
|
row += "* 名称:" + def.Name + "\n"
|
||||||
|
row += "* 代号:`${" + def.Prefix + "}`\n"
|
||||||
|
row += "* 描述:" + def.Description + "\n"
|
||||||
|
result = append(result, row)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Print(strings.Join(result, "\n") + "\n")
|
||||||
|
}
|
||||||
@@ -1,17 +1,22 @@
|
|||||||
package firewallconfigs
|
package firewallconfigs_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRuleOperator_Markdown(t *testing.T) {
|
func TestRuleOperator_Markdown(t *testing.T) {
|
||||||
result := []string{}
|
var result = []string{}
|
||||||
for _, def := range AllRuleOperators {
|
for _, def := range firewallconfigs.AllRuleOperators {
|
||||||
row := "## " + def.Name + "\n"
|
def.Description = strings.ReplaceAll(def.Description, "<code-label>", "`")
|
||||||
row += "符号:`" + def.Code + "`\n"
|
def.Description = strings.ReplaceAll(def.Description, "</code-label>", "`")
|
||||||
row += "描述:" + def.Description + "\n"
|
|
||||||
|
var row = "## " + def.Name + "\n"
|
||||||
|
row += "* 名称:" + def.Name + "\n"
|
||||||
|
row += "* 代号:`" + def.Code + "`\n"
|
||||||
|
row += "* 描述:" + def.Description + "\n"
|
||||||
result = append(result, row)
|
result = append(result, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user