github.com/iEvan-lhr/exciting-tool@v0.0.0-20230504054234-8e983f73cdd2/errors_test.go (about) 1 package tools 2 3 import ( 4 "log" 5 "testing" 6 ) 7 8 func TestError(t *testing.T) { 9 type App struct { 10 AppName string `json:"app_name"` 11 Password string `json:"password"` 12 } 13 //marshal, _ := json.Marshal(App{ 14 // AppName: "追云鹿", 15 // Password: "ZXC000", 16 //}) 17 a := App{} 18 19 log.Println(MarshalReq(nil, &a)) 20 } 21 22 func Success(str string) string { 23 if str == "tempSuccess" { 24 return "SSSS" 25 } 26 return "OOOO" 27 } 28 29 func Fail(str string) string { 30 if str == "tempFail" { 31 return "Fail" 32 } 33 return "OOOO" 34 }