Skip to content

Commit

Permalink
feat(test): add unit test for char length function
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzl committed Jul 27, 2023
1 parent 6deb6c9 commit ac05a70
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/runtime/function/char_length_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,21 @@ func TestCharLength(t *testing.T) {
})
}
}

func TestCharLength_Error(t *testing.T) {
fn := proto.MustGetFunc(FuncCharLength)
assert.Equal(t, 1, fn.NumInput())
type tt struct {
name string
inFirst proto.Value
}
for _, v := range []tt{
{"Test_nil", nil},
} {
t.Run(v.name, func(t *testing.T) {
out, err := fn.Apply(context.Background(), proto.ToValuer(v.inFirst))
assert.Nil(t, err)
assert.Nil(t, out)
})
}
}

0 comments on commit ac05a70

Please sign in to comment.