Skip to content

Commit

Permalink
test(dsl): add should err case while env.Run
Browse files Browse the repository at this point in the history
Signed-off-by: Dwi Siswanto <[email protected]>
  • Loading branch information
dwisiswant0 committed Feb 24, 2024
1 parent 311db4e commit 66778fd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dsl/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,23 @@ func TestRunDSL(t *testing.T) {
program, err := env.Compile("1+1")
assert.ErrorIs(t, err, nil)

env.Requests = make(map[string]any)
env.Requests = map[string]any{
"BAR": nil,
"FOO": "bar",
}

res, err := env.Run(program)
assert.ErrorIs(t, err, nil)

assert.Equal(t, 2, res)

t.Run("err", func(t *testing.T) {
program, err := env.Compile(`"1+10O`)
assert.NotNil(t, err)

res, err := env.Run(program)
assert.NotNil(t, err)

t.Log(res)
})
}

0 comments on commit 66778fd

Please sign in to comment.