@@ -67,9 +67,14 @@ func TestScriptElementParser(t *testing.T) {
6767 expected * ScriptElement
6868 }{
6969 {
70- name : "script: no content" ,
71- input : `<script></script>` ,
72- expected : & ScriptElement {},
70+ name : "script: no content" ,
71+ input : `<script></script>` ,
72+ expected : & ScriptElement {
73+ Range : Range {
74+ From : Position {Index : 0 , Line : 0 , Col : 0 },
75+ To : Position {Index : 17 , Line : 0 , Col : 17 },
76+ },
77+ },
7378 },
7479 {
7580 name : "script: vbscript" ,
@@ -107,6 +112,10 @@ func TestScriptElementParser(t *testing.T) {
107112 },
108113 }, false ),
109114 },
115+ Range : Range {
116+ From : Position {Index : 0 , Line : 0 , Col : 0 },
117+ To : Position {Index : 27 , Line : 0 , Col : 27 },
118+ },
110119 },
111120 },
112121 {
@@ -133,6 +142,10 @@ func TestScriptElementParser(t *testing.T) {
133142 },
134143 }, false ),
135144 },
145+ Range : Range {
146+ From : Position {Index : 0 , Line : 0 , Col : 0 },
147+ To : Position {Index : 50 , Line : 0 , Col : 50 },
148+ },
136149 },
137150 },
138151 {
@@ -159,6 +172,10 @@ func TestScriptElementParser(t *testing.T) {
159172 },
160173 }, false ),
161174 },
175+ Range : Range {
176+ From : Position {Index : 0 , Line : 0 , Col : 0 },
177+ To : Position {Index : 41 , Line : 0 , Col : 41 },
178+ },
162179 },
163180 },
164181 {
@@ -185,6 +202,10 @@ func TestScriptElementParser(t *testing.T) {
185202 },
186203 }, false ),
187204 },
205+ Range : Range {
206+ From : Position {Index : 0 , Line : 0 , Col : 0 },
207+ To : Position {Index : 45 , Line : 0 , Col : 45 },
208+ },
188209 },
189210 },
190211 {
@@ -206,6 +227,10 @@ func TestScriptElementParser(t *testing.T) {
206227 TrailingSpace : SpaceVertical ,
207228 }, false ),
208229 },
230+ Range : Range {
231+ From : Position {Index : 0 , Line : 0 , Col : 0 },
232+ To : Position {Index : 29 , Line : 2 , Col : 9 },
233+ },
209234 },
210235 },
211236 {
@@ -225,6 +250,10 @@ func TestScriptElementParser(t *testing.T) {
225250 }, true ),
226251 NewScriptContentsScriptCode ("';" ),
227252 },
253+ Range : Range {
254+ From : Position {Index : 0 , Line : 0 , Col : 0 },
255+ To : Position {Index : 38 , Line : 0 , Col : 38 },
256+ },
228257 },
229258 },
230259 {
@@ -244,6 +273,10 @@ func TestScriptElementParser(t *testing.T) {
244273 }, true ),
245274 NewScriptContentsScriptCode ("\" ;" ),
246275 },
276+ Range : Range {
277+ From : Position {Index : 0 , Line : 0 , Col : 0 },
278+ To : Position {Index : 38 , Line : 0 , Col : 38 },
279+ },
247280 },
248281 },
249282 {
@@ -266,6 +299,10 @@ to see if it works";</script>`,
266299 }, true ),
267300 NewScriptContentsScriptCode ("\\ \n to see if it works\" ;" ),
268301 },
302+ Range : Range {
303+ From : Position {Index : 0 , Line : 0 , Col : 0 },
304+ To : Position {Index : 76 , Line : 2 , Col : 29 },
305+ },
269306 },
270307 },
271308 {
@@ -285,6 +322,10 @@ to see if it works";</script>`,
285322 }, true ),
286323 NewScriptContentsScriptCode ("`;" ),
287324 },
325+ Range : Range {
326+ From : Position {Index : 0 , Line : 0 , Col : 0 },
327+ To : Position {Index : 38 , Line : 0 , Col : 38 },
328+ },
288329 },
289330 },
290331 {
@@ -297,6 +338,10 @@ to see if it works";</script>`,
297338 NewScriptContentsScriptCode ("\n " ),
298339 NewScriptContentsScriptCode ("// {{ name }}\n " ),
299340 },
341+ Range : Range {
342+ From : Position {Index : 0 , Line : 0 , Col : 0 },
343+ To : Position {Index : 32 , Line : 2 , Col : 9 },
344+ },
300345 },
301346 },
302347 {
@@ -311,6 +356,10 @@ but it's commented out */
311356 NewScriptContentsScriptCode ("\n " ),
312357 NewScriptContentsScriptCode ("/* There's some content\n {{ name }}\n but it's commented out */\n " ),
313358 },
359+ Range : Range {
360+ From : Position {Index : 0 , Line : 0 , Col : 0 },
361+ To : Position {Index : 79 , Line : 4 , Col : 9 },
362+ },
314363 },
315364 },
316365 {
0 commit comments