mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-07 02:48:27 +08:00
Fixed multiply string by negative number panic #2211
This commit is contained in:
@@ -201,6 +201,13 @@ var multiplyOperatorScenarios = []expressionScenario{
|
||||
fmt.Sprintf("D0, P[], (!!str)::%s\n", strings.Repeat("banana", 4)),
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Multiply string X by negative int",
|
||||
skipDoc: true,
|
||||
document: `n: -4`,
|
||||
expression: `"banana" * .n`,
|
||||
expectedError: "Cannot repeat string by a negative number (-4)",
|
||||
},
|
||||
{
|
||||
description: "Multiply int node X string",
|
||||
document: `n: 4
|
||||
|
||||
Reference in New Issue
Block a user