@@ -63,6 +63,78 @@ var envOperatorScenarios = []expressionScenario{
6363 "D0, P[], ()::a: \" 12\" \n " ,
6464 },
6565 },
66+ {
67+ description : "strenv with newline escape" ,
68+ skipDoc : true ,
69+ environmentVariables : map [string ]string {"myenv" : "string with a\\ n" },
70+ expression : `.a = strenv(myenv)` ,
71+ expected : []string {
72+ "D0, P[], ()::a: |\n string with a\n " ,
73+ },
74+ },
75+ {
76+ description : "strenv with tab escape" ,
77+ skipDoc : true ,
78+ environmentVariables : map [string ]string {"myenv" : "string with a\\ t" },
79+ expression : `.a = strenv(myenv)` ,
80+ expected : []string {
81+ "D0, P[], ()::a: \" string with a\\ t\" \n " ,
82+ },
83+ },
84+ {
85+ description : "strenv with carriage return escape" ,
86+ skipDoc : true ,
87+ environmentVariables : map [string ]string {"myenv" : "string with a\\ r" },
88+ expression : `.a = strenv(myenv)` ,
89+ expected : []string {
90+ "D0, P[], ()::a: \" string with a\\ r\" \n " ,
91+ },
92+ },
93+ {
94+ description : "strenv with form feed escape" ,
95+ skipDoc : true ,
96+ environmentVariables : map [string ]string {"myenv" : "string with a\\ f" },
97+ expression : `.a = strenv(myenv)` ,
98+ expected : []string {
99+ "D0, P[], ()::a: \" string with a\\ f\" \n " ,
100+ },
101+ },
102+ {
103+ description : "strenv with vertical tab escape" ,
104+ skipDoc : true ,
105+ environmentVariables : map [string ]string {"myenv" : "string with a\\ v" },
106+ expression : `.a = strenv(myenv)` ,
107+ expected : []string {
108+ "D0, P[], ()::a: \" string with a\\ v\" \n " ,
109+ },
110+ },
111+ {
112+ description : "strenv with backspace escape" ,
113+ skipDoc : true ,
114+ environmentVariables : map [string ]string {"myenv" : "string with a\\ b" },
115+ expression : `.a = strenv(myenv)` ,
116+ expected : []string {
117+ "D0, P[], ()::a: \" string with a\\ b\" \n " ,
118+ },
119+ },
120+ {
121+ description : "strenv with alert/bell escape" ,
122+ skipDoc : true ,
123+ environmentVariables : map [string ]string {"myenv" : "string with a\\ a" },
124+ expression : `.a = strenv(myenv)` ,
125+ expected : []string {
126+ "D0, P[], ()::a: \" string with a\\ a\" \n " ,
127+ },
128+ },
129+ {
130+ description : "strenv with double quote escape" ,
131+ skipDoc : true ,
132+ environmentVariables : map [string ]string {"myenv" : "string with a\\ \" " },
133+ expression : `.a = strenv(myenv)` ,
134+ expected : []string {
135+ "D0, P[], ()::a: string with a\" \n " ,
136+ },
137+ },
66138 {
67139 description : "Dynamically update a path from an environment variable" ,
68140 subdescription : "The env variable can be any valid yq expression." ,
0 commit comments