livetext 0.9.25 → 0.9.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/imports/bookish.rb +1 -2
  3. data/lib/livetext/errors.rb +3 -0
  4. data/lib/livetext/formatline.rb +102 -15
  5. data/lib/livetext/funcall.rb +86 -2
  6. data/lib/livetext/global_helpers.rb +5 -0
  7. data/lib/livetext/handler/import.rb +2 -6
  8. data/lib/livetext/handler/mixin.rb +2 -6
  9. data/lib/livetext/helpers.rb +9 -11
  10. data/lib/livetext/lineparser.rb +441 -0
  11. data/lib/livetext/more.rb +158 -0
  12. data/lib/livetext/processor.rb +3 -1
  13. data/lib/livetext/skeleton.rb +5 -0
  14. data/lib/livetext/standard.rb +12 -8
  15. data/lib/livetext/userapi.rb +27 -10
  16. data/lib/livetext/version.rb +1 -1
  17. data/lib/livetext.rb +3 -152
  18. data/test/snapshots/basic_formatting/actual-error.txt +0 -0
  19. data/test/snapshots/basic_formatting/actual-output.txt +13 -0
  20. data/test/snapshots/basic_formatting/err-sdiff.txt +1 -0
  21. data/test/snapshots/basic_formatting/out-sdiff.txt +14 -0
  22. data/test/snapshots/error_invalid_name/foo +5 -0
  23. data/test/snapshots/import_bookish/expected-output.txt +4 -4
  24. data/test/snapshots/more_functions/actual-error.txt +0 -0
  25. data/test/snapshots/more_functions/actual-output.txt +37 -0
  26. data/test/snapshots/more_functions/err-sdiff.txt +1 -0
  27. data/test/snapshots/more_functions/expected-output.txt +1 -1
  28. data/test/snapshots/more_functions/out-sdiff.txt +38 -0
  29. data/test/snapshots/more_functions/source.lt3 +1 -1
  30. data/test/snapshots/simple_vars/actual-error.txt +0 -0
  31. data/test/snapshots/simple_vars/actual-output.txt +6 -0
  32. data/test/snapshots/simple_vars/err-sdiff.txt +1 -0
  33. data/test/snapshots/simple_vars/out-sdiff.txt +7 -0
  34. data/test/snapshots/subset.txt +2 -0
  35. data/test/snapshots/var_into_func/actual-error.txt +0 -0
  36. data/test/snapshots/var_into_func/actual-output.txt +16 -0
  37. data/test/snapshots/var_into_func/err-sdiff.txt +1 -0
  38. data/test/snapshots/var_into_func/expected-error.txt +0 -0
  39. data/test/snapshots/var_into_func/expected-output.txt +16 -0
  40. data/test/snapshots/var_into_func/out-sdiff.txt +17 -0
  41. data/test/snapshots/var_into_func/source.lt3 +16 -0
  42. data/test/unit/all.rb +3 -1
  43. data/test/unit/formatline.rb +143 -274
  44. data/test/unit/lineparser.rb +650 -0
  45. data/test/unit/parser/set.rb +13 -12
  46. data/test/unit/tokenizer.rb +534 -0
  47. metadata +26 -5
  48. data/test/snapshots/error_inc_line_num/OUT +0 -17
  49. data/test/snapshots/error_no_such_copy/duh +0 -26
  50. data/test/snapshots/error_no_such_copy/mystery.txt +0 -36
@@ -13,7 +13,7 @@ class TestParseSet < MiniTest::Test
13
13
  def teardown
14
14
  end
15
15
 
16
- def test_one_unquoted
16
+ def xtest_one_unquoted
17
17
  set = ParseSet.new('my_var_123 = 789').parse
18
18
  pair = set.first
19
19
  assert_equal pair, %w[my_var_123 789]
@@ -23,37 +23,37 @@ class TestParseSet < MiniTest::Test
23
23
  assert_equal pair, %w[var_234 naked_string]
24
24
  end
25
25
 
26
- def test_one_single_quoted
26
+ def xtest_one_single_quoted
27
27
  set = ParseSet.new("fancy.var.name = 'simple string'").parse
28
28
  pair = set.first
29
29
  assert_equal pair, ["fancy.var.name", "simple string"]
30
30
  end
31
31
 
32
- def test_one_double_quoted
32
+ def xtest_one_double_quoted
33
33
  set = ParseSet.new('fancy.var2 = "another string"').parse
34
34
  pair = set.first
35
35
  assert_equal pair, ["fancy.var2", "another string"]
36
36
  end
37
37
 
38
- def test_multiple_unquoted
38
+ def xtest_multiple_unquoted
39
39
  pair1, pair2 = ParseSet.new("this=345, that=678").parse
40
40
  assert_equal pair1, %w[this 345]
41
41
  assert_equal pair2, %w[that 678]
42
42
  end
43
43
 
44
- def test_multiple_unquoted_quoted
44
+ def xtest_multiple_unquoted_quoted
45
45
  pair1, pair2 = ParseSet.new('alpha = 567, beta = "oh well"').parse
46
46
  assert_equal pair1, %w[alpha 567]
47
47
  assert_equal pair2, ["beta", "oh well"]
48
48
  end
49
49
 
50
- def test_quote_embedded_comma
50
+ def xtest_quote_embedded_comma
51
51
  set = ParseSet.new('gamma = "oh, well"').parse
52
52
  pair = set.first
53
53
  assert_equal pair, ["gamma", "oh, well"]
54
54
  end
55
55
 
56
- def test_get_var
56
+ def xtest_get_var
57
57
  @parse = ParseSet.new("foo=345")
58
58
  assert_equal @parse.get_var, "foo"
59
59
  @parse = ParseSet.new("foo = 345")
@@ -78,7 +78,7 @@ class TestParseSet < MiniTest::Test
78
78
  assert_raises(BadVariableName) { @parse.get_var }
79
79
  end
80
80
 
81
- def test_skip_equal
81
+ def xtest_skip_equal
82
82
  @parse = ParseSet.new("=")
83
83
  assert_nil @parse.skip_equal
84
84
  @parse = ParseSet.new(" = ")
@@ -96,7 +96,7 @@ class TestParseSet < MiniTest::Test
96
96
  assert_raises(NoEqualSign) { @parse.skip_equal }
97
97
  end
98
98
 
99
- def test_quoted_value
99
+ def xtest_quoted_value
100
100
  @parse = ParseSet.new(%['this'])
101
101
  assert_equal @parse.quoted_value, "this"
102
102
  @parse = ParseSet.new(%["that"])
@@ -118,7 +118,7 @@ class TestParseSet < MiniTest::Test
118
118
  # - allow (escaped?) comma in quoted string
119
119
  end
120
120
 
121
- def test_unquoted_value
121
+ def xtest_unquoted_value
122
122
  # Note: an unquoted value is still a string!
123
123
  @parse = ParseSet.new(%[342 ])
124
124
  assert_equal @parse.unquoted_value, "342"
@@ -137,7 +137,7 @@ class TestParseSet < MiniTest::Test
137
137
  # - allow/disallow escaping??
138
138
  end
139
139
 
140
- def test_var_eq_var
140
+ def xtest_var_eq_var
141
141
  set = ParseSet.new("file = $File").parse
142
142
  set = set.first # [["var", "value"]]
143
143
  assert_equal set.first, "file"
@@ -149,11 +149,12 @@ class TestParseSet < MiniTest::Test
149
149
  set = ParseSet.new("date = $$date").parse
150
150
  set = set.first # [["var", "value"]]
151
151
  assert_equal set.first, "date"
152
+ p set.last
152
153
  assert set.last =~ /undefined/, "Found 'undefined' for variable value"
153
154
  # ^ ParseSet isn't smart enough to know about variables/functions
154
155
  end
155
156
 
156
- def test_two_strings
157
+ def xtest_two_strings
157
158
  line = %[bday="May 31", date='5/31']
158
159
  set = ParseSet.new(line).parse
159
160
  assert set == [["bday", "May 31"], ["date", "5/31"]]
@@ -0,0 +1,534 @@
1
+ require 'minitest/autorun'
2
+
3
+ require_relative '../../lib/livetext'
4
+
5
+ class TestingLivetext < MiniTest::Test
6
+
7
+ LineParser = Livetext::LineParser
8
+
9
+ def perform_test(recv, sym, msg, src, exp)
10
+ actual = recv.send(sym, src)
11
+ if exp[0] == "/"
12
+ exp = Regexp.compile(exp[1..-2]) # skip slashes
13
+ $testme = false
14
+ assert_match(exp, actual, msg)
15
+ else
16
+ $testme = false
17
+ assert_equal(exp, actual, msg)
18
+ end
19
+ end
20
+
21
+ def invoke_test(msg, src, exp)
22
+ actual = LineParser.parse!(src)
23
+ if exp[0] == "/"
24
+ exp = Regexp.compile(exp[1..-2]) # skip slashes
25
+ $testme = false
26
+ assert_match(exp, actual, msg)
27
+ else
28
+ $testme = false
29
+ assert_equal(exp, actual, msg)
30
+ end
31
+ end
32
+
33
+ def test_tokenizer_simple_string
34
+ parse = LineParser.new("only testing")
35
+ tokens = parse.tokenize
36
+ assert_equal tokens, [[:str, "only testing"]], "Tokens were: #{tokens.inspect}"
37
+ end
38
+
39
+ def test_tokenizer_variable_interpolation
40
+ parse = LineParser.new("File is $File and user is $User")
41
+ tokens = parse.tokenize
42
+ expected_tokens = [[:str, "File is "],
43
+ [:var, "File"],
44
+ [:str, " and user is "],
45
+ [:var, "User"]]
46
+ assert_equal expected_tokens, tokens
47
+ end
48
+
49
+ def test_tokenizer_func_expansion
50
+ parse = LineParser.new("myfunc() results in $$myfunc apparently.")
51
+ tokens = parse.tokenize
52
+ expected_tokens = [[:str, "myfunc() results in "],
53
+ [:func, "myfunc"],
54
+ [:str, " apparently."]]
55
+ assert_equal expected_tokens, tokens
56
+ end
57
+
58
+ def test_tokenizer_func_2
59
+ str = "Today is $$date"
60
+ parse = LineParser.new(str)
61
+ tokens_expected = [[:str, "Today is "], [:func, "date"]]
62
+ tokens = parse.tokenize
63
+ assert_equal tokens_expected, tokens, "Tokens were: #{tokens.inspect}"
64
+ end
65
+
66
+ def test_tokenizer_var_before_comma
67
+ str = "User name is $User, and all is well"
68
+ parse = LineParser.new(str)
69
+ tokens_expected = [[:str, "User name is "], [:var, "User"], [:str, ", and all is well"]]
70
+ tokens = parse.tokenize
71
+ assert_equal tokens_expected, tokens, "Tokens were: #{tokens.inspect}"
72
+ end
73
+
74
+ def test_tokenizer_var_at_EOS
75
+ str = "File name is $File"
76
+ parse = LineParser.new(str)
77
+ tokens_expected = [[:str, "File name is "], [:var, "File"]]
78
+ tokens = parse.tokenize
79
+ assert_equal tokens_expected, tokens
80
+ end
81
+
82
+ def test_tokenizer_var_starts_string
83
+ str = "$File is my file name"
84
+ parse = LineParser.new(str)
85
+ tokens_expected = [[:var, "File"], [:str, " is my file name"]]
86
+ tokens = parse.tokenize
87
+ assert_equal tokens_expected, tokens
88
+ end
89
+
90
+ # Next one is/will be a problem...
91
+ # I permit periods *inside* variable names
92
+
93
+ def test_tokenizer_var_before_period
94
+ str = "This is $File\\." # FIXME escaped for now...
95
+ parse = LineParser.new(str)
96
+ tokens_expected = [[:str, "This is "], [:var, "File"], [:str, "."]]
97
+ tokens = parse.tokenize
98
+ assert_equal tokens_expected, tokens
99
+ end
100
+
101
+ def test_tokenizer_func_needing_parameter_colon_eos # colon, param, EOS
102
+ str = "Square root of 225 is $$isqrt:225"
103
+ parse = LineParser.new(str)
104
+ tokens_expected = [[:str, "Square root of 225 is "], [:func, "isqrt"], [:colon, "225"]]
105
+ tokens = parse.tokenize
106
+ assert_equal tokens_expected, tokens
107
+ end
108
+
109
+ def test_tokenizer_func_needing_parameter_colon # colon, param, more chars
110
+ str = "Answer is $$isqrt:225 today"
111
+ parse = LineParser.new(str)
112
+ tokens_expected = [[:str, "Answer is "],
113
+ [:func, "isqrt"],
114
+ [:colon, "225"],
115
+ [:str, " today"]]
116
+ tokens = parse.tokenize
117
+ assert_equal tokens_expected, tokens
118
+ end
119
+
120
+ # isqrt: Not real tests??
121
+
122
+ def test_tokenizer_isqrt_empty_colon_param
123
+ str = "Calculate $$isqrt:"
124
+ parse = LineParser.new(str)
125
+ tokens_expected = [[:str, "Calculate "],
126
+ [:func, "isqrt"] # , [:colon, ""]
127
+ ]
128
+ # If param is null, we don't get [:colon, value]!
129
+ # ^ FIXME function should be more like: [:func, name, param]
130
+ tokens = parse.tokenize
131
+ assert_equal tokens_expected, tokens
132
+ end
133
+
134
+ def test_tokenizer_isqrt_empty_bracket_param
135
+ str = "Calculate $$isqrt[]"
136
+ parse = LineParser.new(str)
137
+ tokens_expected = [[:str, "Calculate "],
138
+ [:func, "isqrt"] # , [:colon, ""]
139
+ ]
140
+ # If param is null, we don't get [:colon, value]!
141
+ # ^ FIXME function should be more like: [:func, name, param]
142
+ tokens = parse.tokenize
143
+ assert_equal tokens_expected, tokens
144
+ end
145
+
146
+ def test_tokenizer_isqrt_malformed_number
147
+ str = "Calculate $$isqrt[3a5]"
148
+ parse = LineParser.new(str)
149
+ tokens_expected = [[:str, "Calculate "],
150
+ [:func, "isqrt"],
151
+ [:brackets, "3a5"]
152
+ ]
153
+ # ^ FIXME function should be more like: [:func, name, param]
154
+ tokens = parse.tokenize
155
+ assert_equal tokens_expected, tokens
156
+ end
157
+
158
+ # ...end of this group
159
+
160
+ def test_tokenizer_func_with_colon
161
+ parse = LineParser.new("Calling $$myfunc:foo here.")
162
+ tokens = parse.tokenize
163
+ assert_equal tokens, [[:str, "Calling "],
164
+ [:func, "myfunc"],
165
+ [:colon, "foo"],
166
+ [:str, " here."]
167
+ ]
168
+ end
169
+
170
+ def test_tokenizer_func_with_brackets
171
+ parse = LineParser.new("Calling $$myfunc2[foo bar] here.")
172
+ tokens = parse.tokenize
173
+ assert_kind_of Array, tokens
174
+ assert_equal 4, tokens.size
175
+ expected_tokens = [[:str, "Calling "],
176
+ [:func, "myfunc2"],
177
+ [:brackets, "foo bar"],
178
+ [:str, " here."]]
179
+ assert_equal expected_tokens, tokens
180
+ end
181
+
182
+ def test_tokenizer_parse_formatting
183
+ msg, src, exp = <<~STUFF.split("\n")
184
+ Check simple formatting
185
+ This is *bold and _italics ...
186
+ This is <b>bold</b> and <i>italics</i> ...
187
+ STUFF
188
+ invoke_test(msg, src, exp)
189
+ end
190
+
191
+ def test_tokenizer_formatting_01 # Check output of $$date
192
+ msg, src, exp = <<~STUFF.split("\n")
193
+ Check output of $$date
194
+ Today is $$date, I guess
195
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
196
+ STUFF
197
+ invoke_test(msg, src, exp)
198
+ end
199
+
200
+ def test_tokenizer_formatting_02 # Check output of $$date
201
+ msg, src, exp = <<~STUFF.split("\n")
202
+ Check output of $$date
203
+ Today is $$date, I guess
204
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
205
+ STUFF
206
+ invoke_test(msg, src, exp)
207
+ end
208
+
209
+ def test_tokenizer_formatting_03 # Check output of $$date
210
+ msg, src, exp = <<~STUFF.split("\n")
211
+ Check output of $$date
212
+ Today is $$date, I guess
213
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
214
+ STUFF
215
+ invoke_test(msg, src, exp)
216
+ end
217
+
218
+ def test_tokenizer_formatting_04 # Check output of $$date
219
+ msg, src, exp = <<~STUFF.split("\n")
220
+ Check output of $$date
221
+ Today is $$date, I guess
222
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
223
+ STUFF
224
+ invoke_test(msg, src, exp)
225
+ end
226
+
227
+ def test_tokenizer_formatting_05 # Check output of $$date
228
+ msg, src, exp = <<~STUFF.split("\n")
229
+ Check output of $$date
230
+ Today is $$date, I guess
231
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
232
+ STUFF
233
+ invoke_test(msg, src, exp)
234
+ end
235
+
236
+ def test_tokenizer_formatting_06 # Check output of $$date
237
+ msg, src, exp = <<~STUFF.split("\n")
238
+ Check output of $$date
239
+ Today is $$date, I guess
240
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
241
+ STUFF
242
+ invoke_test(msg, src, exp)
243
+
244
+ actual = LineParser.parse!(src)
245
+ if exp[0] == "/"
246
+ exp = Regexp.compile(exp[1..-2]) # skip slashes
247
+ assert_match(exp, actual, msg)
248
+ else
249
+ assert_equal(exp, actual, msg)
250
+ end
251
+ end
252
+
253
+ def test_tokenizer_formatting_07 # Check output of $$date
254
+ msg, src, exp = <<~STUFF.split("\n")
255
+ Check output of $$date
256
+ Today is $$date, I guess
257
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
258
+ STUFF
259
+ invoke_test(msg, src, exp)
260
+
261
+ actual = LineParser.parse!(src)
262
+ if exp[0] == "/"
263
+ exp = Regexp.compile(exp[1..-2]) # skip slashes
264
+ assert_match(exp, actual, msg)
265
+ else
266
+ assert_equal(exp, actual, msg)
267
+ end
268
+ end
269
+
270
+ def test_tokenizer_formatting_08 # Check output of $$date
271
+ msg, src, exp = <<~STUFF.split("\n")
272
+ Check output of $$date
273
+ Today is $$date, I guess
274
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
275
+ STUFF
276
+ invoke_test(msg, src, exp)
277
+ end
278
+
279
+ def test_tokenizer_formatting_09 # Check output of $$date
280
+ msg, src, exp = <<~STUFF.split("\n")
281
+ Check output of $$date
282
+ Today is $$date, I guess
283
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
284
+ STUFF
285
+ invoke_test(msg, src, exp)
286
+ end
287
+
288
+ def test_tokenizer_formatting_10 # Check output of $$date
289
+ msg, src, exp = <<~STUFF.split("\n")
290
+ Check output of $$date
291
+ Today is $$date, I guess
292
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
293
+ STUFF
294
+ invoke_test(msg, src, exp)
295
+ end
296
+
297
+ def test_tokenizer_formatting_11 # Check output of $$date
298
+ msg, src, exp = <<~STUFF.split("\n")
299
+ Check output of $$date
300
+ Today is $$date, I guess
301
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
302
+ STUFF
303
+ invoke_test(msg, src, exp)
304
+ end
305
+
306
+ def test_tokenizer_formatting_12 # Check output of $$date
307
+ msg, src, exp = <<~STUFF.split("\n")
308
+ Check output of $$date
309
+ Today is $$date, I guess
310
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
311
+ STUFF
312
+ invoke_test(msg, src, exp)
313
+ end
314
+
315
+ def test_tokenizer_formatting_13 # Check output of $$date
316
+ msg, src, exp = <<~STUFF.split("\n")
317
+ Check output of $$date
318
+ Today is $$date, I guess
319
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
320
+ STUFF
321
+ invoke_test(msg, src, exp)
322
+ end
323
+
324
+ def test_tokenizer_formatting_14 # Check output of $$date
325
+ msg, src, exp = <<~STUFF.split("\n")
326
+ Check output of $$date
327
+ Today is $$date, I guess
328
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
329
+ STUFF
330
+ invoke_test(msg, src, exp)
331
+ end
332
+
333
+ def test_tokenizer_formatting_15 # Check output of $$date
334
+ msg, src, exp = <<~STUFF.split("\n")
335
+ Check output of $$date
336
+ Today is $$date, I guess
337
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
338
+ STUFF
339
+ invoke_test(msg, src, exp)
340
+ end
341
+
342
+ def test_tokenizer_formatting_16 # Check output of $$date
343
+ msg, src, exp = <<~STUFF.split("\n")
344
+ Check output of $$date
345
+ Today is $$date, I guess
346
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
347
+ STUFF
348
+ invoke_test(msg, src, exp)
349
+ end
350
+
351
+ def test_tokenizer_formatting_17 # Check output of $$date
352
+ msg, src, exp = <<~STUFF.split("\n")
353
+ Check output of $$date
354
+ Today is $$date, I guess
355
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
356
+ STUFF
357
+ invoke_test(msg, src, exp)
358
+ end
359
+
360
+ def test_tokenizer_formatting_18 # Check output of $$date
361
+ msg, src, exp = <<~STUFF.split("\n")
362
+ Check output of $$date
363
+ Today is $$date, I guess
364
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
365
+ STUFF
366
+ invoke_test(msg, src, exp)
367
+ end
368
+
369
+ def test_tokenizer_formatting_19 # Check output of $$date
370
+ msg, src, exp = <<~STUFF.split("\n")
371
+ Check output of $$date
372
+ Today is $$date, I guess
373
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
374
+ STUFF
375
+ invoke_test(msg, src, exp)
376
+ end
377
+
378
+ def test_tokenizer_formatting_20 # Check output of $$date
379
+ $testme = true
380
+ msg, src, exp = <<~STUFF.split("\n")
381
+ Check output of $$date
382
+ Today is $$date, I guess
383
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
384
+ STUFF
385
+ invoke_test(msg, src, exp)
386
+ $testme = false
387
+ end
388
+
389
+ def test_tokenizer_formatting_21 # Check output of $$date
390
+ msg, src, exp = <<~STUFF.split("\n")
391
+ Check output of $$date
392
+ Today is $$date, I guess
393
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
394
+ STUFF
395
+ invoke_test(msg, src, exp)
396
+ end
397
+
398
+ def test_tokenizer_formatting_22 # Check output of $$date
399
+ msg, src, exp = <<~STUFF.split("\n")
400
+ Check output of $$date
401
+ Today is $$date, I guess
402
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
403
+ STUFF
404
+ invoke_test(msg, src, exp)
405
+ end
406
+
407
+ def test_tokenizer_formatting_23 # Check output of $$date
408
+ msg, src, exp = <<~STUFF.split("\n")
409
+ Check output of $$date
410
+ Today is $$date, I guess
411
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
412
+ STUFF
413
+ invoke_test(msg, src, exp)
414
+ end
415
+
416
+ def test_tokenizer_formatting_24 # Check output of $$date
417
+ msg, src, exp = <<~STUFF.split("\n")
418
+ Check output of $$date
419
+ Today is $$date, I guess
420
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
421
+ STUFF
422
+ invoke_test(msg, src, exp)
423
+ end
424
+
425
+ def test_tokenizer_formatting_25 # Check output of $$date
426
+ msg, src, exp = <<~STUFF.split("\n")
427
+ Check output of $$date
428
+ Today is $$date, I guess
429
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
430
+ STUFF
431
+ invoke_test(msg, src, exp)
432
+ end
433
+
434
+ def test_tokenizer_formatting_26 # Check output of $$date
435
+ msg, src, exp = <<~STUFF.split("\n")
436
+ Check output of $$date
437
+ Today is $$date, I guess
438
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
439
+ STUFF
440
+ invoke_test(msg, src, exp)
441
+ end
442
+
443
+ def test_tokenizer_formatting_27 # Check output of $$date
444
+ msg, src, exp = <<~STUFF.split("\n")
445
+ Check output of $$date
446
+ Today is $$date, I guess
447
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
448
+ STUFF
449
+ invoke_test(msg, src, exp)
450
+ end
451
+
452
+ def test_tokenizer_formatting_28 # Check output of $$date
453
+ msg, src, exp = <<~STUFF.split("\n")
454
+ Check output of $$date
455
+ Today is $$date, I guess
456
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
457
+ STUFF
458
+ invoke_test(msg, src, exp)
459
+ end
460
+
461
+ def test_tokenizer_formatting_29 # Check output of $$date
462
+ msg, src, exp = <<~STUFF.split("\n")
463
+ Check output of $$date
464
+ Today is $$date, I guess
465
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
466
+ STUFF
467
+ invoke_test(msg, src, exp)
468
+ end
469
+
470
+ def test_tokenizer_formatting_30 # Check output of $$date
471
+ msg, src, exp = <<~STUFF.split("\n")
472
+ Check output of $$date
473
+ Today is $$date, I guess
474
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
475
+ STUFF
476
+ invoke_test(msg, src, exp)
477
+ end
478
+
479
+ def test_tokenizer_formatting_31 # Check output of $$date
480
+ msg, src, exp = <<~STUFF.split("\n")
481
+ Check output of $$date
482
+ Today is $$date, I guess
483
+ /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
484
+ STUFF
485
+ invoke_test(msg, src, exp)
486
+ end
487
+
488
+ def test_tokenizer_formatting_32 # Check "real" dollar signs
489
+ msg, src, exp = <<~STUFF.split("\n")
490
+ Check "real" dollar signs
491
+ You paid $75 for that item.
492
+ You paid $75 for that item.
493
+ STUFF
494
+ invoke_test(msg, src, exp)
495
+ end
496
+
497
+ def test_tokenizer_formatting_33 # Check dollar-space
498
+ msg, src, exp = <<~STUFF.split("\n")
499
+ Check dollar-space
500
+ He paid $ 76 for it...
501
+ He paid $ 76 for it...
502
+ STUFF
503
+ invoke_test(msg, src, exp)
504
+ end
505
+
506
+ def test_tokenizer_formatting_34 # Check escaped dollar signs
507
+ msg, src, exp = <<~STUFF.split("\n")
508
+ Check escaped dollar signs
509
+ Paid \\$78 yo
510
+ Paid $78 yo
511
+ STUFF
512
+ invoke_test(msg, src, exp)
513
+ end
514
+
515
+ def test_tokenizer_formatting_35 # Check ignored function param (bug or feature?)
516
+ msg, src, exp = <<~STUFF.split("\n")
517
+ Check ignored function param (bug or feature?)
518
+ Today is $$date:foobar, apparently.
519
+ /Today is \\d\\d\\d\\d.\\d\\d.\\d\\d apparently./
520
+ STUFF
521
+ invoke_test(msg, src, exp)
522
+ end
523
+
524
+ def test_tokenizer_formatting_36 # Check ignored function bracket param (bug or feature?)
525
+ msg, src, exp = <<~STUFF.split("\n")
526
+ Check ignored function bracket param (bug or feature?)
527
+ Today is $$date[a useless parameter], apparently.
528
+ /Today is \\d\\\d\\d\\d.\\d\\d.\\d\\d, apparently./
529
+ STUFF
530
+ invoke_test(msg, src, exp)
531
+ end
532
+
533
+ end
534
+