数据 输入输出 处理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
598 B

package testUnit
import (
"fmt"
"goInOut/utils"
"testing"
)
// 定义一个结构体,包含嵌套的结构体字段
type Person struct {
Name Name `json:"name"`
}
type Name struct {
First string `json:"first"`
Last string `json:"last"`
}
func Test_httpProxy(t *testing.T) {
}
func Test_template(t *testing.T) {
// 创建一个Person实例
person := Person{
Name: Name{
First: "John",
Last: "Doe",
},
}
templateStr := "Hello, {{.Name.First}} !"
sbs, err := utils.TextTemplateMatch(person, templateStr)
println(sbs)
if err != nil {
fmt.Println(err.Error())
}
}