comment_strip-ruby 0.1.2.1 → 0.2.1

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.
@@ -1,5 +1,12 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
+ # NOTE: TAB characters in this test file are intentional and occur only
4
+ # inside HEREDOC fixtures containing imported C/C++ source. They preserve
5
+ # the fixtures' original whitespace so comment stripping can be tested
6
+ # accurately. All Ruby test code and all non-fixture lines must use spaces,
7
+ # with two-space indentation; do not add TABs elsewhere.
8
+
9
+
3
10
  $:.unshift File.join(__dir__, '../..', 'lib')
4
11
 
5
12
 
@@ -9,63 +16,63 @@ require 'xqsr3/extensions/test/unit'
9
16
 
10
17
  require 'test/unit'
11
18
 
12
- class Test_strip_1 < Test::Unit::TestCase
19
+ class Test_C_strip_1 < Test::Unit::TestCase
13
20
 
14
- include ::CommentStrip
21
+ include ::CommentStrip
15
22
 
16
- def test_nil
23
+ def test_nil
17
24
 
18
- assert_nil strip(nil, 'C')
25
+ assert_nil strip(nil, 'C')
19
26
 
20
- assert_nil ::CommentStrip.strip(nil, 'C')
21
- end
27
+ assert_nil ::CommentStrip.strip(nil, 'C')
28
+ end
22
29
 
23
- def test_unrecognised_families
30
+ def test_unrecognised_families
24
31
 
25
- unrecognised_families = %w{
32
+ unrecognised_families = %w{
26
33
 
27
- Python
28
- Perl
29
- Ruby
34
+ Python
35
+ Perl
36
+ Ruby
30
37
 
31
- Java
32
- Kotlin
33
- Scala
38
+ Java
39
+ Kotlin
40
+ Scala
34
41
 
35
- Rust
36
- }
42
+ Rust
43
+ }
37
44
 
38
- unrecognised_families.each do |family|
45
+ unrecognised_families.each do |family|
39
46
 
40
- assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { strip('', family) }
41
- assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { ::CommentStrip.strip('', family) }
42
- end
47
+ assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { strip('', family) }
48
+ assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { ::CommentStrip.strip('', family) }
43
49
  end
50
+ end
44
51
 
45
- def test_empty
52
+ def test_empty
46
53
 
47
- assert_equal "", strip('', 'C')
48
- assert_equal "", ::CommentStrip.strip('', :C)
49
- end
54
+ assert_equal "", strip('', 'C')
55
+ assert_equal "", ::CommentStrip.strip('', :C)
56
+ end
50
57
 
51
- def test_simple_main
58
+ def test_simple_main
52
59
 
53
- input = <<-EOF_main
60
+ input = <<-EOF_main
54
61
  #include <stdio.h>
55
62
  int main(int argc, char* argv[])
56
63
  {
57
64
  return 0;
58
65
  }
59
66
  EOF_main
60
- expected = input
67
+ expected = input
61
68
 
62
- assert_equal expected, strip(input, 'C')
63
- assert_equal expected, ::CommentStrip.strip(input, 'C')
64
- end
69
+ assert_equal expected, strip(input, 'C')
70
+ assert_equal expected, ::CommentStrip.strip(input, 'C')
71
+ end
65
72
 
66
- def test_x_1
73
+ def test_x_1
67
74
 
68
- input = <<-EOF_main
75
+ input = <<-EOF_main
69
76
  #ifdef CLARA_PLATFORM_WINDOWS
70
77
  case '/': from = i+1; return SlashOpt;
71
78
  #endif
@@ -78,7 +85,7 @@ EOF_main
78
85
  return !placeholder.empty();
79
86
  }
80
87
  EOF_main
81
- expected = <<-EOF_main
88
+ expected = <<-EOF_main
82
89
  #ifdef CLARA_PLATFORM_WINDOWS
83
90
  case '/': from = i+1; return SlashOpt;
84
91
  #endif
@@ -92,232 +99,232 @@ EOF_main
92
99
  }
93
100
  EOF_main
94
101
 
95
- actual = strip(input, 'C')
96
- actual = ::CommentStrip.strip(input, 'C')
102
+ actual = strip(input, 'C')
103
+ actual = ::CommentStrip.strip(input, 'C')
97
104
 
98
- assert_equal expected, actual
99
- end
105
+ assert_equal expected, actual
106
+ end
100
107
 
101
- def test_x_2
108
+ def test_x_2
102
109
 
103
- input = <<-EOF_main
110
+ input = <<-EOF_main
104
111
 
105
112
  } // namespace something
106
113
  EOF_main
107
- expected = <<-EOF_main
114
+ expected = <<-EOF_main
108
115
 
109
116
  }
110
117
  EOF_main
111
118
 
112
- actual = strip(input, 'C')
113
- actual = ::CommentStrip.strip(input, 'C')
119
+ actual = strip(input, 'C')
120
+ actual = ::CommentStrip.strip(input, 'C')
114
121
 
115
- assert_equal expected, actual
116
- end
122
+ assert_equal expected, actual
123
+ end
117
124
 
118
- def test_x_3
125
+ def test_x_3
119
126
 
120
- input = <<-EOF_main
127
+ input = <<-EOF_main
121
128
 
122
129
  #endif /* !LOG_PERROR */
123
130
  EOF_main
124
- expected = <<-EOF_main
131
+ expected = <<-EOF_main
125
132
 
126
133
  #endif
127
134
  EOF_main
128
135
 
129
- actual = strip(input, 'C')
130
- actual = ::CommentStrip.strip(input, 'C')
136
+ actual = strip(input, 'C')
137
+ actual = ::CommentStrip.strip(input, 'C')
131
138
 
132
- assert_equal expected, actual
133
- end
139
+ assert_equal expected, actual
140
+ end
134
141
 
135
- def test_code_with_single_quoted_characters_1
142
+ def test_code_with_single_quoted_characters_1
136
143
 
137
- input = <<-EOF_main
144
+ input = <<-EOF_main
138
145
 
139
146
  case '"': // " this is the comment "
140
147
  EOF_main
141
- expected = <<-EOF_main
148
+ expected = <<-EOF_main
142
149
 
143
150
  case '"':
144
151
  EOF_main
145
152
 
146
- actual = strip(input, 'C')
153
+ actual = strip(input, 'C')
147
154
 
148
- assert_equal expected, actual
149
- end
155
+ assert_equal expected, actual
156
+ end
150
157
 
151
- def test_code_with_single_quoted_characters_2
158
+ def test_code_with_single_quoted_characters_2
152
159
 
153
- input = <<-EOF_main
160
+ input = <<-EOF_main
154
161
 
155
- case '\\"': // " this is the comment "
162
+ case '\"': // " this is the comment "
156
163
  EOF_main
157
- expected = <<-EOF_main
164
+ expected = <<-EOF_main
158
165
 
159
- case '\\"':
166
+ case '\"':
160
167
  EOF_main
161
168
 
162
- actual = strip(input, 'C')
169
+ actual = strip(input, 'C')
163
170
 
164
- assert_equal expected, actual
165
- end
171
+ assert_equal expected, actual
172
+ end
166
173
 
167
- def test_code_with_single_quoted_characters_3
174
+ def test_code_with_single_quoted_characters_3
168
175
 
169
- input = <<-EOF_main
176
+ input = <<-EOF_main
170
177
 
171
- case '\\'': // " this is the comment "
178
+ case '\'': // " this is the comment "
172
179
  EOF_main
173
- expected = <<-EOF_main
180
+ expected = <<-EOF_main
174
181
 
175
- case '\\'':
182
+ case '\'':
176
183
  EOF_main
177
184
 
178
- actual = strip(input, 'C')
185
+ actual = strip(input, 'C')
179
186
 
180
- assert_equal expected, actual
181
- end
187
+ assert_equal expected, actual
188
+ end
182
189
 
183
- def test_code_with_single_quoted_characters_4
190
+ def test_code_with_single_quoted_characters_4
184
191
 
185
- input = <<-EOF_main
192
+ input = <<-EOF_main
186
193
 
187
194
  case '\\\\': // " this is the comment "
188
195
  EOF_main
189
- expected = <<-EOF_main
196
+ expected = <<-EOF_main
190
197
 
191
198
  case '\\\\':
192
199
  EOF_main
193
200
 
194
- actual = strip(input, 'C')
201
+ actual = strip(input, 'C')
195
202
 
196
- assert_equal expected, actual
197
- end
203
+ assert_equal expected, actual
204
+ end
198
205
 
199
- def test_code_with_single_quoted_characters_5
206
+ def test_code_with_single_quoted_characters_5
200
207
 
201
- input = <<-EOF_main
208
+ input = <<-EOF_main
202
209
 
203
210
  case '\\\\': // " this is the comment "
204
211
  EOF_main
205
- expected = <<-EOF_main
212
+ expected = <<-EOF_main
206
213
 
207
214
  case '\\\\':
208
215
  EOF_main
209
216
 
210
- actual = strip(input, 'C')
217
+ actual = strip(input, 'C')
211
218
 
212
- assert_equal expected, actual
213
- end
219
+ assert_equal expected, actual
220
+ end
214
221
 
215
- def test_code_with_single_quoted_characters_6
222
+ def test_code_with_single_quoted_characters_6
216
223
 
217
- input = <<-EOF_main
224
+ input = <<-EOF_main
218
225
 
219
226
  #define SOME_CHAR '\\x80' /* some char */
220
227
  EOF_main
221
- expected = <<-EOF_main
228
+ expected = <<-EOF_main
222
229
 
223
230
  #define SOME_CHAR '\\x80'
224
231
  EOF_main
225
232
 
226
- actual = strip(input, 'C')
233
+ actual = strip(input, 'C')
227
234
 
228
- assert_equal expected, actual
229
- end
235
+ assert_equal expected, actual
236
+ end
230
237
 
231
- def test_code_with_double_quoted_characters_1
238
+ def test_code_with_double_quoted_characters_1
232
239
 
233
- input = <<-EOF_main
240
+ input = <<-EOF_main
234
241
 
235
242
  case "'": // " this is the comment "
236
243
  EOF_main
237
- expected = <<-EOF_main
244
+ expected = <<-EOF_main
238
245
 
239
246
  case "'":
240
247
  EOF_main
241
248
 
242
- actual = strip(input, 'C')
249
+ actual = strip(input, 'C')
243
250
 
244
- assert_equal expected, actual
245
- end
251
+ assert_equal expected, actual
252
+ end
246
253
 
247
- def test_code_with_double_quoted_characters_2
254
+ def test_code_with_double_quoted_characters_2
248
255
 
249
- input = <<-EOF_main
256
+ input = <<-EOF_main
250
257
 
251
258
  case "\\"": // " this is the comment "
252
259
  EOF_main
253
- expected = <<-EOF_main
260
+ expected = <<-EOF_main
254
261
 
255
262
  case "\\"":
256
263
  EOF_main
257
264
 
258
- actual = strip(input, 'C')
265
+ actual = strip(input, 'C')
259
266
 
260
- assert_equal expected, actual
261
- end
267
+ assert_equal expected, actual
268
+ end
262
269
 
263
- def test_code_with_double_quoted_characters_3
270
+ def test_code_with_double_quoted_characters_3
264
271
 
265
- input = <<-EOF_main
272
+ input = <<-EOF_main
266
273
 
267
274
  case "\\'": // " this is the comment "
268
275
  EOF_main
269
- expected = <<-EOF_main
276
+ expected = <<-EOF_main
270
277
 
271
278
  case "\\'":
272
279
  EOF_main
273
280
 
274
- actual = strip(input, 'C')
281
+ actual = strip(input, 'C')
275
282
 
276
- assert_equal expected, actual
277
- end
283
+ assert_equal expected, actual
284
+ end
278
285
 
279
- def test_code_with_double_quoted_characters_4
286
+ def test_code_with_double_quoted_characters_4
280
287
 
281
- input = <<-EOF_main
288
+ input = <<-EOF_main
282
289
 
283
290
  case "\\\\": // " this is the comment "
284
291
  EOF_main
285
- expected = <<-EOF_main
292
+ expected = <<-EOF_main
286
293
 
287
294
  case "\\\\":
288
295
  EOF_main
289
296
 
290
- actual = strip(input, 'C')
297
+ actual = strip(input, 'C')
291
298
 
292
- assert_equal expected, actual
293
- end
299
+ assert_equal expected, actual
300
+ end
294
301
 
295
- def test_code_with_double_quoted_characters_5
302
+ def test_code_with_double_quoted_characters_5
296
303
 
297
- input = <<-EOF_main
304
+ input = <<-EOF_main
298
305
 
299
306
  case "\\\\": // " this is the comment "
300
307
  EOF_main
301
- expected = <<-EOF_main
308
+ expected = <<-EOF_main
302
309
 
303
310
  case "\\\\":
304
311
  EOF_main
305
312
 
306
- actual = strip(input, 'C')
313
+ actual = strip(input, 'C')
307
314
 
308
- assert_equal expected, actual
309
- end
315
+ assert_equal expected, actual
316
+ end
310
317
 
311
- def test_simple_main_with_trailing_cppcomment
318
+ def test_simple_main_with_trailing_cppcomment
312
319
 
313
- input = <<-EOF_main
320
+ input = <<-EOF_main
314
321
  #include <stdio.h>
315
322
  int main(int argc, char* argv[])
316
323
  {
317
324
  return 0; // same as EXIT_SUCCESS
318
325
  }
319
326
  EOF_main
320
- expected = <<-EOF_main
327
+ expected = <<-EOF_main
321
328
  #include <stdio.h>
322
329
  int main(int argc, char* argv[])
323
330
  {
@@ -325,19 +332,19 @@ int main(int argc, char* argv[])
325
332
  }
326
333
  EOF_main
327
334
 
328
- assert_equal expected, strip(input, 'C')
329
- end
335
+ assert_equal expected, strip(input, 'C')
336
+ end
330
337
 
331
- def test_simple_main_with_trailing_cppcomment_and_divide_maths
338
+ def test_simple_main_with_trailing_cppcomment_and_divide_maths
332
339
 
333
- input = <<-EOF_main
340
+ input = <<-EOF_main
334
341
  #include <stdio.h>
335
342
  int main(int argc, char* argv[])
336
343
  {
337
344
  return 0 / 1; // same as EXIT_SUCCESS
338
345
  }
339
346
  EOF_main
340
- expected = <<-EOF_main
347
+ expected = <<-EOF_main
341
348
  #include <stdio.h>
342
349
  int main(int argc, char* argv[])
343
350
  {
@@ -345,19 +352,19 @@ int main(int argc, char* argv[])
345
352
  }
346
353
  EOF_main
347
354
 
348
- assert_equal expected, strip(input, 'C')
349
- end
355
+ assert_equal expected, strip(input, 'C')
356
+ end
350
357
 
351
- def test_simple_main_with_ccomment
358
+ def test_simple_main_with_ccomment
352
359
 
353
- input = <<-EOF_main
360
+ input = <<-EOF_main
354
361
  #include <stdio.h>
355
362
  int main(int argc, char* argv[])
356
363
  {
357
364
  return 2; /* same as EXIT_SUCCESS */
358
365
  }
359
366
  EOF_main
360
- expected = <<-EOF_main
367
+ expected = <<-EOF_main
361
368
  #include <stdio.h>
362
369
  int main(int argc, char* argv[])
363
370
  {
@@ -365,38 +372,38 @@ int main(int argc, char* argv[])
365
372
  }
366
373
  EOF_main
367
374
 
368
- assert_equal expected, strip(input, 'C')
369
- end
375
+ assert_equal expected, strip(input, 'C')
376
+ end
370
377
 
371
- def test_ccomment_inline
378
+ def test_ccomment_inline
372
379
 
373
- input = 'int i = func(/*x=*/x, /*y=*/y);'
374
- expected = 'int i = func(x, y);'
380
+ input = 'int i = func(/*x=*/x, /*y=*/y);'
381
+ expected = 'int i = func(x, y);'
375
382
 
376
- assert_equal expected, strip(input, 'C')
377
- end
383
+ assert_equal expected, strip(input, 'C')
384
+ end
378
385
 
379
- def test_multiline_1
386
+ def test_multiline_1
380
387
 
381
- input = <<-EOF_main
388
+ input = <<-EOF_main
382
389
 
383
390
  /** Some function description
384
391
  */
385
392
  int func();
386
393
  EOF_main
387
- expected = <<-EOF_main
394
+ expected = <<-EOF_main
388
395
 
389
396
 
390
397
 
391
398
  int func();
392
399
  EOF_main
393
400
 
394
- assert_equal expected, strip(input, 'C')
395
- end
401
+ assert_equal expected, strip(input, 'C')
402
+ end
396
403
 
397
- def test_multiline_2
404
+ def test_multiline_2
398
405
 
399
- input = <<-EOF_main
406
+ input = <<-EOF_main
400
407
 
401
408
  /** Some function description
402
409
  */
@@ -408,7 +415,7 @@ int func();
408
415
 
409
416
  int fn();
410
417
  EOF_main
411
- expected = <<-EOF_main
418
+ expected = <<-EOF_main
412
419
 
413
420
 
414
421
 
@@ -421,12 +428,12 @@ int func();
421
428
  int fn();
422
429
  EOF_main
423
430
 
424
- assert_equal expected, strip(input, 'C')
425
- end
431
+ assert_equal expected, strip(input, 'C')
432
+ end
426
433
 
427
- def test_multiline_3
434
+ def test_multiline_3
428
435
 
429
- input = <<-EOF_main
436
+ input = <<-EOF_main
430
437
 
431
438
  /** Some function description
432
439
  *
@@ -434,7 +441,7 @@ EOF_main
434
441
  */
435
442
  int func();
436
443
  EOF_main
437
- expected = <<-EOF_main
444
+ expected = <<-EOF_main
438
445
 
439
446
 
440
447
 
@@ -443,12 +450,12 @@ EOF_main
443
450
  int func();
444
451
  EOF_main
445
452
 
446
- assert_equal expected, strip(input, 'C')
447
- end
453
+ assert_equal expected, strip(input, 'C')
454
+ end
448
455
 
449
- def test_multiline_4
456
+ def test_multiline_4
450
457
 
451
- input = <<-EOF_main
458
+ input = <<-EOF_main
452
459
 
453
460
  /** //////////////////////////////////
454
461
  *
@@ -465,42 +472,72 @@ EOF_main
465
472
  int func();
466
473
  EOF_main
467
474
 
468
- assert_equal expected, strip(input, 'C')
469
- end
475
+ assert_equal expected, strip(input, 'C')
476
+ end
470
477
 
471
- def test_comments_in_strings_1
478
+ def test_comments_in_strings_1
472
479
 
473
- input = <<-EOF_main
480
+ input = <<-EOF_main
474
481
 
475
482
  string s("//"); // THIS is the comment
476
483
  EOF_main
477
- expected = <<-EOF_main
484
+ expected = <<-EOF_main
478
485
 
479
486
  string s("//");
480
487
  EOF_main
481
- actual = strip(input, 'C')
488
+ actual = strip(input, 'C')
482
489
 
483
- assert_equal expected, actual
484
- end
490
+ assert_equal expected, actual
491
+ end
485
492
 
486
- def test_comments_in_strings_2
493
+ def test_comments_in_strings_2
487
494
 
488
- input = <<-EOF_main
495
+ input = <<-EOF_main
489
496
 
490
497
  string s("/*"); // THIS is the comment
491
498
  EOF_main
492
- expected = <<-EOF_main
499
+ expected = <<-EOF_main
493
500
 
494
501
  string s("/*");
495
502
  EOF_main
496
- actual = strip(input, 'C')
503
+ actual = strip(input, 'C')
497
504
 
498
- assert_equal expected, actual
499
- end
505
+ assert_equal expected, actual
506
+ end
507
+
508
+ def test_comments_in_strings_3
509
+
510
+ input = <<-EOF_main
500
511
 
501
- def test_real_sample_1
512
+ string s("/"); // THIS is the comment
513
+ EOF_main
514
+ expected = <<-EOF_main
515
+
516
+ string s("/");
517
+ EOF_main
518
+ actual = strip(input, 'C')
502
519
 
503
- input = <<-EOF_main
520
+ assert_equal expected, actual
521
+ end
522
+
523
+ def test_comments_in_strings_4
524
+
525
+ input = <<-EOF_main
526
+
527
+ string s("/* this is a comment */"); // this is THE comment
528
+ EOF_main
529
+ expected = <<-EOF_main
530
+
531
+ string s("/* this is a comment */");
532
+ EOF_main
533
+ actual = strip(input, 'C')
534
+
535
+ assert_equal expected, actual
536
+ end
537
+
538
+ def test_real_sample_1
539
+
540
+ input = <<-EOF_main
504
541
  /* /////////////////////////////////////////////////////////////////////////
505
542
  * includes
506
543
  *
@@ -531,7 +568,7 @@ EOF_main
531
568
  # pragma warning(disable : 4702) // suppresses "unreachable code"
532
569
  #endif /* compiler */
533
570
  EOF_main
534
- expected = <<-EOF_main
571
+ expected = <<-EOF_main
535
572
 
536
573
 
537
574
 
@@ -562,14 +599,14 @@ EOF_main
562
599
  # pragma warning(disable : 4702)
563
600
  #endif
564
601
  EOF_main
565
- actual = strip(input, 'C')
602
+ actual = strip(input, 'C')
566
603
 
567
- assert_equal expected, actual
568
- end
604
+ assert_equal expected, actual
605
+ end
569
606
 
570
- def test_real_sample_2
607
+ def test_real_sample_2
571
608
 
572
- input = <<-EOF_main
609
+ input = <<-EOF_main
573
610
  /* /////////////////////////////////////////////////////////////////////////
574
611
  * includes
575
612
  */
@@ -616,7 +653,7 @@ EOF_main
616
653
  # include <crtdbg.h>
617
654
  #endif
618
655
  EOF_main
619
- expected = <<-EOF_main
656
+ expected = <<-EOF_main
620
657
 
621
658
 
622
659
 
@@ -664,12 +701,12 @@ EOF_main
664
701
  #endif
665
702
  EOF_main
666
703
 
667
- assert_equal expected, strip(input, 'C')
668
- end
704
+ assert_equal expected, strip(input, 'C')
705
+ end
669
706
 
670
- def test_real_sample_3
707
+ def test_real_sample_3
671
708
 
672
- input = <<-EOF_main
709
+ input = <<-EOF_main
673
710
  /* /////////////////////////////////////////////////////////////////////////
674
711
  * File: src/fmt_cache.cpp
675
712
  *
@@ -752,7 +789,7 @@ EOF_main
752
789
  #include <new>
753
790
  EOF_main
754
791
 
755
- expected = <<-EOF_main
792
+ expected = <<-EOF_main
756
793
 
757
794
 
758
795
 
@@ -835,14 +872,12 @@ EOF_main
835
872
  #include <new>
836
873
  EOF_main
837
874
 
838
- actual = strip(input, 'C')
875
+ assert_equal expected, strip(input, 'C')
876
+ end
839
877
 
840
- assert_equal expected, strip(input, 'C')
841
- end
842
-
843
- def test_real_sample_4
878
+ def test_real_sample_4
844
879
 
845
- input = <<-EOF_main
880
+ input = <<-EOF_main
846
881
  /* /////////////////////////////////////////////////////////////////////////
847
882
  * File: src/fmt_cache.cpp
848
883
  *
@@ -1547,7 +1582,7 @@ pattern_t pattern_record_t::pattern() const
1547
1582
  /* ///////////////////////////// end of file //////////////////////////// */
1548
1583
  EOF_main
1549
1584
 
1550
- expected = <<-EOF_main
1585
+ expected = <<-EOF_main
1551
1586
 
1552
1587
 
1553
1588
 
@@ -2252,12 +2287,12 @@ pattern_t pattern_record_t::pattern() const
2252
2287
 
2253
2288
  EOF_main
2254
2289
 
2255
- assert_equal expected, strip(input, 'C')
2256
- end
2290
+ assert_equal expected, strip(input, 'C')
2291
+ end
2257
2292
 
2258
- def test_real_sample_5
2293
+ def test_real_sample_5
2259
2294
 
2260
- input = <<-EOF_main
2295
+ input = <<-EOF_main
2261
2296
  /*****************************************************************************
2262
2297
  /* Start of crcmodel.c
2263
2298
  /*****************************************************************************
@@ -2303,7 +2338,7 @@ LOCAL ulong reflect (ulong v, int b)
2303
2338
  /* Returns the value v with the bottom b [0,32] bits reflected. */
2304
2339
  /* Example: reflect(0x3e23L,3) == 0x3e26 */
2305
2340
  EOF_main
2306
- expected = <<-EOF_main
2341
+ expected = <<-EOF_main
2307
2342
 
2308
2343
 
2309
2344
 
@@ -2349,14 +2384,14 @@ LOCAL ulong reflect (ulong v, int b)
2349
2384
 
2350
2385
 
2351
2386
  EOF_main
2352
- actual = strip(input, 'C')
2387
+ actual = strip(input, 'C')
2353
2388
 
2354
- assert_equal expected, actual
2355
- end
2389
+ assert_equal expected, actual
2390
+ end
2356
2391
 
2357
- def _test_real_sample_6
2392
+ def test_real_sample_6
2358
2393
 
2359
- input = <<-EOF_main
2394
+ input = <<-EOF_main
2360
2395
 
2361
2396
 
2362
2397
 
@@ -2444,8 +2479,6 @@ namespace {
2444
2479
 
2445
2480
  default:
2446
2481
  // Check for control characters and invalid utf-8
2447
- EOF_main
2448
- x1 = <<-EOF_main
2449
2482
  // Escape control characters in standard ascii
2450
2483
  // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
2451
2484
  if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {
@@ -2646,7 +2679,7 @@ x1 = <<-EOF_main
2646
2679
  }
2647
2680
  EOF_main
2648
2681
 
2649
- expected = <<-EOF_main
2682
+ expected = <<-EOF_main
2650
2683
 
2651
2684
 
2652
2685
 
@@ -2734,9 +2767,6 @@ namespace {
2734
2767
 
2735
2768
  default:
2736
2769
 
2737
- EOF_main
2738
- x1 = <<-EOF_main
2739
-
2740
2770
 
2741
2771
 
2742
2772
  if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {
@@ -2937,14 +2967,14 @@ x1 = <<-EOF_main
2937
2967
  }
2938
2968
  EOF_main
2939
2969
 
2940
- actual = strip(input, 'C')
2970
+ actual = strip(input, 'C')
2941
2971
 
2942
- assert_equal expected, actual
2943
- end
2972
+ assert_equal expected, actual
2973
+ end
2944
2974
 
2945
- def test_real_sample_7
2975
+ def test_real_sample_7
2946
2976
 
2947
- input = <<-EOF_main
2977
+ input = <<-EOF_main
2948
2978
  #if defined(RECLS_CPP_NO_METHOD_PROPERTY_SUPPORT)
2949
2979
  /* Do not define RECLS_CPP_METHOD_PROPERTY_SUPPORT */
2950
2980
  #else /* ? RECLS_CPP_???_METHOD_PROPERTY_SUPPORT */
@@ -2966,7 +2996,7 @@ EOF_main
2966
2996
  #endif /* RECLS_CPP_???_METHOD_PROPERTY_SUPPORT */
2967
2997
 
2968
2998
  EOF_main
2969
- expected = <<-EOF_main
2999
+ expected = <<-EOF_main
2970
3000
  #if defined(RECLS_CPP_NO_METHOD_PROPERTY_SUPPORT)
2971
3001
 
2972
3002
  #else
@@ -2989,14 +3019,14 @@ EOF_main
2989
3019
 
2990
3020
  EOF_main
2991
3021
 
2992
- actual = strip(input, 'C')
3022
+ actual = strip(input, 'C')
2993
3023
 
2994
- assert_equal expected, actual
2995
- end
3024
+ assert_equal expected, actual
3025
+ end
2996
3026
 
2997
- def test_real_sample_8
3027
+ def test_real_sample_8
2998
3028
 
2999
- input = <<-EOF_main
3029
+ input = <<-EOF_main
3000
3030
  /*****************************************************************************
3001
3031
  /* Start of crcmodel.c
3002
3032
  /*****************************************************************************
@@ -3141,7 +3171,7 @@ ulong cm_tab (p_cm_t p_cm, int index)
3141
3171
  /* End of crcmodel.c */
3142
3172
  /******************************************************************************/
3143
3173
  EOF_main
3144
- expected = <<-EOF_main
3174
+ expected = <<-EOF_main
3145
3175
 
3146
3176
 
3147
3177
 
@@ -3287,14 +3317,14 @@ ulong cm_tab (p_cm_t p_cm, int index)
3287
3317
 
3288
3318
  EOF_main
3289
3319
 
3290
- actual = strip(input, 'C')
3320
+ actual = strip(input, 'C')
3291
3321
 
3292
- assert_equal expected, actual
3293
- end
3322
+ assert_equal expected, actual
3323
+ end
3294
3324
 
3295
- def test_real_sample_9
3325
+ def test_real_sample_9
3296
3326
 
3297
- input = <<-EOF_main
3327
+ input = <<-EOF_main
3298
3328
  /*
3299
3329
  * This source file is part of the bstring string library. This code was
3300
3330
  * written by Paul Hsieh in 2002-2010, and is covered by either the 3-clause
@@ -3436,7 +3466,7 @@ int ret = 0;
3436
3466
  }
3437
3467
 
3438
3468
  EOF_main
3439
- expected = <<-EOF_main
3469
+ expected = <<-EOF_main
3440
3470
 
3441
3471
 
3442
3472
 
@@ -3579,14 +3609,14 @@ int ret = 0;
3579
3609
 
3580
3610
  EOF_main
3581
3611
 
3582
- actual = strip(input, 'C')
3612
+ actual = strip(input, 'C')
3583
3613
 
3584
- assert_equal expected, actual
3585
- end
3614
+ assert_equal expected, actual
3615
+ end
3586
3616
 
3587
- def test_real_sample_10
3617
+ def test_real_sample_10
3588
3618
 
3589
- input = <<-EOF_main
3619
+ input = <<-EOF_main
3590
3620
  // Scintilla source code edit control
3591
3621
  /** @file CharacterSet.h
3592
3622
  ** Encapsulates a set of characters. Used to test if a character is within a set.
@@ -3647,7 +3677,7 @@ public:
3647
3677
  };
3648
3678
  EOF_main
3649
3679
 
3650
- expected = <<-EOF_main
3680
+ expected = <<-EOF_main
3651
3681
 
3652
3682
 
3653
3683
 
@@ -3708,10 +3738,10 @@ public:
3708
3738
  };
3709
3739
  EOF_main
3710
3740
 
3711
- actual = strip(input, 'C')
3741
+ actual = strip(input, 'C')
3712
3742
 
3713
- assert_equal expected, actual
3714
- end
3743
+ assert_equal expected, actual
3744
+ end
3715
3745
  end
3716
3746
 
3717
3747
  # ############################## end of file ############################# #