Skip to content

Commit 67f150f

Browse files
committed
tests: fix existing snapshot and add test for dynamic source paths
Adds a simple test for dynamic source paths and updates the snapshot to match new tests / behaivor. Note: all the line numbers in the snapshot increased by 2 because I added two new lines (the test and a blank one)
1 parent e451a84 commit 67f150f

File tree

2 files changed

+37
-18
lines changed

2 files changed

+37
-18
lines changed

server/src/util/__tests__/__snapshots__/sourcing.test.ts.snap

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,30 @@ exports[`getSourcedUris returns a set of sourced files (but ignores some unhandl
8686
},
8787
"uri": null,
8888
},
89+
{
90+
"error": null,
91+
"range": {
92+
"end": {
93+
"character": 39,
94+
"line": 15,
95+
},
96+
"start": {
97+
"character": 6,
98+
"line": 15,
99+
},
100+
},
101+
"uri": "file:///Users/bash/issue-926.sh",
102+
},
89103
{
90104
"error": "non-constant source not supported",
91105
"range": {
92106
"end": {
93107
"character": 66,
94-
"line": 16,
108+
"line": 18,
95109
},
96110
"start": {
97111
"character": 49,
98-
"line": 16,
112+
"line": 18,
99113
},
100114
},
101115
"uri": null,
@@ -105,11 +119,11 @@ exports[`getSourcedUris returns a set of sourced files (but ignores some unhandl
105119
"range": {
106120
"end": {
107121
"character": 66,
108-
"line": 18,
122+
"line": 20,
109123
},
110124
"start": {
111125
"character": 6,
112-
"line": 18,
126+
"line": 20,
113127
},
114128
},
115129
"uri": null,
@@ -119,11 +133,11 @@ exports[`getSourcedUris returns a set of sourced files (but ignores some unhandl
119133
"range": {
120134
"end": {
121135
"character": 30,
122-
"line": 25,
136+
"line": 27,
123137
},
124138
"start": {
125139
"character": 8,
126-
"line": 25,
140+
"line": 27,
127141
},
128142
},
129143
"uri": "file:///Users/bash/issue206.sh",
@@ -133,53 +147,53 @@ exports[`getSourcedUris returns a set of sourced files (but ignores some unhandl
133147
"range": {
134148
"end": {
135149
"character": 22,
136-
"line": 47,
150+
"line": 49,
137151
},
138152
"start": {
139153
"character": 8,
140-
"line": 47,
154+
"line": 49,
141155
},
142156
},
143157
"uri": null,
144158
},
145159
{
146-
"error": "non-constant source not supported",
160+
"error": null,
147161
"range": {
148162
"end": {
149163
"character": 39,
150-
"line": 59,
164+
"line": 61,
151165
},
152166
"start": {
153167
"character": 8,
154-
"line": 59,
168+
"line": 61,
155169
},
156170
},
157-
"uri": null,
171+
"uri": "file:///Users/bash/staging.sh",
158172
},
159173
{
160-
"error": "non-constant source not supported",
174+
"error": null,
161175
"range": {
162176
"end": {
163177
"character": 42,
164-
"line": 62,
178+
"line": 64,
165179
},
166180
"start": {
167181
"character": 8,
168-
"line": 62,
182+
"line": 64,
169183
},
170184
},
171-
"uri": null,
185+
"uri": "file:///Users/bash/production.sh",
172186
},
173187
{
174188
"error": "non-constant source not supported",
175189
"range": {
176190
"end": {
177191
"character": 67,
178-
"line": 89,
192+
"line": 91,
179193
},
180194
"start": {
181195
"character": 10,
182-
"line": 89,
196+
"line": 91,
183197
},
184198
},
185199
"uri": null,

server/src/util/__tests__/sourcing.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ describe('getSourcedUris', () => {
4646
4747
source "$LIBPATH" # dynamic imports not supported
4848
49+
source "$SCRIPT_DIR"/issue-926.sh # remove leading dynamic segment
50+
4951
# conditional is currently not supported
5052
if [[ -z $__COMPLETION_LIB_LOADED ]]; then source "$LIBPATH" ; fi
5153
@@ -144,7 +146,10 @@ describe('getSourcedUris', () => {
144146
"file:///Users/bash/x",
145147
"file:///Users/scripts/release-client.sh",
146148
"file:///Users/bash-user/myscript",
149+
"file:///Users/bash/issue-926.sh",
147150
"file:///Users/bash/issue206.sh",
151+
"file:///Users/bash/staging.sh",
152+
"file:///Users/bash/production.sh",
148153
}
149154
`)
150155

0 commit comments

Comments
 (0)