From 904d003d3e5fb7f85e25e4328a5d7b564c642e38 Mon Sep 17 00:00:00 2001 From: Tricia Decker <1440268+pdecks@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:56:53 -0800 Subject: [PATCH] Set OutputPath in stdWorkflow --- generator.go | 1 - workflow.go | 1 + workflow_test.go | 6 +++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/generator.go b/generator.go index d60f688..9442411 100644 --- a/generator.go +++ b/generator.go @@ -40,7 +40,6 @@ func Init(opts ...InitOption) *Generator { g.Debugger = initDebugger(g.debug, log.New(os.Stderr, "", 0)) g.persister.SetDebugger(g.Debugger) - g.persister.SetOutputPath(g.params.OutputPath()) return g } diff --git a/workflow.go b/workflow.go index fb30a50..a98daed 100644 --- a/workflow.go +++ b/workflow.go @@ -40,6 +40,7 @@ func (wf *standardWorkflow) Init(g *Generator) AST { for _, pm := range wf.paramMutators { pm(wf.params) } + wf.persister.SetOutputPath(wf.params.OutputPath()) if wf.BiDi { return ProcessCodeGeneratorRequestBidirectional(g, req) diff --git a/workflow_test.go b/workflow_test.go index 258ac43..07fe6f2 100644 --- a/workflow_test.go +++ b/workflow_test.go @@ -19,10 +19,14 @@ func TestStandardWorkflow_Init(t *testing.T) { mutated := false - g := Init(ProtocInput(bytes.NewReader(b)), MutateParams(func(p Parameters) { mutated = true })) + g := Init(ProtocInput(bytes.NewReader(b)), MutateParams(func(p Parameters) { + mutated = true + p["output_path"] = "output/path" + })) g.workflow.Init(g) assert.True(t, mutated) + assert.Equal(t, "output/path", g.params.OutputPath()) t.Run("bidi", func(t *testing.T) { mutated = false