Debian Codegraph @

execution/func_len_test.go

raw symbols SCIP
1 package execution_test
2
3 import (
4 "github.com/tomwright/dasel/v3/model"
5 _ "github.com/tomwright/dasel/v3/parsing/json"
6 "testing"
7 )
8
9 func TestFuncLen(t *testing.T) {
10 t.Run("array", testCase{
11 s: `len([1,2,3])`,
12 out: model.NewIntValue(3),
13 }.run)
14 t.Run("object", testCase{
15 s: `len({"foo":1,"bar":2,"baz":3})`,
16 out: model.NewIntValue(3),
17 }.run)
18 t.Run("string", testCase{
19 s: `len("hello")`,
20 out: model.NewIntValue(5),
21 }.run)
22 }