Translate SCXML test suite (.txml files in pkg/scxml_test_suite) to Go unit tests for statechart.go. Build equivalent State trees, generate table-driven tests verifying transitions/entry/exit/history. Use for conformance testing without parser.
statechart_scxml_[category]_test.go.Gather Context:
pkg/scxml_test_suite/**/test*.txmlstatechart.go + statechart_test.go (patterns).<state>, <transition event=, <onentry><raise>, conf:pass.Map SCXML → Go State Tree:
| SCXML | Go |
|---|---|
<state id=\"s1\"><transition event=\"e\" target=\"s2\"/></state> |
&State{ID:\"s1\", Transitions:[]*Transition{{Event:\"e\", Target:\"s2\"}}} |
<onentry><raise event=\"foo\"/></onentry> | OnEntry: func(ctx, _,_,_,_) { rt.SendEvent(ctx, \"foo\") } |
initial=\"s0\" | Initial: states[\"s0\"] |
conf:pass state | Assert rt.IsInState(\"pass\") |
Generate Test:
[]struct{Name string; Root *State; Events []Event; WantPass bool}statechart_scxml_tests.go (no existing edits).buildSCXMLTree(map[string]string) func.Validate:
go test ./... -v -racet.Skip(\"Needs datamodel\")Input: test144.txml (raise FIFO) Output Test:
t.Run(\"144\", func(t *testing.T) {
// built tree with OnEntry raises
rt.Start(ctx)
require.True(t, rt.IsInState(\"pass\"))
})
Activate for all SCXML tasks. Combine w/ golang-development skill.