curlybars 1.8.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/curlybars/error/lex.rb +1 -1
  3. data/lib/curlybars/error/parse.rb +1 -1
  4. data/lib/curlybars/node/path.rb +11 -13
  5. data/lib/curlybars/presenter.rb +2 -2
  6. data/lib/curlybars/rendering_support.rb +2 -1
  7. data/lib/curlybars/template_handler.rb +3 -15
  8. data/lib/curlybars/version.rb +1 -1
  9. metadata +32 -108
  10. data/spec/acceptance/application_layout_spec.rb +0 -60
  11. data/spec/acceptance/collection_blocks_spec.rb +0 -28
  12. data/spec/acceptance/global_helper_spec.rb +0 -25
  13. data/spec/curlybars/configuration_spec.rb +0 -57
  14. data/spec/curlybars/error/base_spec.rb +0 -41
  15. data/spec/curlybars/error/compile_spec.rb +0 -19
  16. data/spec/curlybars/error/lex_spec.rb +0 -25
  17. data/spec/curlybars/error/parse_spec.rb +0 -74
  18. data/spec/curlybars/error/render_spec.rb +0 -19
  19. data/spec/curlybars/error/validate_spec.rb +0 -19
  20. data/spec/curlybars/lexer_spec.rb +0 -490
  21. data/spec/curlybars/method_whitelist_spec.rb +0 -299
  22. data/spec/curlybars/processor/tilde_spec.rb +0 -60
  23. data/spec/curlybars/rendering_support_spec.rb +0 -421
  24. data/spec/curlybars/safe_buffer_spec.rb +0 -46
  25. data/spec/curlybars/template_handler_spec.rb +0 -225
  26. data/spec/integration/cache_spec.rb +0 -126
  27. data/spec/integration/comment_spec.rb +0 -60
  28. data/spec/integration/exception_spec.rb +0 -31
  29. data/spec/integration/node/block_helper_else_spec.rb +0 -420
  30. data/spec/integration/node/each_else_spec.rb +0 -408
  31. data/spec/integration/node/each_spec.rb +0 -289
  32. data/spec/integration/node/escape_spec.rb +0 -27
  33. data/spec/integration/node/helper_spec.rb +0 -186
  34. data/spec/integration/node/if_else_spec.rb +0 -170
  35. data/spec/integration/node/if_spec.rb +0 -153
  36. data/spec/integration/node/output_spec.rb +0 -66
  37. data/spec/integration/node/partial_spec.rb +0 -64
  38. data/spec/integration/node/path_spec.rb +0 -296
  39. data/spec/integration/node/root_spec.rb +0 -13
  40. data/spec/integration/node/sub_expression_spec.rb +0 -426
  41. data/spec/integration/node/template_spec.rb +0 -84
  42. data/spec/integration/node/unless_else_spec.rb +0 -139
  43. data/spec/integration/node/unless_spec.rb +0 -128
  44. data/spec/integration/node/with_spec.rb +0 -178
  45. data/spec/integration/processor/tilde_spec.rb +0 -38
  46. data/spec/integration/processors_spec.rb +0 -29
  47. data/spec/integration/visitor_spec.rb +0 -154
@@ -1,74 +0,0 @@
1
- describe Curlybars::Error::Parse do
2
- let(:source) { "first_line\n0123456789\nthird_line" }
3
-
4
- describe "with current token not being EOS" do
5
- let(:position) do
6
- OpenStruct.new(
7
- line_number: 2,
8
- line_offset: 3,
9
- length: 3,
10
- file_name: 'template.hbs'
11
- )
12
- end
13
-
14
- let(:exception) do
15
- current = double(:current, position: position, type: :type)
16
- double(:exception, current: current)
17
- end
18
-
19
- it "creates an exception with a meaningful message" do
20
- message = ".. 012 `345` 6789 .. is not permitted in this context"
21
-
22
- lex_exception = Curlybars::Error::Parse.new(source, exception)
23
-
24
- expect(lex_exception.message).to eq message
25
- end
26
-
27
- it "figures out a position from the exception" do
28
- backtrace = "%s:%d:%d" % [position.file_name, position.line_number, position.line_offset]
29
-
30
- lex_exception = Curlybars::Error::Parse.new(source, exception)
31
-
32
- expect(lex_exception.backtrace).to eq [backtrace]
33
- end
34
- end
35
-
36
- describe "with current token being EOS" do
37
- let(:exception) do
38
- current = double(:current, position: nil, type: :EOS)
39
- double(:exception, current: current)
40
- end
41
-
42
- it "creates an exception with a meaningful message" do
43
- message = "A block helper hasn't been closed properly"
44
-
45
- lex_exception = Curlybars::Error::Parse.new(source, exception)
46
-
47
- expect(lex_exception.message).to eq message
48
- end
49
-
50
- it "creates an exception whose position contains the right line_number" do
51
- lex_exception = Curlybars::Error::Parse.new(source, exception)
52
-
53
- expect(lex_exception.position.line_number).to be 3
54
- end
55
-
56
- it "creates an exception whose position contains the right line_offset" do
57
- lex_exception = Curlybars::Error::Parse.new(source, exception)
58
-
59
- expect(lex_exception.position.line_offset).to be_zero
60
- end
61
-
62
- it "creates an exception whose position contains the right length" do
63
- lex_exception = Curlybars::Error::Parse.new(source, exception)
64
-
65
- expect(lex_exception.position.length).to be 'third_line'.length
66
- end
67
-
68
- it "creates an exception whose position contains a nil file_name" do
69
- lex_exception = Curlybars::Error::Parse.new(source, exception)
70
-
71
- expect(lex_exception.position.file_name).to be_nil
72
- end
73
- end
74
- end
@@ -1,19 +0,0 @@
1
- describe Curlybars::Error::Render do
2
- let(:position) do
3
- OpenStruct.new(
4
- line_number: 2,
5
- line_offset: 3,
6
- stream_offset: 14,
7
- length: 3,
8
- file_name: 'template.hbs'
9
- )
10
- end
11
-
12
- it "prefixes the id with `render.`" do
13
- id = 'id'
14
-
15
- exception = Curlybars::Error::Render.new(id, 'message', position)
16
-
17
- expect(exception.id).to eq 'render.%s' % id
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- describe Curlybars::Error::Validate do
2
- let(:position) do
3
- OpenStruct.new(
4
- line_number: 2,
5
- line_offset: 3,
6
- stream_offset: 14,
7
- length: 3,
8
- file_name: 'template.hbs'
9
- )
10
- end
11
-
12
- it "prefixes the id with `validate.`" do
13
- id = 'id'
14
-
15
- exception = Curlybars::Error::Validate.new(id, 'message', position)
16
-
17
- expect(exception.id).to eq 'validate.%s' % id
18
- end
19
- end
@@ -1,490 +0,0 @@
1
- describe Curlybars::Lexer do
2
- describe "{{!-- ... --}}" do
3
- it "skips begin of block comment" do
4
- expect(lex('{{!--')).to produce []
5
- end
6
-
7
- it "skips begin and end of block comment" do
8
- expect(lex('{{!----}}')).to produce []
9
- end
10
-
11
- it "skips a comment block containing curlybar code" do
12
- expect(lex('{{!--{{helper}}--}}')).to produce []
13
- end
14
-
15
- it "is resilient to whitespaces" do
16
- expect(lex('{{!-- --}}')).to produce []
17
- end
18
-
19
- it "is resilient to newlines" do
20
- expect(lex("{{!--\n--}}")).to produce []
21
- end
22
-
23
- it "is skipped when present in plain text" do
24
- expect(lex('text {{!----}} text')).to produce [:TEXT, :TEXT]
25
- end
26
- end
27
-
28
- describe "{{! ... }}" do
29
- it "skips begin of block comment" do
30
- expect(lex('{{!')).to produce []
31
- end
32
-
33
- it "skips begin and end of block comment" do
34
- expect(lex('{{!}}')).to produce []
35
- end
36
-
37
- it "is resilient to whitespaces" do
38
- expect(lex('{{! }}')).to produce []
39
- end
40
-
41
- it "is resilient to newlines" do
42
- expect(lex("{{!\n}}")).to produce []
43
- end
44
-
45
- it "is lexed when present in plain text" do
46
- expect(lex('text {{!}} text')).to produce [:TEXT, :TEXT]
47
- end
48
- end
49
-
50
- describe "{{<integer>}}" do
51
- it "is lexed as an integer" do
52
- expect(lex("{{7}}")).to produce [:START, :LITERAL, :END]
53
- end
54
-
55
- it "returns the expressed integer" do
56
- literal_token = lex("{{7}}").detect { |token| token.type == :LITERAL }
57
- expect(literal_token.value).to eq 7
58
- end
59
- end
60
-
61
- describe "{{<boolean>}}" do
62
- it "{{true}} is lexed as boolean" do
63
- expect(lex("{{true}}")).to produce [:START, :LITERAL, :END]
64
- end
65
-
66
- it "{{false}} is lexed as boolean" do
67
- expect(lex("{{false}}")).to produce [:START, :LITERAL, :END]
68
- end
69
-
70
- it "returns the expressed boolean" do
71
- literal_token = lex("{{true}}").detect { |token| token.type == :LITERAL }
72
- expect(literal_token.value).to be_truthy
73
- end
74
- end
75
-
76
- describe "{{''}}" do
77
- it "is lexed as a literal" do
78
- expect(lex("{{''}}")).to produce [:START, :LITERAL, :END]
79
- end
80
-
81
- it "returns the string between quotes" do
82
- literal_token = lex("{{'string'}}").detect { |token| token.type == :LITERAL }
83
- expect(literal_token.value).to eq '"string"'
84
- end
85
-
86
- it "is resilient to whitespaces" do
87
- expect(lex("{{ '' }}")).to produce [:START, :LITERAL, :END]
88
- end
89
-
90
- it "is lexed when present in plain text" do
91
- expect(lex("text {{''}} text")).to produce [:TEXT, :START, :LITERAL, :END, :TEXT]
92
- end
93
- end
94
-
95
- describe '{{""}}' do
96
- it "is lexed as a literal" do
97
- expect(lex('{{""}}')).to produce [:START, :LITERAL, :END]
98
- end
99
-
100
- it "returns the string between quotes" do
101
- literal_token = lex('{{"string"}}').detect { |token| token.type == :LITERAL }
102
- expect(literal_token.value).to eq '"string"'
103
- end
104
-
105
- it "is resilient to whitespaces" do
106
- expect(lex('{{ "" }}')).to produce [:START, :LITERAL, :END]
107
- end
108
-
109
- it "is lexed when present in plain text" do
110
- expect(lex('text {{""}} text')).to produce [:TEXT, :START, :LITERAL, :END, :TEXT]
111
- end
112
- end
113
-
114
- describe "{{@variable}}" do
115
- it "is lexed as a varaible" do
116
- expect(lex('{{@var}}')).to produce [:START, :VARIABLE, :END]
117
- end
118
-
119
- it "returns the identifier after `@`" do
120
- variable_token = lex('{{@var}}').detect { |token| token.type == :VARIABLE }
121
- expect(variable_token.value).to eq 'var'
122
- end
123
-
124
- it "returns the identifier after `@` also when using `../`" do
125
- variable_token = lex('{{@../var}}').detect { |token| token.type == :VARIABLE }
126
- expect(variable_token.value).to eq '../var'
127
- end
128
-
129
- it "is resilient to whitespaces" do
130
- expect(lex('{{ @var }}')).to produce [:START, :VARIABLE, :END]
131
- end
132
-
133
- it "is lexed when present in plain text" do
134
- expect(lex('text {{@var}} text')).to produce [:TEXT, :START, :VARIABLE, :END, :TEXT]
135
- end
136
- end
137
-
138
- describe "{{path context options}}" do
139
- it "is lexed with context and options" do
140
- expect(lex('{{path context key=value}}')).to produce [:START, :PATH, :PATH, :KEY, :PATH, :END]
141
- end
142
-
143
- it "is lexed without context" do
144
- expect(lex('{{path key=value}}')).to produce [:START, :PATH, :KEY, :PATH, :END]
145
- end
146
-
147
- it "is lexed without options" do
148
- expect(lex('{{path context}}')).to produce [:START, :PATH, :PATH, :END]
149
- end
150
-
151
- it "is lexed without context and options" do
152
- expect(lex('{{path}}')).to produce [:START, :PATH, :END]
153
- end
154
-
155
- it "is resilient to whitespaces" do
156
- expect(lex('{{ path }}')).to produce [:START, :PATH, :END]
157
- end
158
-
159
- it "is lexed when present in plain text" do
160
- expect(lex('text {{ path }} text')).to produce [:TEXT, :START, :PATH, :END, :TEXT]
161
- end
162
- end
163
-
164
- describe "{{path (path context options)}}" do
165
- it "is lexed with path, context and options" do
166
- expect(lex('{{path (path context key=value)}}')).to produce [:START, :PATH, :LPAREN, :PATH, :PATH, :KEY, :PATH, :RPAREN, :END]
167
- end
168
-
169
- it "is lexed without options" do
170
- expect(lex('{{path (path context)}}')).to produce [:START, :PATH, :LPAREN, :PATH, :PATH, :RPAREN, :END]
171
- end
172
-
173
- it "is lexed without context" do
174
- expect(lex('{{path (path key=value)}}')).to produce [:START, :PATH, :LPAREN, :PATH, :KEY, :PATH, :RPAREN, :END]
175
- end
176
-
177
- it "is lexed without context and options" do
178
- expect(lex('{{path (path)}}')).to produce [:START, :PATH, :LPAREN, :PATH, :RPAREN, :END]
179
- end
180
-
181
- it "is lexed with a nested subexpression" do
182
- expect(lex('{{path (path (path context key=value) key=value)}}')).to produce [:START, :PATH, :LPAREN, :PATH, :LPAREN, :PATH, :PATH, :KEY, :PATH, :RPAREN, :KEY, :PATH, :RPAREN, :END]
183
- end
184
- end
185
-
186
- describe "{{#if path}}...{{/if}}" do
187
- it "is lexed" do
188
- expect(lex('{{#if path}} text {{/if}}')).to produce(
189
- [:START, :HASH, :IF, :PATH, :END, :TEXT, :START, :SLASH, :IF, :END]
190
- )
191
- end
192
-
193
- it "is resilient to whitespaces" do
194
- expect(lex('{{ # if path }} text {{/ if }}')).to produce(
195
- [:START, :HASH, :IF, :PATH, :END, :TEXT, :START, :SLASH, :IF, :END]
196
- )
197
- end
198
-
199
- it "is lexed when present in plain text" do
200
- expect(lex('text {{#if path}} text {{/if}} text')).to produce(
201
- [:TEXT, :START, :HASH, :IF, :PATH, :END, :TEXT, :START, :SLASH, :IF, :END, :TEXT]
202
- )
203
- end
204
- end
205
-
206
- # rubocop:disable Layout/ArrayAlignment
207
- describe "{{#if path}}...{{else}}...{{/if}}" do
208
- it "is lexed" do
209
- expect(lex('{{#if path}} text {{else}} text {{/if}}')).to produce(
210
- [:START, :HASH, :IF, :PATH, :END,
211
- :TEXT, :START, :ELSE, :END,
212
- :TEXT, :START, :SLASH, :IF, :END]
213
- )
214
- end
215
-
216
- it "is resilient to whitespaces" do
217
- expect(lex('{{ # if path }} text {{ else }} text {{/ if }}')).to produce(
218
- [:START, :HASH, :IF, :PATH, :END,
219
- :TEXT, :START, :ELSE, :END,
220
- :TEXT, :START, :SLASH, :IF, :END]
221
- )
222
- end
223
-
224
- it "is lexed when present in plain text" do
225
- expect(lex('text {{#if path}} text {{else}} text {{/if}} text')).to produce(
226
- [:TEXT, :START, :HASH, :IF, :PATH, :END,
227
- :TEXT, :START, :ELSE, :END,
228
- :TEXT, :START, :SLASH, :IF, :END, :TEXT]
229
- )
230
- end
231
- end
232
-
233
- describe "{{#unless path}}...{{/unless}}" do
234
- it "is lexed" do
235
- expect(lex('{{#unless path}} text {{/unless}}')).to produce(
236
- [:START, :HASH, :UNLESS, :PATH, :END, :TEXT, :START, :SLASH, :UNLESS, :END]
237
- )
238
- end
239
-
240
- it "is resilient to whitespaces" do
241
- expect(lex('{{ # unless path }} text {{/ unless }}')).to produce(
242
- [:START, :HASH, :UNLESS, :PATH, :END, :TEXT, :START, :SLASH, :UNLESS, :END]
243
- )
244
- end
245
-
246
- it "is lexed when present in plain text" do
247
- expect(lex('text {{#unless path}} text {{/unless}} text')).to produce(
248
- [:TEXT, :START, :HASH, :UNLESS, :PATH, :END, :TEXT, :START, :SLASH, :UNLESS, :END, :TEXT]
249
- )
250
- end
251
- end
252
-
253
- describe "{{#unless path}}...{{else}}...{{/unless}}" do
254
- it "is lexed" do
255
- expect(lex('{{#unless path}} text {{else}} text {{/unless}}')).to produce(
256
- [:START, :HASH, :UNLESS, :PATH, :END,
257
- :TEXT, :START, :ELSE, :END,
258
- :TEXT, :START, :SLASH, :UNLESS, :END]
259
- )
260
- end
261
-
262
- it "is resilient to whitespaces" do
263
- expect(lex('{{ # unless path }} text {{ else }} text {{/ unless }}')).to produce(
264
- [:START, :HASH, :UNLESS, :PATH, :END,
265
- :TEXT, :START, :ELSE, :END,
266
- :TEXT, :START, :SLASH, :UNLESS, :END]
267
- )
268
- end
269
-
270
- it "is lexed when present in plain text" do
271
- expect(lex('text {{#unless path}} text {{else}} text {{/unless}} text')).to produce(
272
- [:TEXT, :START, :HASH, :UNLESS, :PATH, :END,
273
- :TEXT, :START, :ELSE, :END,
274
- :TEXT, :START, :SLASH, :UNLESS, :END, :TEXT]
275
- )
276
- end
277
- end
278
-
279
- describe "{{#each path}}...{{/each}}" do
280
- it "is lexed" do
281
- expect(lex('{{#each path}} text {{/each}}')).to produce(
282
- [:START, :HASH, :EACH, :PATH, :END, :TEXT, :START, :SLASH, :EACH, :END]
283
- )
284
- end
285
-
286
- it "is resilient to whitespaces" do
287
- expect(lex('{{ # each path }} text {{/ each }}')).to produce(
288
- [:START, :HASH, :EACH, :PATH, :END, :TEXT, :START, :SLASH, :EACH, :END]
289
- )
290
- end
291
-
292
- it "is lexed when present in plain text" do
293
- expect(lex('text {{#each path}} text {{/each}} text')).to produce(
294
- [:TEXT, :START, :HASH, :EACH, :PATH, :END, :TEXT, :START, :SLASH, :EACH, :END, :TEXT]
295
- )
296
- end
297
- end
298
-
299
- describe "{{#each path}}...{{else}}...{{/each}}" do
300
- it "is lexed" do
301
- expect(lex('{{#each path}} text {{else}} text {{/each}}')).to produce(
302
- [:START, :HASH, :EACH, :PATH, :END,
303
- :TEXT, :START, :ELSE, :END,
304
- :TEXT, :START, :SLASH, :EACH, :END]
305
- )
306
- end
307
-
308
- it "is resilient to whitespaces" do
309
- expect(lex('{{ # each path }} text {{ else }} text {{/ each }}')).to produce(
310
- [:START, :HASH, :EACH, :PATH, :END,
311
- :TEXT, :START, :ELSE, :END,
312
- :TEXT, :START, :SLASH, :EACH, :END]
313
- )
314
- end
315
-
316
- it "is lexed when present in plain text" do
317
- expect(lex('text {{#each path}} text {{else}} text {{/each}} text')).to produce(
318
- [:TEXT, :START, :HASH, :EACH, :PATH, :END,
319
- :TEXT, :START, :ELSE, :END,
320
- :TEXT, :START, :SLASH, :EACH, :END, :TEXT]
321
- )
322
- end
323
- end
324
- # rubocop:enable Layout/ArrayAlignment
325
-
326
- describe "{{#with path}}...{{/with}}" do
327
- it "is lexed" do
328
- expect(lex('{{#with path}} text {{/with}}')).to produce(
329
- [:START, :HASH, :WITH, :PATH, :END, :TEXT, :START, :SLASH, :WITH, :END]
330
- )
331
- end
332
-
333
- it "is resilient to whitespaces" do
334
- expect(lex('{{ # with path }} text {{/ with }}')).to produce(
335
- [:START, :HASH, :WITH, :PATH, :END, :TEXT, :START, :SLASH, :WITH, :END]
336
- )
337
- end
338
-
339
- it "is lexed when present in plain text" do
340
- expect(lex('text {{#with path}} text {{/with}} text')).to produce(
341
- [:TEXT, :START, :HASH, :WITH, :PATH, :END, :TEXT, :START, :SLASH, :WITH, :END, :TEXT]
342
- )
343
- end
344
- end
345
-
346
- describe "{{#path path options}}...{{/path}}" do
347
- it "is lexed with context and options" do
348
- expect(lex('{{#path context key=value}} text {{/path}}')).to produce(
349
- [:START, :HASH, :PATH, :PATH, :KEY, :PATH, :END, :TEXT, :START, :SLASH, :PATH, :END]
350
- )
351
- end
352
-
353
- it "is lexed without options" do
354
- expect(lex('{{#path context}} text {{/path}}')).to produce(
355
- [:START, :HASH, :PATH, :PATH, :END, :TEXT, :START, :SLASH, :PATH, :END]
356
- )
357
- end
358
-
359
- it "is resilient to whitespaces" do
360
- expect(lex('{{ # path context key = value}} text {{/ path }}')).to produce(
361
- [:START, :HASH, :PATH, :PATH, :KEY, :PATH, :END, :TEXT, :START, :SLASH, :PATH, :END]
362
- )
363
- end
364
-
365
- it "is lexed when present in plain text" do
366
- expect(lex('text {{#path context key=value}} text {{/path}} text')).to produce(
367
- [:TEXT, :START, :HASH, :PATH, :PATH, :KEY, :PATH, :END, :TEXT, :START, :SLASH, :PATH, :END, :TEXT]
368
- )
369
- end
370
- end
371
-
372
- describe "{{>path}}" do
373
- it "is lexed" do
374
- expect(lex('{{>path}}')).to produce [:START, :GT, :PATH, :END]
375
- end
376
-
377
- it "is resilient to whitespaces" do
378
- expect(lex('{{ > path }}')).to produce [:START, :GT, :PATH, :END]
379
- end
380
-
381
- it "is lexed when present in plain text" do
382
- expect(lex('text {{>path}} text')).to produce [:TEXT, :START, :GT, :PATH, :END, :TEXT]
383
- end
384
- end
385
-
386
- describe "when a leading backslash is present" do
387
- it "`{` is lexed as plain text" do
388
- expect(lex('\{')).to produce [:TEXT]
389
- end
390
-
391
- it "returns the original text" do
392
- text_token = lex('\{').detect { |token| token.type == :TEXT }
393
- expect(text_token.value).to eq '{'
394
- end
395
-
396
- it "is lexed when present in plain text" do
397
- expect(lex('text \{ text')).to produce [:TEXT, :TEXT, :TEXT]
398
- end
399
- end
400
-
401
- describe "can lex paths with or without leading `../`s" do
402
- it "`path` is lexed as a path" do
403
- expect(lex('{{path}}')).to produce [:START, :PATH, :END]
404
- end
405
-
406
- it "`../path` is lexed as a path" do
407
- expect(lex('{{../path}}')).to produce [:START, :PATH, :END]
408
- end
409
-
410
- it "`../../path` is lexed as a path" do
411
- expect(lex('{{../../path}}')).to produce [:START, :PATH, :END]
412
- end
413
-
414
- it "`path/../` raises an error" do
415
- expect do
416
- lex('{{path/../}}')
417
- end.to raise_error(RLTK::LexingError)
418
- end
419
- end
420
-
421
- describe "can lex paths with dashes" do
422
- it "`surrounded by other valid chars" do
423
- expect(lex('{{a-path}}')).to produce [:START, :PATH, :END]
424
- end
425
-
426
- it "at the beginning" do
427
- expect(lex('{{-path}}')).to produce [:START, :PATH, :END]
428
- end
429
-
430
- it "at the end" do
431
- expect(lex('{{path-}}')).to produce [:START, :PATH, :END]
432
- end
433
- end
434
-
435
- describe "can lex paths with identifiers that are numebrs" do
436
- it "`surrounded by other valid chars" do
437
- expect(lex('{{path.123}}')).to produce [:START, :PATH, :END]
438
- end
439
- end
440
-
441
- describe "outside a curlybar context" do
442
- it "`--}}` is lexed as plain text" do
443
- expect(lex('--}}')).to produce [:TEXT]
444
- end
445
-
446
- it "`}}` is lexed as plain text" do
447
- expect(lex('}}')).to produce [:TEXT]
448
- end
449
-
450
- it "`#` is lexed as plain text" do
451
- expect(lex('#')).to produce [:TEXT]
452
- end
453
-
454
- it "`/` is lexed as plain text" do
455
- expect(lex('/')).to produce [:TEXT]
456
- end
457
-
458
- it "`>` is lexed as plain text" do
459
- expect(lex('>')).to produce [:TEXT]
460
- end
461
-
462
- it "`if` is lexed as plain text" do
463
- expect(lex('if')).to produce [:TEXT]
464
- end
465
-
466
- it "`unless` is lexed as plain text" do
467
- expect(lex('unless')).to produce [:TEXT]
468
- end
469
-
470
- it "`each` is lexed as plain text" do
471
- expect(lex('each')).to produce [:TEXT]
472
- end
473
-
474
- it "`with` is lexed as plain text" do
475
- expect(lex('with')).to produce [:TEXT]
476
- end
477
-
478
- it "`else` is lexed as plain text" do
479
- expect(lex('else')).to produce [:TEXT]
480
- end
481
-
482
- it "a path is lexed as plain text" do
483
- expect(lex('this.is.a.path')).to produce [:TEXT]
484
- end
485
-
486
- it "an option is lexed as plain text" do
487
- expect(lex('key=value')).to produce [:TEXT]
488
- end
489
- end
490
- end