From 4d8b64d05cf52600179b44233e1cbf0b027e76b9 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Fri, 8 Jan 2021 21:09:43 +1100 Subject: [PATCH] wip --- pkg/yqlib/operator_env_test.go | 83 +++------------------------------- 1 file changed, 7 insertions(+), 76 deletions(-) diff --git a/pkg/yqlib/operator_env_test.go b/pkg/yqlib/operator_env_test.go index 33c28127..d70cef32 100644 --- a/pkg/yqlib/operator_env_test.go +++ b/pkg/yqlib/operator_env_test.go @@ -6,88 +6,19 @@ import ( var envOperatorScenarios = []expressionScenario{ { - document: ``, - expression: `1`, - expected: []string{ - "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"`, + description: "Read boolean environment variable as a string", + environmentVariable: "true", + expression: `strenv(myenv)`, expected: []string{ "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: ``, - expression: `Null`, + description: "Read numeric environment variable as a string", + environmentVariable: "12", + expression: `strenv(myenv)`, expected: []string{ - "D0, P[], (!!null)::Null\n", - }, - }, - { - document: ``, - expression: `~`, - expected: []string{ - "D0, P[], (!!null)::~\n", + "D0, P[], (!!str)::\"12\"\n", }, }, }