luky116 commented on code in PR #741:
URL:
https://github.com/apache/incubator-seata-go/pull/741#discussion_r1885690335
##########
pkg/saga/statemachine/statelang/parser/statemachine_json_parser_test.go:
##########
@@ -1,45 +1,86 @@
package parser
import (
- "os"
"testing"
)
func TestParseChoice(t *testing.T) {
- filePath :=
"../../../../../testdata/saga/statelang/simple_statelang_with_choice.json"
- fileContent, err := os.ReadFile(filePath)
- if err != nil {
- t.Error("parse fail: " + err.Error())
- return
+ parser := NewJSONStateMachineParser()
+
+ tests := []struct {
+ name string
+ configFilePath string
+ }{
+ {
+ name: "JSON Simple: StateLang With Choice",
+ configFilePath:
"../../../../../testdata/saga/statelang/simple_statelang_with_choice.json",
+ },
+ {
+ name: "YAML Simple: StateLang With Choice",
+ configFilePath:
"../../../../../testdata/saga/statelang/simple_statelang_with_choice.yaml",
+ },
}
- _, err = NewJSONStateMachineParser().Parse(string(fileContent))
- if err != nil {
- t.Error("parse fail: " + err.Error())
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ _, err := parser.Parse(tt.configFilePath)
Review Comment:
这里对字段的值进行断言?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]