From 8fcaa4abf22d90e913a69ea4a1979524b4de8444 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Fri, 8 Dec 2023 18:25:54 -0500 Subject: [PATCH] lang: Output of tests should also show autogrouped resources This makes our test cases slightly more complete. --- lang/interpret_test.go | 4 +++- lang/interpret_test/TestAstFunc3/sendrecv-autogroup.txtar | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lang/interpret_test.go b/lang/interpret_test.go index eadbfe90..8e966427 100644 --- a/lang/interpret_test.go +++ b/lang/interpret_test.go @@ -2165,7 +2165,7 @@ func TestAstFunc3(t *testing.T) { } // 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) { m, err := engineUtil.ResToParamValues(res) if err != nil { @@ -2191,6 +2191,8 @@ func stringResFields(res engine.Res) (string, error) { if err != nil { return "", err } + s += fmt.Sprintf("Vertex: %s\n", x) // add one for the res itself! + // add a prefix to each line? s = strings.Trim(s, "\n") // trim trailing newlines for _, f := range strings.Split(s, "\n") { diff --git a/lang/interpret_test/TestAstFunc3/sendrecv-autogroup.txtar b/lang/interpret_test/TestAstFunc3/sendrecv-autogroup.txtar index 7d13ca2c..2f2e9160 100644 --- a/lang/interpret_test/TestAstFunc3/sendrecv-autogroup.txtar +++ b/lang/interpret_test/TestAstFunc3/sendrecv-autogroup.txtar @@ -41,6 +41,7 @@ Field: value[value1].Any = "i am value1" Field: value[value2].Any = "i am value2" Field: value[value3].Any = "i am value3" Group: print[print2]: Field: print[print3].Msg = "i am value3" +Group: print[print2]: Vertex: print[print3] Vertex: print[print1] Vertex: print[print2] Vertex: value[value1]