Skip to content

Commit 20407a0

Browse files
committed
Adding more tests to prevent regression again :sweat
1 parent 0a83da6 commit 20407a0

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

pkg/yqlib/operator_add_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ var addOperatorScenarios = []expressionScenario{
317317
expression: `.[] | (.a + "cat")`,
318318
expected: []string{},
319319
},
320+
{
321+
skipDoc: true,
322+
description: "empty add shouldn't add",
323+
document: `[]`,
324+
expression: `.[] | (.a + "cat" + .b)`,
325+
expected: []string{},
326+
},
320327
{
321328
skipDoc: true,
322329
description: "Add to empty",

pkg/yqlib/operator_map_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ var mapOperatorScenarios = []expressionScenario{
1515
"D0, P[], (!!seq)::[6, 7, 8]\n",
1616
},
1717
},
18+
{
19+
skipDoc: true,
20+
expression: `[] | map(. + 42)`,
21+
expected: []string{
22+
"D0, P[], (!!seq)::[]\n",
23+
},
24+
},
1825
{
1926
skipDoc: true,
2027
document: `[1,2]`,

pkg/yqlib/operator_select_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import (
55
)
66

77
var selectOperatorScenarios = []expressionScenario{
8+
{
9+
skipDoc: true,
10+
document: `cat: pants`,
11+
expression: `select(.nope) | key + " why though?"`,
12+
expected: []string{},
13+
},
814
{
915
skipDoc: true,
1016
document: `cat`,

0 commit comments

Comments
 (0)