Skip to content

Commit

Permalink
Set OutputPath in stdWorkflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecks committed Jan 16, 2024
1 parent f338591 commit 904d003
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 904d003

Please sign in to comment.