@@ -71,6 +71,48 @@ func TestExpand(t *testing.T) {
7171 envVars : map [string ]string {},
7272 expected : "Use `inline` and ```block``` code" ,
7373 },
74+ {
75+ name : "single backslash" ,
76+ commands : "test\\ value" ,
77+ envVars : map [string ]string {},
78+ expected : "test\\ value" ,
79+ },
80+ {
81+ name : "backslash n (not newline)" ,
82+ commands : "test\\ nvalue" ,
83+ envVars : map [string ]string {},
84+ expected : "test\\ nvalue" ,
85+ },
86+ {
87+ name : "backslash t (not tab)" ,
88+ commands : "test\\ tvalue" ,
89+ envVars : map [string ]string {},
90+ expected : "test\\ tvalue" ,
91+ },
92+ {
93+ name : "windows path" ,
94+ commands : "C:\\ Users\\ Alice\\ Documents" ,
95+ envVars : map [string ]string {},
96+ expected : "C:\\ Users\\ Alice\\ Documents" ,
97+ },
98+ {
99+ name : "network path" ,
100+ commands : "\\ \\ server\\ share\\ file" ,
101+ envVars : map [string ]string {},
102+ expected : "\\ \\ server\\ share\\ file" ,
103+ },
104+ {
105+ name : "multiple backslashes" ,
106+ commands : "test\\ \\ value" ,
107+ envVars : map [string ]string {},
108+ expected : "test\\ \\ value" ,
109+ },
110+ {
111+ name : "regex pattern with backslashes" ,
112+ commands : "\\ d+\\ .\\ d+" ,
113+ envVars : map [string ]string {},
114+ expected : "\\ d+\\ .\\ d+" ,
115+ },
74116 }
75117
76118 for _ , tt := range tests {
0 commit comments