yq/pkg/yqlib/operator_env_test.go
Mike Farah 4d8b64d05c wip
2021-02-11 10:58:40 +11:00

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)
}