-
-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathfunc_join_test.go
More file actions
29 lines (26 loc) · 636 Bytes
/
func_join_test.go
File metadata and controls
29 lines (26 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package execution_test
import (
"testing"
"github.com/tomwright/dasel/v3/model"
_ "github.com/tomwright/dasel/v3/parsing/json"
)
func TestFuncJoin(t *testing.T) {
t.Run("chained input", testCase{
s: `["a","b","c"].join(",")`,
out: model.NewStringValue("a,b,c"),
}.run)
t.Run("vararg input", testCase{
s: `join(",", "a", "b", "c")`,
out: model.NewStringValue("a,b,c"),
}.run)
t.Run("array input", testCase{
s: `join(",", ["a", "b", "c"])`,
out: model.NewStringValue("a,b,c"),
}.run)
t.Run("array input newline", testCase{
s: `join("\n", ["a", "b", "c"])`,
out: model.NewStringValue(`a
b
c`),
}.run)
}