mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
32 lines
697 B
Go
32 lines
697 B
Go
package yqlib
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
var envOperatorScenarios = []expressionScenario{
|
|
{
|
|
description: "Read boolean environment variable as a string",
|
|
environmentVariable: "true",
|
|
expression: `strenv(myenv)`,
|
|
expected: []string{
|
|
"D0, P[], (!!str)::\"true\"\n",
|
|
},
|
|
},
|
|
{
|
|
description: "Read numeric environment variable as a string",
|
|
environmentVariable: "12",
|
|
expression: `strenv(myenv)`,
|
|
expected: []string{
|
|
"D0, P[], (!!str)::\"12\"\n",
|
|
},
|
|
},
|
|
}
|
|
|
|
func TestEnvOperatorScenarios(t *testing.T) {
|
|
for _, tt := range envOperatorScenarios {
|
|
testScenario(t, &tt)
|
|
}
|
|
documentScenarios(t, "Env Variable Operators", addOperatorScenarios)
|
|
}
|