We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c556ae commit 13e8debCopy full SHA for 13e8deb
common/script_parser_test.go
@@ -0,0 +1,29 @@
1
+package common
2
+
3
+import (
4
+ "testing"
5
6
+ "github.com/stretchr/testify/assert"
7
+)
8
9
+func Test_parsing_scrip_assignments(t *testing.T) {
10
+ input := `
11
+if [[ true ]]; then
12
+ export PATH="/path1:$PATH"
13
+else
14
+ export PATH="${PATH}:/path2"
15
+fi
16
+PATH=$PATH:/path3
17
+path=$path:/path4
18
+TEST=$PATH:/path5
19
+`
20
+ var seenValues string
21
+ ForEachVariableAssignment("PATH", input, func(s string) {
22
+ seenValues += s
23
+ })
24
+ assert.Contains(t, seenValues, "/path1")
25
+ assert.Contains(t, seenValues, "/path2")
26
+ assert.Contains(t, seenValues, "/path3")
27
+ assert.NotContains(t, seenValues, "/path4")
28
+ assert.NotContains(t, seenValues, "/path5")
29
+}
0 commit comments