lang: Output of tests should also show autogrouped resources

This makes our test cases slightly more complete.
This commit is contained in:
James Shubin
2023-12-08 18:25:54 -05:00
parent 18e1f08156
commit 8fcaa4abf2
2 changed files with 4 additions and 1 deletions

View File

@@ -2165,7 +2165,7 @@ func TestAstFunc3(t *testing.T) {
} }
// stringResFields is a helper function to store a resource graph as a text // stringResFields is a helper function to store a resource graph as a text
// format for test comparisons. // format for test comparisons. This also adds a line for each vertex as well!
func stringResFields(res engine.Res) (string, error) { func stringResFields(res engine.Res) (string, error) {
m, err := engineUtil.ResToParamValues(res) m, err := engineUtil.ResToParamValues(res)
if err != nil { if err != nil {
@@ -2191,6 +2191,8 @@ func stringResFields(res engine.Res) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
s += fmt.Sprintf("Vertex: %s\n", x) // add one for the res itself!
// add a prefix to each line? // add a prefix to each line?
s = strings.Trim(s, "\n") // trim trailing newlines s = strings.Trim(s, "\n") // trim trailing newlines
for _, f := range strings.Split(s, "\n") { for _, f := range strings.Split(s, "\n") {

View File

@@ -41,6 +41,7 @@ Field: value[value1].Any = "i am value1"
Field: value[value2].Any = "i am value2" Field: value[value2].Any = "i am value2"
Field: value[value3].Any = "i am value3" Field: value[value3].Any = "i am value3"
Group: print[print2]: Field: print[print3].Msg = "i am value3" Group: print[print2]: Field: print[print3].Msg = "i am value3"
Group: print[print2]: Vertex: print[print3]
Vertex: print[print1] Vertex: print[print1]
Vertex: print[print2] Vertex: print[print2]
Vertex: value[value1] Vertex: value[value1]