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
@@ -6,6 +6,18 @@ class TestingLivetext < MiniTest::Test
6
6
 
7
7
  FormatLine = Livetext::FormatLine
8
8
 
9
+ def invoke_test(msg, src, exp)
10
+ actual = FormatLine.parse!(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
+
9
21
  # Some (most) methods were generated via the code
10
22
  # seen in the comment at the bottom of this file...
11
23
 
@@ -56,7 +68,7 @@ class TestingLivetext < MiniTest::Test
56
68
  # assert_match regex_expected, result, "Found unexpected: #{result.inspect}"
57
69
  # end
58
70
 
59
- def test_func_2
71
+ def xtest_func_2
60
72
  str = "Today is $$date"
61
73
  parse = FormatLine.new(str)
62
74
  tokens_expected = [[:str, "Today is "], [:func, "date"]]
@@ -67,7 +79,7 @@ class TestingLivetext < MiniTest::Test
67
79
  assert_match regex_expected, result, "Found unexpected: #{result.inspect}"
68
80
  end
69
81
 
70
- def test_var_before_comma
82
+ def xtest_var_before_comma
71
83
  str = "User name is $User, and all is well"
72
84
  parse = FormatLine.new(str)
73
85
  tokens_expected = [[:str, "User name is "], [:var, "User"], [:str, ", and all is well"]]
@@ -78,7 +90,7 @@ class TestingLivetext < MiniTest::Test
78
90
  assert_match regex_expected, result, "Found unexpected: #{result.inspect}"
79
91
  end
80
92
 
81
- def test_var_at_EOS
93
+ def xtest_var_at_EOS
82
94
  str = "File name is $File"
83
95
  parse = FormatLine.new(str)
84
96
  tokens_expected = [[:str, "File name is "], [:var, "File"]]
@@ -89,7 +101,7 @@ class TestingLivetext < MiniTest::Test
89
101
  assert_equal string_expected, result, "Found unexpected: #{result.inspect}"
90
102
  end
91
103
 
92
- def test_var_starts_string
104
+ def xtest_var_starts_string
93
105
  str = "$File is my file name"
94
106
  parse = FormatLine.new(str)
95
107
  tokens_expected = [[:var, "File"], [:str, " is my file name"]]
@@ -103,7 +115,7 @@ class TestingLivetext < MiniTest::Test
103
115
  # Next one is/will be a problem...
104
116
  # I permit periods *inside* variable names
105
117
 
106
- def test_var_before_period
118
+ def xtest_var_before_period
107
119
  str = "This is $File\\." # FIXME escaped for now...
108
120
  parse = FormatLine.new(str)
109
121
  tokens_expected = [[:str, "This is "], [:var, "File"], [:str, "."]]
@@ -114,7 +126,7 @@ class TestingLivetext < MiniTest::Test
114
126
  assert_equal string_expected, result, "Found unexpected: #{result.inspect}"
115
127
  end
116
128
 
117
- def test_func_needing_parameter_colon_eos # colon, param, EOS
129
+ def xtest_func_needing_parameter_colon_eos # colon, param, EOS
118
130
  str = "Square root of 225 is $$isqrt:225"
119
131
  parse = FormatLine.new(str)
120
132
  tokens_expected = [[:str, "Square root of 225 is "], [:func, "isqrt"], [:colon, "225"]]
@@ -125,7 +137,7 @@ class TestingLivetext < MiniTest::Test
125
137
  assert_equal string_expected, result, "Found unexpected: #{result.inspect}"
126
138
  end
127
139
 
128
- def test_func_needing_parameter_colon # colon, param, more chars
140
+ def xtest_func_needing_parameter_colon # colon, param, more chars
129
141
  str = "Answer is $$isqrt:225 today"
130
142
  parse = FormatLine.new(str)
131
143
  tokens_expected = [[:str, "Answer is "],
@@ -141,7 +153,7 @@ class TestingLivetext < MiniTest::Test
141
153
 
142
154
  # isqrt: Not real tests??
143
155
 
144
- def test_isqrt_empty_colon_param
156
+ def xtest_isqrt_empty_colon_param
145
157
  str = "Calculate $$isqrt:"
146
158
  parse = FormatLine.new(str)
147
159
  tokens_expected = [[:str, "Calculate "],
@@ -156,7 +168,7 @@ class TestingLivetext < MiniTest::Test
156
168
  assert_equal string_expected, result, "Found unexpected: #{result.inspect}"
157
169
  end
158
170
 
159
- def test_isqrt_empty_bracket_param
171
+ def xtest_isqrt_empty_bracket_param
160
172
  str = "Calculate $$isqrt[]"
161
173
  parse = FormatLine.new(str)
162
174
  tokens_expected = [[:str, "Calculate "],
@@ -171,7 +183,7 @@ class TestingLivetext < MiniTest::Test
171
183
  assert_equal string_expected, result, "Found unexpected: #{result.inspect}"
172
184
  end
173
185
 
174
- def test_isqrt_malformed_number
186
+ def xtest_isqrt_malformed_number
175
187
  str = "Calculate $$isqrt[3a5]"
176
188
  parse = FormatLine.new(str)
177
189
  tokens_expected = [[:str, "Calculate "],
@@ -188,7 +200,7 @@ class TestingLivetext < MiniTest::Test
188
200
 
189
201
  # ...end of this group
190
202
 
191
- def test_func_with_colon
203
+ def xtest_func_with_colon
192
204
  parse = FormatLine.new("Calling $$myfunc:foo here.")
193
205
  tokens = parse.tokenize
194
206
  assert_equal tokens, [[:str, "Calling "],
@@ -201,7 +213,7 @@ class TestingLivetext < MiniTest::Test
201
213
  assert_equal expected, result
202
214
  end
203
215
 
204
- def test_func_with_brackets
216
+ def xtest_func_with_brackets
205
217
  parse = FormatLine.new("Calling $$myfunc2[foo bar] here.")
206
218
  tokens = parse.tokenize
207
219
  assert_kind_of Array, tokens
@@ -216,92 +228,67 @@ class TestingLivetext < MiniTest::Test
216
228
  assert_equal expected, result
217
229
  end
218
230
 
219
- def test_formatting_01 # Check output of $$date
231
+ def xtest_parse_formatting
232
+ msg, src, exp = <<~STUFF.split("\n")
233
+ Check simple formatting
234
+ This is *bold and _italics ...
235
+ This is <b>bold</b> and <i>italics</i> ...
236
+ STUFF
237
+ invoke_test(msg, src, exp)
238
+ end
239
+
240
+ def xtest_formatting_01 # Check output of $$date
220
241
  msg, src, exp = <<~STUFF.split("\n")
221
242
  Check output of $$date
222
243
  Today is $$date, I guess
223
244
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
224
245
  STUFF
225
-
226
- actual = FormatLine.parse!(src)
227
- if exp[0] == "/"
228
- exp = Regexp.compile(exp[1..-2]) # skip slashes
229
- assert_match(exp, actual, msg)
230
- else
231
- assert_equal(exp, actual, msg)
232
- end
246
+ invoke_test(msg, src, exp)
233
247
  end
234
248
 
235
- def test_formatting_02 # Check output of $$date
249
+ def xtest_formatting_02 # Check output of $$date
236
250
  msg, src, exp = <<~STUFF.split("\n")
237
251
  Check output of $$date
238
252
  Today is $$date, I guess
239
253
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
240
254
  STUFF
241
-
242
- actual = FormatLine.parse!(src)
243
- if exp[0] == "/"
244
- exp = Regexp.compile(exp[1..-2]) # skip slashes
245
- assert_match(exp, actual, msg)
246
- else
247
- assert_equal(exp, actual, msg)
248
- end
255
+ invoke_test(msg, src, exp)
249
256
  end
250
257
 
251
- def test_formatting_03 # Check output of $$date
258
+ def xtest_formatting_03 # Check output of $$date
252
259
  msg, src, exp = <<~STUFF.split("\n")
253
260
  Check output of $$date
254
261
  Today is $$date, I guess
255
262
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
256
263
  STUFF
257
-
258
- actual = FormatLine.parse!(src)
259
- if exp[0] == "/"
260
- exp = Regexp.compile(exp[1..-2]) # skip slashes
261
- assert_match(exp, actual, msg)
262
- else
263
- assert_equal(exp, actual, msg)
264
- end
264
+ invoke_test(msg, src, exp)
265
265
  end
266
266
 
267
- def test_formatting_04 # Check output of $$date
267
+ def xtest_formatting_04 # Check output of $$date
268
268
  msg, src, exp = <<~STUFF.split("\n")
269
269
  Check output of $$date
270
270
  Today is $$date, I guess
271
271
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
272
272
  STUFF
273
-
274
- actual = FormatLine.parse!(src)
275
- if exp[0] == "/"
276
- exp = Regexp.compile(exp[1..-2]) # skip slashes
277
- assert_match(exp, actual, msg)
278
- else
279
- assert_equal(exp, actual, msg)
280
- end
273
+ invoke_test(msg, src, exp)
281
274
  end
282
275
 
283
- def test_formatting_05 # Check output of $$date
276
+ def xtest_formatting_05 # Check output of $$date
284
277
  msg, src, exp = <<~STUFF.split("\n")
285
278
  Check output of $$date
286
279
  Today is $$date, I guess
287
280
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
288
281
  STUFF
289
-
290
- actual = FormatLine.parse!(src)
291
- if exp[0] == "/"
292
- exp = Regexp.compile(exp[1..-2]) # skip slashes
293
- assert_match(exp, actual, msg)
294
- else
295
- assert_equal(exp, actual, msg)
296
- end
282
+ invoke_test(msg, src, exp)
297
283
  end
298
284
 
299
- def test_formatting_06 # Check output of $$date
285
+ def xtest_formatting_06 # Check output of $$date
300
286
  msg, src, exp = <<~STUFF.split("\n")
301
287
  Check output of $$date
302
288
  Today is $$date, I guess
303
289
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
304
290
  STUFF
291
+ invoke_test(msg, src, exp)
305
292
 
306
293
  actual = FormatLine.parse!(src)
307
294
  if exp[0] == "/"
@@ -312,12 +299,13 @@ class TestingLivetext < MiniTest::Test
312
299
  end
313
300
  end
314
301
 
315
- def test_formatting_07 # Check output of $$date
302
+ def xtest_formatting_07 # Check output of $$date
316
303
  msg, src, exp = <<~STUFF.split("\n")
317
304
  Check output of $$date
318
305
  Today is $$date, I guess
319
306
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
320
307
  STUFF
308
+ invoke_test(msg, src, exp)
321
309
 
322
310
  actual = FormatLine.parse!(src)
323
311
  if exp[0] == "/"
@@ -328,388 +316,269 @@ class TestingLivetext < MiniTest::Test
328
316
  end
329
317
  end
330
318
 
331
- def test_formatting_08 # Check output of $$date
319
+ def xtest_formatting_08 # Check output of $$date
332
320
  msg, src, exp = <<~STUFF.split("\n")
333
321
  Check output of $$date
334
322
  Today is $$date, I guess
335
323
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
336
324
  STUFF
337
-
338
- actual = FormatLine.parse!(src)
339
- if exp[0] == "/"
340
- exp = Regexp.compile(exp[1..-2]) # skip slashes
341
- assert_match(exp, actual, msg)
342
- else
343
- assert_equal(exp, actual, msg)
344
- end
325
+ invoke_test(msg, src, exp)
345
326
  end
346
327
 
347
- def test_formatting_09 # Check output of $$date
328
+ def xtest_formatting_09 # Check output of $$date
348
329
  msg, src, exp = <<~STUFF.split("\n")
349
330
  Check output of $$date
350
331
  Today is $$date, I guess
351
332
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
352
333
  STUFF
353
-
354
- actual = FormatLine.parse!(src)
355
- if exp[0] == "/"
356
- exp = Regexp.compile(exp[1..-2]) # skip slashes
357
- assert_match(exp, actual, msg)
358
- else
359
- assert_equal(exp, actual, msg)
360
- end
334
+ invoke_test(msg, src, exp)
361
335
  end
362
336
 
363
- def test_formatting_10 # Check output of $$date
337
+ def xtest_formatting_10 # Check output of $$date
364
338
  msg, src, exp = <<~STUFF.split("\n")
365
339
  Check output of $$date
366
340
  Today is $$date, I guess
367
341
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
368
342
  STUFF
369
-
370
- actual = FormatLine.parse!(src)
371
- if exp[0] == "/"
372
- exp = Regexp.compile(exp[1..-2]) # skip slashes
373
- assert_match(exp, actual, msg)
374
- else
375
- assert_equal(exp, actual, msg)
376
- end
343
+ invoke_test(msg, src, exp)
377
344
  end
378
345
 
379
- def test_formatting_11 # Check output of $$date
346
+ def xtest_formatting_11 # Check output of $$date
380
347
  msg, src, exp = <<~STUFF.split("\n")
381
348
  Check output of $$date
382
349
  Today is $$date, I guess
383
350
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
384
351
  STUFF
385
-
386
- actual = FormatLine.parse!(src)
387
- if exp[0] == "/"
388
- exp = Regexp.compile(exp[1..-2]) # skip slashes
389
- assert_match(exp, actual, msg)
390
- else
391
- assert_equal(exp, actual, msg)
392
- end
352
+ invoke_test(msg, src, exp)
393
353
  end
394
354
 
395
- def test_formatting_12 # Check output of $$date
355
+ def xtest_formatting_12 # Check output of $$date
396
356
  msg, src, exp = <<~STUFF.split("\n")
397
357
  Check output of $$date
398
358
  Today is $$date, I guess
399
359
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
400
360
  STUFF
401
-
402
- actual = FormatLine.parse!(src)
403
- if exp[0] == "/"
404
- exp = Regexp.compile(exp[1..-2]) # skip slashes
405
- assert_match(exp, actual, msg)
406
- else
407
- assert_equal(exp, actual, msg)
408
- end
361
+ invoke_test(msg, src, exp)
409
362
  end
410
363
 
411
- def test_formatting_13 # Check output of $$date
364
+ def xtest_formatting_13 # Check output of $$date
412
365
  msg, src, exp = <<~STUFF.split("\n")
413
366
  Check output of $$date
414
367
  Today is $$date, I guess
415
368
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
416
369
  STUFF
417
-
418
- actual = FormatLine.parse!(src)
419
- if exp[0] == "/"
420
- exp = Regexp.compile(exp[1..-2]) # skip slashes
421
- assert_match(exp, actual, msg)
422
- else
423
- assert_equal(exp, actual, msg)
424
- end
370
+ invoke_test(msg, src, exp)
425
371
  end
426
372
 
427
- def test_formatting_14 # Check output of $$date
373
+ def xtest_formatting_14 # Check output of $$date
428
374
  msg, src, exp = <<~STUFF.split("\n")
429
375
  Check output of $$date
430
376
  Today is $$date, I guess
431
377
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
432
378
  STUFF
433
-
434
- actual = FormatLine.parse!(src)
435
- if exp[0] == "/"
436
- exp = Regexp.compile(exp[1..-2]) # skip slashes
437
- assert_match(exp, actual, msg)
438
- else
439
- assert_equal(exp, actual, msg)
440
- end
379
+ invoke_test(msg, src, exp)
441
380
  end
442
381
 
443
- def test_formatting_15 # Check output of $$date
382
+ def xtest_formatting_15 # Check output of $$date
444
383
  msg, src, exp = <<~STUFF.split("\n")
445
384
  Check output of $$date
446
385
  Today is $$date, I guess
447
386
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
448
387
  STUFF
449
-
450
- actual = FormatLine.parse!(src)
451
- if exp[0] == "/"
452
- exp = Regexp.compile(exp[1..-2]) # skip slashes
453
- assert_match(exp, actual, msg)
454
- else
455
- assert_equal(exp, actual, msg)
456
- end
388
+ invoke_test(msg, src, exp)
457
389
  end
458
390
 
459
- def test_formatting_16 # Check output of $$date
391
+ def xtest_formatting_16 # Check output of $$date
460
392
  msg, src, exp = <<~STUFF.split("\n")
461
393
  Check output of $$date
462
394
  Today is $$date, I guess
463
395
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
464
396
  STUFF
465
-
466
- actual = FormatLine.parse!(src)
467
- if exp[0] == "/"
468
- exp = Regexp.compile(exp[1..-2]) # skip slashes
469
- assert_match(exp, actual, msg)
470
- else
471
- assert_equal(exp, actual, msg)
472
- end
397
+ invoke_test(msg, src, exp)
473
398
  end
474
399
 
475
- def test_formatting_17 # Check output of $$date
400
+ def xtest_formatting_17 # Check output of $$date
476
401
  msg, src, exp = <<~STUFF.split("\n")
477
402
  Check output of $$date
478
403
  Today is $$date, I guess
479
404
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
480
405
  STUFF
481
-
482
- actual = FormatLine.parse!(src)
483
- if exp[0] == "/"
484
- exp = Regexp.compile(exp[1..-2]) # skip slashes
485
- assert_match(exp, actual, msg)
486
- else
487
- assert_equal(exp, actual, msg)
488
- end
406
+ invoke_test(msg, src, exp)
489
407
  end
490
408
 
491
- def test_formatting_18 # Check output of $$date
409
+ def xtest_formatting_18 # Check output of $$date
492
410
  msg, src, exp = <<~STUFF.split("\n")
493
411
  Check output of $$date
494
412
  Today is $$date, I guess
495
413
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
496
414
  STUFF
497
-
498
- actual = FormatLine.parse!(src)
499
- if exp[0] == "/"
500
- exp = Regexp.compile(exp[1..-2]) # skip slashes
501
- assert_match(exp, actual, msg)
502
- else
503
- assert_equal(exp, actual, msg)
504
- end
415
+ invoke_test(msg, src, exp)
505
416
  end
506
417
 
507
- def test_formatting_19 # Check output of $$date
418
+ def xtest_formatting_19 # Check output of $$date
508
419
  msg, src, exp = <<~STUFF.split("\n")
509
420
  Check output of $$date
510
421
  Today is $$date, I guess
511
422
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
512
423
  STUFF
513
-
514
- actual = FormatLine.parse!(src)
515
- if exp[0] == "/"
516
- exp = Regexp.compile(exp[1..-2]) # skip slashes
517
- assert_match(exp, actual, msg)
518
- else
519
- assert_equal(exp, actual, msg)
520
- end
424
+ invoke_test(msg, src, exp)
521
425
  end
522
426
 
523
- def test_formatting_20 # Check output of $$date
427
+ def xtest_formatting_20 # Check output of $$date
524
428
  msg, src, exp = <<~STUFF.split("\n")
525
429
  Check output of $$date
526
430
  Today is $$date, I guess
527
431
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
528
432
  STUFF
529
-
530
- actual = FormatLine.parse!(src)
531
- if exp[0] == "/"
532
- exp = Regexp.compile(exp[1..-2]) # skip slashes
533
- assert_match(exp, actual, msg)
534
- else
535
- assert_equal(exp, actual, msg)
536
- end
433
+ invoke_test(msg, src, exp)
537
434
  end
538
435
 
539
- def test_formatting_21 # Check output of $$date
436
+ def xtest_formatting_21 # Check output of $$date
540
437
  msg, src, exp = <<~STUFF.split("\n")
541
438
  Check output of $$date
542
439
  Today is $$date, I guess
543
440
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
544
441
  STUFF
545
-
546
- actual = FormatLine.parse!(src)
547
- if exp[0] == "/"
548
- exp = Regexp.compile(exp[1..-2]) # skip slashes
549
- assert_match(exp, actual, msg)
550
- else
551
- assert_equal(exp, actual, msg)
552
- end
442
+ invoke_test(msg, src, exp)
553
443
  end
554
444
 
555
- def test_formatting_22 # Check output of $$date
445
+ def xtest_formatting_22 # Check output of $$date
556
446
  msg, src, exp = <<~STUFF.split("\n")
557
447
  Check output of $$date
558
448
  Today is $$date, I guess
559
449
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
560
450
  STUFF
561
-
562
- actual = FormatLine.parse!(src)
563
- if exp[0] == "/"
564
- exp = Regexp.compile(exp[1..-2]) # skip slashes
565
- assert_match(exp, actual, msg)
566
- else
567
- assert_equal(exp, actual, msg)
568
- end
451
+ invoke_test(msg, src, exp)
569
452
  end
570
453
 
571
- def test_formatting_23 # Check output of $$date
454
+ def xtest_formatting_23 # Check output of $$date
572
455
  msg, src, exp = <<~STUFF.split("\n")
573
456
  Check output of $$date
574
457
  Today is $$date, I guess
575
458
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
576
459
  STUFF
577
-
578
- actual = FormatLine.parse!(src)
579
- if exp[0] == "/"
580
- exp = Regexp.compile(exp[1..-2]) # skip slashes
581
- assert_match(exp, actual, msg)
582
- else
583
- assert_equal(exp, actual, msg)
584
- end
460
+ invoke_test(msg, src, exp)
585
461
  end
586
462
 
587
- def test_formatting_24 # Check output of $$date
463
+ def xtest_formatting_24 # Check output of $$date
588
464
  msg, src, exp = <<~STUFF.split("\n")
589
465
  Check output of $$date
590
466
  Today is $$date, I guess
591
467
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
592
468
  STUFF
593
-
594
- actual = FormatLine.parse!(src)
595
- if exp[0] == "/"
596
- exp = Regexp.compile(exp[1..-2]) # skip slashes
597
- assert_match(exp, actual, msg)
598
- else
599
- assert_equal(exp, actual, msg)
600
- end
469
+ invoke_test(msg, src, exp)
601
470
  end
602
471
 
603
- def test_formatting_25 # Check output of $$date
472
+ def xtest_formatting_25 # Check output of $$date
604
473
  msg, src, exp = <<~STUFF.split("\n")
605
474
  Check output of $$date
606
475
  Today is $$date, I guess
607
476
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
608
477
  STUFF
609
-
610
- actual = FormatLine.parse!(src)
611
- if exp[0] == "/"
612
- exp = Regexp.compile(exp[1..-2]) # skip slashes
613
- assert_match(exp, actual, msg)
614
- else
615
- assert_equal(exp, actual, msg)
616
- end
478
+ invoke_test(msg, src, exp)
617
479
  end
618
480
 
619
- def test_formatting_26 # Check output of $$date
481
+ def xtest_formatting_26 # Check output of $$date
620
482
  msg, src, exp = <<~STUFF.split("\n")
621
483
  Check output of $$date
622
484
  Today is $$date, I guess
623
485
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
624
486
  STUFF
625
-
626
- actual = FormatLine.parse!(src)
627
- if exp[0] == "/"
628
- exp = Regexp.compile(exp[1..-2]) # skip slashes
629
- assert_match(exp, actual, msg)
630
- else
631
- assert_equal(exp, actual, msg)
632
- end
487
+ invoke_test(msg, src, exp)
633
488
  end
634
489
 
635
- def test_formatting_27 # Check output of $$date
490
+ def xtest_formatting_27 # Check output of $$date
636
491
  msg, src, exp = <<~STUFF.split("\n")
637
492
  Check output of $$date
638
493
  Today is $$date, I guess
639
494
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
640
495
  STUFF
641
-
642
- actual = FormatLine.parse!(src)
643
- if exp[0] == "/"
644
- exp = Regexp.compile(exp[1..-2]) # skip slashes
645
- assert_match(exp, actual, msg)
646
- else
647
- assert_equal(exp, actual, msg)
648
- end
496
+ invoke_test(msg, src, exp)
649
497
  end
650
498
 
651
- def test_formatting_28 # Check output of $$date
499
+ def xtest_formatting_28 # Check output of $$date
652
500
  msg, src, exp = <<~STUFF.split("\n")
653
501
  Check output of $$date
654
502
  Today is $$date, I guess
655
503
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
656
504
  STUFF
657
-
658
- actual = FormatLine.parse!(src)
659
- if exp[0] == "/"
660
- exp = Regexp.compile(exp[1..-2]) # skip slashes
661
- assert_match(exp, actual, msg)
662
- else
663
- assert_equal(exp, actual, msg)
664
- end
505
+ invoke_test(msg, src, exp)
665
506
  end
666
507
 
667
- def test_formatting_29 # Check output of $$date
508
+ def xtest_formatting_29 # Check output of $$date
668
509
  msg, src, exp = <<~STUFF.split("\n")
669
510
  Check output of $$date
670
511
  Today is $$date, I guess
671
512
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
672
513
  STUFF
673
-
674
- actual = FormatLine.parse!(src)
675
- if exp[0] == "/"
676
- exp = Regexp.compile(exp[1..-2]) # skip slashes
677
- assert_match(exp, actual, msg)
678
- else
679
- assert_equal(exp, actual, msg)
680
- end
514
+ invoke_test(msg, src, exp)
681
515
  end
682
516
 
683
- def test_formatting_30 # Check output of $$date
517
+ def xtest_formatting_30 # Check output of $$date
684
518
  msg, src, exp = <<~STUFF.split("\n")
685
519
  Check output of $$date
686
520
  Today is $$date, I guess
687
521
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
688
522
  STUFF
689
-
690
- actual = FormatLine.parse!(src)
691
- if exp[0] == "/"
692
- exp = Regexp.compile(exp[1..-2]) # skip slashes
693
- assert_match(exp, actual, msg)
694
- else
695
- assert_equal(exp, actual, msg)
696
- end
523
+ invoke_test(msg, src, exp)
697
524
  end
698
525
 
699
- def test_formatting_31 # Check output of $$date
526
+ def xtest_formatting_31 # Check output of $$date
700
527
  msg, src, exp = <<~STUFF.split("\n")
701
528
  Check output of $$date
702
529
  Today is $$date, I guess
703
530
  /Today is \\d\\d\\d\\d-\\d\\d-\\d\\d, I guess/
704
531
  STUFF
532
+ invoke_test(msg, src, exp)
533
+ end
705
534
 
706
- actual = FormatLine.parse!(src)
707
- if exp[0] == "/"
708
- exp = Regexp.compile(exp[1..-2]) # skip slashes
709
- assert_match(exp, actual, msg)
710
- else
711
- assert_equal(exp, actual, msg)
712
- end
535
+ def xtest_formatting_32 # Check "real" dollar signs
536
+ msg, src, exp = <<~STUFF.split("\n")
537
+ Check "real" dollar signs
538
+ You paid $75 for that item.
539
+ You paid $75 for that item.
540
+ STUFF
541
+ invoke_test(msg, src, exp)
542
+ end
543
+
544
+ def xtest_formatting_33 # Check dollar-space
545
+ msg, src, exp = <<~STUFF.split("\n")
546
+ Check dollar-space
547
+ He paid $ 76 for it...
548
+ He paid $ 76 for it...
549
+ STUFF
550
+ invoke_test(msg, src, exp)
551
+ end
552
+
553
+ def test_formatting_34 # Check escaped dollar signs
554
+ $testme = true
555
+ msg, src, exp = <<~STUFF.split("\n")
556
+ Check escaped dollar signs
557
+ I paid \\$78 for it, though.
558
+ I paid $78 for it, though.
559
+ STUFF
560
+ invoke_test(msg, src, exp)
561
+ $testme = false
562
+ end
563
+
564
+ def xtest_formatting_35 # Check ignored function param (bug or feature?)
565
+ $testme = true
566
+ msg, src, exp = <<~STUFF.split("\n")
567
+ Check ignored function param (bug or feature?)
568
+ Today is $$date:foobar, apparently.
569
+ /Today is \\d\\d\\d\\d.\\d\\d.\\d\\d apparently./
570
+ STUFF
571
+ invoke_test(msg, src, exp)
572
+ $testme = false
573
+ end
574
+
575
+ def xtest_formatting_36 # Check ignored function bracket param (bug or feature?)
576
+ msg, src, exp = <<~STUFF.split("\n")
577
+ Check ignored function bracket param (bug or feature?)
578
+ Today is $$date[a useless parameter], apparently.
579
+ /Today is \\d\\\d\\d\\d.\\d\\d.\\d\\d, apparently./
580
+ STUFF
581
+ invoke_test(msg, src, exp)
713
582
  end
714
583
 
715
584
  end