RunDSL returns the DSL root resulting from running the given DSL. Used only in tests.
(t *testing.T, dsl func())
| 12 | // RunDSL returns the DSL root resulting from running the given DSL. |
| 13 | // Used only in tests. |
| 14 | func RunDSL(t *testing.T, dsl func()) *RootExpr { |
| 15 | t.Helper() |
| 16 | ResetDSL(t) |
| 17 | |
| 18 | // run DSL (first pass) |
| 19 | require.True(t, eval.Execute(dsl, nil), eval.Context.Error()) |
| 20 | |
| 21 | // run DSL (second pass) |
| 22 | require.NoError(t, eval.RunDSL()) |
| 23 | |
| 24 | // return generated root |
| 25 | return Root |
| 26 | } |
| 27 | |
| 28 | // RunInvalidDSL returns the error resulting from running the given DSL. |
| 29 | // It is used only in tests. |