mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
wip
This commit is contained in:
parent
2d9cc3c107
commit
4d8b64d05c
@ -6,88 +6,19 @@ import (
|
|||||||
|
|
||||||
var envOperatorScenarios = []expressionScenario{
|
var envOperatorScenarios = []expressionScenario{
|
||||||
{
|
{
|
||||||
document: ``,
|
description: "Read boolean environment variable as a string",
|
||||||
expression: `1`,
|
environmentVariable: "true",
|
||||||
expected: []string{
|
expression: `strenv(myenv)`,
|
||||||
"D0, P[], (!!int)::1\n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
document: ``,
|
|
||||||
expression: `-1`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!int)::-1\n",
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
document: ``,
|
|
||||||
expression: `1.2`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!float)::1.2\n",
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
document: ``,
|
|
||||||
expression: `-5.2e11`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!float)::-5.2e11\n",
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
document: ``,
|
|
||||||
expression: `5e-10`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!float)::5e-10\n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
document: ``,
|
|
||||||
expression: `"cat"`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!str)::cat\n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
document: ``,
|
|
||||||
expression: `"frog jumps"`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!str)::frog jumps\n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
document: ``,
|
|
||||||
expression: `"1.3"`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!str)::\"1.3\"\n",
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
document: ``,
|
|
||||||
expression: `"true"`,
|
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"D0, P[], (!!str)::\"true\"\n",
|
"D0, P[], (!!str)::\"true\"\n",
|
||||||
},
|
},
|
||||||
}, {
|
|
||||||
document: ``,
|
|
||||||
expression: `true`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!bool)::true\n",
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
document: ``,
|
|
||||||
expression: `false`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!bool)::false\n",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
document: ``,
|
description: "Read numeric environment variable as a string",
|
||||||
expression: `Null`,
|
environmentVariable: "12",
|
||||||
|
expression: `strenv(myenv)`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"D0, P[], (!!null)::Null\n",
|
"D0, P[], (!!str)::\"12\"\n",
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
document: ``,
|
|
||||||
expression: `~`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (!!null)::~\n",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user