comment_strip-ruby 0.1.2.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,63 +9,63 @@ require 'xqsr3/extensions/test/unit'
9
9
 
10
10
  require 'test/unit'
11
11
 
12
- class Test_strip_1 < Test::Unit::TestCase
12
+ class Test_C_strip_1 < Test::Unit::TestCase
13
13
 
14
- include ::CommentStrip
14
+ include ::CommentStrip
15
15
 
16
- def test_nil
16
+ def test_nil
17
17
 
18
- assert_nil strip(nil, 'C')
18
+ assert_nil strip(nil, 'C')
19
19
 
20
- assert_nil ::CommentStrip.strip(nil, 'C')
21
- end
20
+ assert_nil ::CommentStrip.strip(nil, 'C')
21
+ end
22
22
 
23
- def test_unrecognised_families
23
+ def test_unrecognised_families
24
24
 
25
- unrecognised_families = %w{
25
+ unrecognised_families = %w{
26
26
 
27
- Python
28
- Perl
29
- Ruby
27
+ Python
28
+ Perl
29
+ Ruby
30
30
 
31
- Java
32
- Kotlin
33
- Scala
31
+ Java
32
+ Kotlin
33
+ Scala
34
34
 
35
- Rust
36
- }
35
+ Rust
36
+ }
37
37
 
38
- unrecognised_families.each do |family|
38
+ unrecognised_families.each do |family|
39
39
 
40
- assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { strip('', family) }
41
- assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { ::CommentStrip.strip('', family) }
42
- end
40
+ assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { strip('', family) }
41
+ assert_raise_with_message(::RuntimeError, /family.*unrecognised/) { ::CommentStrip.strip('', family) }
43
42
  end
43
+ end
44
44
 
45
- def test_empty
45
+ def test_empty
46
46
 
47
- assert_equal "", strip('', 'C')
48
- assert_equal "", ::CommentStrip.strip('', :C)
49
- end
47
+ assert_equal "", strip('', 'C')
48
+ assert_equal "", ::CommentStrip.strip('', :C)
49
+ end
50
50
 
51
- def test_simple_main
51
+ def test_simple_main
52
52
 
53
- input = <<-EOF_main
53
+ input = <<-EOF_main
54
54
  #include <stdio.h>
55
55
  int main(int argc, char* argv[])
56
56
  {
57
57
  return 0;
58
58
  }
59
59
  EOF_main
60
- expected = input
60
+ expected = input
61
61
 
62
- assert_equal expected, strip(input, 'C')
63
- assert_equal expected, ::CommentStrip.strip(input, 'C')
64
- end
62
+ assert_equal expected, strip(input, 'C')
63
+ assert_equal expected, ::CommentStrip.strip(input, 'C')
64
+ end
65
65
 
66
- def test_x_1
66
+ def test_x_1
67
67
 
68
- input = <<-EOF_main
68
+ input = <<-EOF_main
69
69
  #ifdef CLARA_PLATFORM_WINDOWS
70
70
  case '/': from = i+1; return SlashOpt;
71
71
  #endif
@@ -78,7 +78,7 @@ EOF_main
78
78
  return !placeholder.empty();
79
79
  }
80
80
  EOF_main
81
- expected = <<-EOF_main
81
+ expected = <<-EOF_main
82
82
  #ifdef CLARA_PLATFORM_WINDOWS
83
83
  case '/': from = i+1; return SlashOpt;
84
84
  #endif
@@ -92,232 +92,232 @@ EOF_main
92
92
  }
93
93
  EOF_main
94
94
 
95
- actual = strip(input, 'C')
96
- actual = ::CommentStrip.strip(input, 'C')
95
+ actual = strip(input, 'C')
96
+ actual = ::CommentStrip.strip(input, 'C')
97
97
 
98
- assert_equal expected, actual
99
- end
98
+ assert_equal expected, actual
99
+ end
100
100
 
101
- def test_x_2
101
+ def test_x_2
102
102
 
103
- input = <<-EOF_main
103
+ input = <<-EOF_main
104
104
 
105
105
  } // namespace something
106
106
  EOF_main
107
- expected = <<-EOF_main
107
+ expected = <<-EOF_main
108
108
 
109
109
  }
110
110
  EOF_main
111
111
 
112
- actual = strip(input, 'C')
113
- actual = ::CommentStrip.strip(input, 'C')
112
+ actual = strip(input, 'C')
113
+ actual = ::CommentStrip.strip(input, 'C')
114
114
 
115
- assert_equal expected, actual
116
- end
115
+ assert_equal expected, actual
116
+ end
117
117
 
118
- def test_x_3
118
+ def test_x_3
119
119
 
120
- input = <<-EOF_main
120
+ input = <<-EOF_main
121
121
 
122
122
  #endif /* !LOG_PERROR */
123
123
  EOF_main
124
- expected = <<-EOF_main
124
+ expected = <<-EOF_main
125
125
 
126
126
  #endif
127
127
  EOF_main
128
128
 
129
- actual = strip(input, 'C')
130
- actual = ::CommentStrip.strip(input, 'C')
129
+ actual = strip(input, 'C')
130
+ actual = ::CommentStrip.strip(input, 'C')
131
131
 
132
- assert_equal expected, actual
133
- end
132
+ assert_equal expected, actual
133
+ end
134
134
 
135
- def test_code_with_single_quoted_characters_1
135
+ def test_code_with_single_quoted_characters_1
136
136
 
137
- input = <<-EOF_main
137
+ input = <<-EOF_main
138
138
 
139
139
  case '"': // " this is the comment "
140
140
  EOF_main
141
- expected = <<-EOF_main
141
+ expected = <<-EOF_main
142
142
 
143
143
  case '"':
144
144
  EOF_main
145
145
 
146
- actual = strip(input, 'C')
146
+ actual = strip(input, 'C')
147
147
 
148
- assert_equal expected, actual
149
- end
148
+ assert_equal expected, actual
149
+ end
150
150
 
151
- def test_code_with_single_quoted_characters_2
151
+ def test_code_with_single_quoted_characters_2
152
152
 
153
- input = <<-EOF_main
153
+ input = <<-EOF_main
154
154
 
155
- case '\\"': // " this is the comment "
155
+ case '\"': // " this is the comment "
156
156
  EOF_main
157
- expected = <<-EOF_main
157
+ expected = <<-EOF_main
158
158
 
159
- case '\\"':
159
+ case '\"':
160
160
  EOF_main
161
161
 
162
- actual = strip(input, 'C')
162
+ actual = strip(input, 'C')
163
163
 
164
- assert_equal expected, actual
165
- end
164
+ assert_equal expected, actual
165
+ end
166
166
 
167
- def test_code_with_single_quoted_characters_3
167
+ def test_code_with_single_quoted_characters_3
168
168
 
169
- input = <<-EOF_main
169
+ input = <<-EOF_main
170
170
 
171
- case '\\'': // " this is the comment "
171
+ case '\'': // " this is the comment "
172
172
  EOF_main
173
- expected = <<-EOF_main
173
+ expected = <<-EOF_main
174
174
 
175
- case '\\'':
175
+ case '\'':
176
176
  EOF_main
177
177
 
178
- actual = strip(input, 'C')
178
+ actual = strip(input, 'C')
179
179
 
180
- assert_equal expected, actual
181
- end
180
+ assert_equal expected, actual
181
+ end
182
182
 
183
- def test_code_with_single_quoted_characters_4
183
+ def test_code_with_single_quoted_characters_4
184
184
 
185
- input = <<-EOF_main
185
+ input = <<-EOF_main
186
186
 
187
187
  case '\\\\': // " this is the comment "
188
188
  EOF_main
189
- expected = <<-EOF_main
189
+ expected = <<-EOF_main
190
190
 
191
191
  case '\\\\':
192
192
  EOF_main
193
193
 
194
- actual = strip(input, 'C')
194
+ actual = strip(input, 'C')
195
195
 
196
- assert_equal expected, actual
197
- end
196
+ assert_equal expected, actual
197
+ end
198
198
 
199
- def test_code_with_single_quoted_characters_5
199
+ def test_code_with_single_quoted_characters_5
200
200
 
201
- input = <<-EOF_main
201
+ input = <<-EOF_main
202
202
 
203
203
  case '\\\\': // " this is the comment "
204
204
  EOF_main
205
- expected = <<-EOF_main
205
+ expected = <<-EOF_main
206
206
 
207
207
  case '\\\\':
208
208
  EOF_main
209
209
 
210
- actual = strip(input, 'C')
210
+ actual = strip(input, 'C')
211
211
 
212
- assert_equal expected, actual
213
- end
212
+ assert_equal expected, actual
213
+ end
214
214
 
215
- def test_code_with_single_quoted_characters_6
215
+ def test_code_with_single_quoted_characters_6
216
216
 
217
- input = <<-EOF_main
217
+ input = <<-EOF_main
218
218
 
219
219
  #define SOME_CHAR '\\x80' /* some char */
220
220
  EOF_main
221
- expected = <<-EOF_main
221
+ expected = <<-EOF_main
222
222
 
223
223
  #define SOME_CHAR '\\x80'
224
224
  EOF_main
225
225
 
226
- actual = strip(input, 'C')
226
+ actual = strip(input, 'C')
227
227
 
228
- assert_equal expected, actual
229
- end
228
+ assert_equal expected, actual
229
+ end
230
230
 
231
- def test_code_with_double_quoted_characters_1
231
+ def test_code_with_double_quoted_characters_1
232
232
 
233
- input = <<-EOF_main
233
+ input = <<-EOF_main
234
234
 
235
235
  case "'": // " this is the comment "
236
236
  EOF_main
237
- expected = <<-EOF_main
237
+ expected = <<-EOF_main
238
238
 
239
239
  case "'":
240
240
  EOF_main
241
241
 
242
- actual = strip(input, 'C')
242
+ actual = strip(input, 'C')
243
243
 
244
- assert_equal expected, actual
245
- end
244
+ assert_equal expected, actual
245
+ end
246
246
 
247
- def test_code_with_double_quoted_characters_2
247
+ def test_code_with_double_quoted_characters_2
248
248
 
249
- input = <<-EOF_main
249
+ input = <<-EOF_main
250
250
 
251
251
  case "\\"": // " this is the comment "
252
252
  EOF_main
253
- expected = <<-EOF_main
253
+ expected = <<-EOF_main
254
254
 
255
255
  case "\\"":
256
256
  EOF_main
257
257
 
258
- actual = strip(input, 'C')
258
+ actual = strip(input, 'C')
259
259
 
260
- assert_equal expected, actual
261
- end
260
+ assert_equal expected, actual
261
+ end
262
262
 
263
- def test_code_with_double_quoted_characters_3
263
+ def test_code_with_double_quoted_characters_3
264
264
 
265
- input = <<-EOF_main
265
+ input = <<-EOF_main
266
266
 
267
267
  case "\\'": // " this is the comment "
268
268
  EOF_main
269
- expected = <<-EOF_main
269
+ expected = <<-EOF_main
270
270
 
271
271
  case "\\'":
272
272
  EOF_main
273
273
 
274
- actual = strip(input, 'C')
274
+ actual = strip(input, 'C')
275
275
 
276
- assert_equal expected, actual
277
- end
276
+ assert_equal expected, actual
277
+ end
278
278
 
279
- def test_code_with_double_quoted_characters_4
279
+ def test_code_with_double_quoted_characters_4
280
280
 
281
- input = <<-EOF_main
281
+ input = <<-EOF_main
282
282
 
283
283
  case "\\\\": // " this is the comment "
284
284
  EOF_main
285
- expected = <<-EOF_main
285
+ expected = <<-EOF_main
286
286
 
287
287
  case "\\\\":
288
288
  EOF_main
289
289
 
290
- actual = strip(input, 'C')
290
+ actual = strip(input, 'C')
291
291
 
292
- assert_equal expected, actual
293
- end
292
+ assert_equal expected, actual
293
+ end
294
294
 
295
- def test_code_with_double_quoted_characters_5
295
+ def test_code_with_double_quoted_characters_5
296
296
 
297
- input = <<-EOF_main
297
+ input = <<-EOF_main
298
298
 
299
299
  case "\\\\": // " this is the comment "
300
300
  EOF_main
301
- expected = <<-EOF_main
301
+ expected = <<-EOF_main
302
302
 
303
303
  case "\\\\":
304
304
  EOF_main
305
305
 
306
- actual = strip(input, 'C')
306
+ actual = strip(input, 'C')
307
307
 
308
- assert_equal expected, actual
309
- end
308
+ assert_equal expected, actual
309
+ end
310
310
 
311
- def test_simple_main_with_trailing_cppcomment
311
+ def test_simple_main_with_trailing_cppcomment
312
312
 
313
- input = <<-EOF_main
313
+ input = <<-EOF_main
314
314
  #include <stdio.h>
315
315
  int main(int argc, char* argv[])
316
316
  {
317
317
  return 0; // same as EXIT_SUCCESS
318
318
  }
319
319
  EOF_main
320
- expected = <<-EOF_main
320
+ expected = <<-EOF_main
321
321
  #include <stdio.h>
322
322
  int main(int argc, char* argv[])
323
323
  {
@@ -325,19 +325,19 @@ int main(int argc, char* argv[])
325
325
  }
326
326
  EOF_main
327
327
 
328
- assert_equal expected, strip(input, 'C')
329
- end
328
+ assert_equal expected, strip(input, 'C')
329
+ end
330
330
 
331
- def test_simple_main_with_trailing_cppcomment_and_divide_maths
331
+ def test_simple_main_with_trailing_cppcomment_and_divide_maths
332
332
 
333
- input = <<-EOF_main
333
+ input = <<-EOF_main
334
334
  #include <stdio.h>
335
335
  int main(int argc, char* argv[])
336
336
  {
337
337
  return 0 / 1; // same as EXIT_SUCCESS
338
338
  }
339
339
  EOF_main
340
- expected = <<-EOF_main
340
+ expected = <<-EOF_main
341
341
  #include <stdio.h>
342
342
  int main(int argc, char* argv[])
343
343
  {
@@ -345,19 +345,19 @@ int main(int argc, char* argv[])
345
345
  }
346
346
  EOF_main
347
347
 
348
- assert_equal expected, strip(input, 'C')
349
- end
348
+ assert_equal expected, strip(input, 'C')
349
+ end
350
350
 
351
- def test_simple_main_with_ccomment
351
+ def test_simple_main_with_ccomment
352
352
 
353
- input = <<-EOF_main
353
+ input = <<-EOF_main
354
354
  #include <stdio.h>
355
355
  int main(int argc, char* argv[])
356
356
  {
357
357
  return 2; /* same as EXIT_SUCCESS */
358
358
  }
359
359
  EOF_main
360
- expected = <<-EOF_main
360
+ expected = <<-EOF_main
361
361
  #include <stdio.h>
362
362
  int main(int argc, char* argv[])
363
363
  {
@@ -365,38 +365,38 @@ int main(int argc, char* argv[])
365
365
  }
366
366
  EOF_main
367
367
 
368
- assert_equal expected, strip(input, 'C')
369
- end
368
+ assert_equal expected, strip(input, 'C')
369
+ end
370
370
 
371
- def test_ccomment_inline
371
+ def test_ccomment_inline
372
372
 
373
- input = 'int i = func(/*x=*/x, /*y=*/y);'
374
- expected = 'int i = func(x, y);'
373
+ input = 'int i = func(/*x=*/x, /*y=*/y);'
374
+ expected = 'int i = func(x, y);'
375
375
 
376
- assert_equal expected, strip(input, 'C')
377
- end
376
+ assert_equal expected, strip(input, 'C')
377
+ end
378
378
 
379
- def test_multiline_1
379
+ def test_multiline_1
380
380
 
381
- input = <<-EOF_main
381
+ input = <<-EOF_main
382
382
 
383
383
  /** Some function description
384
384
  */
385
385
  int func();
386
386
  EOF_main
387
- expected = <<-EOF_main
387
+ expected = <<-EOF_main
388
388
 
389
389
 
390
390
 
391
391
  int func();
392
392
  EOF_main
393
393
 
394
- assert_equal expected, strip(input, 'C')
395
- end
394
+ assert_equal expected, strip(input, 'C')
395
+ end
396
396
 
397
- def test_multiline_2
397
+ def test_multiline_2
398
398
 
399
- input = <<-EOF_main
399
+ input = <<-EOF_main
400
400
 
401
401
  /** Some function description
402
402
  */
@@ -408,7 +408,7 @@ int func();
408
408
 
409
409
  int fn();
410
410
  EOF_main
411
- expected = <<-EOF_main
411
+ expected = <<-EOF_main
412
412
 
413
413
 
414
414
 
@@ -421,12 +421,12 @@ int func();
421
421
  int fn();
422
422
  EOF_main
423
423
 
424
- assert_equal expected, strip(input, 'C')
425
- end
424
+ assert_equal expected, strip(input, 'C')
425
+ end
426
426
 
427
- def test_multiline_3
427
+ def test_multiline_3
428
428
 
429
- input = <<-EOF_main
429
+ input = <<-EOF_main
430
430
 
431
431
  /** Some function description
432
432
  *
@@ -434,7 +434,7 @@ EOF_main
434
434
  */
435
435
  int func();
436
436
  EOF_main
437
- expected = <<-EOF_main
437
+ expected = <<-EOF_main
438
438
 
439
439
 
440
440
 
@@ -443,12 +443,12 @@ EOF_main
443
443
  int func();
444
444
  EOF_main
445
445
 
446
- assert_equal expected, strip(input, 'C')
447
- end
446
+ assert_equal expected, strip(input, 'C')
447
+ end
448
448
 
449
- def test_multiline_4
449
+ def test_multiline_4
450
450
 
451
- input = <<-EOF_main
451
+ input = <<-EOF_main
452
452
 
453
453
  /** //////////////////////////////////
454
454
  *
@@ -465,42 +465,72 @@ EOF_main
465
465
  int func();
466
466
  EOF_main
467
467
 
468
- assert_equal expected, strip(input, 'C')
469
- end
468
+ assert_equal expected, strip(input, 'C')
469
+ end
470
470
 
471
- def test_comments_in_strings_1
471
+ def test_comments_in_strings_1
472
472
 
473
- input = <<-EOF_main
473
+ input = <<-EOF_main
474
474
 
475
475
  string s("//"); // THIS is the comment
476
476
  EOF_main
477
- expected = <<-EOF_main
477
+ expected = <<-EOF_main
478
478
 
479
479
  string s("//");
480
480
  EOF_main
481
- actual = strip(input, 'C')
481
+ actual = strip(input, 'C')
482
482
 
483
- assert_equal expected, actual
484
- end
483
+ assert_equal expected, actual
484
+ end
485
485
 
486
- def test_comments_in_strings_2
486
+ def test_comments_in_strings_2
487
487
 
488
- input = <<-EOF_main
488
+ input = <<-EOF_main
489
489
 
490
490
  string s("/*"); // THIS is the comment
491
491
  EOF_main
492
- expected = <<-EOF_main
492
+ expected = <<-EOF_main
493
493
 
494
494
  string s("/*");
495
495
  EOF_main
496
- actual = strip(input, 'C')
496
+ actual = strip(input, 'C')
497
497
 
498
- assert_equal expected, actual
499
- end
498
+ assert_equal expected, actual
499
+ end
500
+
501
+ def test_comments_in_strings_3
502
+
503
+ input = <<-EOF_main
504
+
505
+ string s("/"); // THIS is the comment
506
+ EOF_main
507
+ expected = <<-EOF_main
508
+
509
+ string s("/");
510
+ EOF_main
511
+ actual = strip(input, 'C')
512
+
513
+ assert_equal expected, actual
514
+ end
515
+
516
+ def test_comments_in_strings_4
517
+
518
+ input = <<-EOF_main
519
+
520
+ string s("/* this is a comment */"); // this is THE comment
521
+ EOF_main
522
+ expected = <<-EOF_main
523
+
524
+ string s("/* this is a comment */");
525
+ EOF_main
526
+ actual = strip(input, 'C')
500
527
 
501
- def test_real_sample_1
528
+ assert_equal expected, actual
529
+ end
502
530
 
503
- input = <<-EOF_main
531
+ def test_real_sample_1
532
+
533
+ input = <<-EOF_main
504
534
  /* /////////////////////////////////////////////////////////////////////////
505
535
  * includes
506
536
  *
@@ -531,7 +561,7 @@ EOF_main
531
561
  # pragma warning(disable : 4702) // suppresses "unreachable code"
532
562
  #endif /* compiler */
533
563
  EOF_main
534
- expected = <<-EOF_main
564
+ expected = <<-EOF_main
535
565
 
536
566
 
537
567
 
@@ -562,14 +592,14 @@ EOF_main
562
592
  # pragma warning(disable : 4702)
563
593
  #endif
564
594
  EOF_main
565
- actual = strip(input, 'C')
595
+ actual = strip(input, 'C')
566
596
 
567
- assert_equal expected, actual
568
- end
597
+ assert_equal expected, actual
598
+ end
569
599
 
570
- def test_real_sample_2
600
+ def test_real_sample_2
571
601
 
572
- input = <<-EOF_main
602
+ input = <<-EOF_main
573
603
  /* /////////////////////////////////////////////////////////////////////////
574
604
  * includes
575
605
  */
@@ -616,7 +646,7 @@ EOF_main
616
646
  # include <crtdbg.h>
617
647
  #endif
618
648
  EOF_main
619
- expected = <<-EOF_main
649
+ expected = <<-EOF_main
620
650
 
621
651
 
622
652
 
@@ -664,12 +694,12 @@ EOF_main
664
694
  #endif
665
695
  EOF_main
666
696
 
667
- assert_equal expected, strip(input, 'C')
668
- end
697
+ assert_equal expected, strip(input, 'C')
698
+ end
669
699
 
670
- def test_real_sample_3
700
+ def test_real_sample_3
671
701
 
672
- input = <<-EOF_main
702
+ input = <<-EOF_main
673
703
  /* /////////////////////////////////////////////////////////////////////////
674
704
  * File: src/fmt_cache.cpp
675
705
  *
@@ -752,7 +782,7 @@ EOF_main
752
782
  #include <new>
753
783
  EOF_main
754
784
 
755
- expected = <<-EOF_main
785
+ expected = <<-EOF_main
756
786
 
757
787
 
758
788
 
@@ -835,14 +865,14 @@ EOF_main
835
865
  #include <new>
836
866
  EOF_main
837
867
 
838
- actual = strip(input, 'C')
868
+ actual = strip(input, 'C')
839
869
 
840
- assert_equal expected, strip(input, 'C')
841
- end
870
+ assert_equal expected, strip(input, 'C')
871
+ end
842
872
 
843
- def test_real_sample_4
873
+ def test_real_sample_4
844
874
 
845
- input = <<-EOF_main
875
+ input = <<-EOF_main
846
876
  /* /////////////////////////////////////////////////////////////////////////
847
877
  * File: src/fmt_cache.cpp
848
878
  *
@@ -1547,7 +1577,7 @@ pattern_t pattern_record_t::pattern() const
1547
1577
  /* ///////////////////////////// end of file //////////////////////////// */
1548
1578
  EOF_main
1549
1579
 
1550
- expected = <<-EOF_main
1580
+ expected = <<-EOF_main
1551
1581
 
1552
1582
 
1553
1583
 
@@ -2252,12 +2282,12 @@ pattern_t pattern_record_t::pattern() const
2252
2282
 
2253
2283
  EOF_main
2254
2284
 
2255
- assert_equal expected, strip(input, 'C')
2256
- end
2285
+ assert_equal expected, strip(input, 'C')
2286
+ end
2257
2287
 
2258
- def test_real_sample_5
2288
+ def test_real_sample_5
2259
2289
 
2260
- input = <<-EOF_main
2290
+ input = <<-EOF_main
2261
2291
  /*****************************************************************************
2262
2292
  /* Start of crcmodel.c
2263
2293
  /*****************************************************************************
@@ -2303,7 +2333,7 @@ LOCAL ulong reflect (ulong v, int b)
2303
2333
  /* Returns the value v with the bottom b [0,32] bits reflected. */
2304
2334
  /* Example: reflect(0x3e23L,3) == 0x3e26 */
2305
2335
  EOF_main
2306
- expected = <<-EOF_main
2336
+ expected = <<-EOF_main
2307
2337
 
2308
2338
 
2309
2339
 
@@ -2349,14 +2379,14 @@ LOCAL ulong reflect (ulong v, int b)
2349
2379
 
2350
2380
 
2351
2381
  EOF_main
2352
- actual = strip(input, 'C')
2382
+ actual = strip(input, 'C')
2353
2383
 
2354
- assert_equal expected, actual
2355
- end
2384
+ assert_equal expected, actual
2385
+ end
2356
2386
 
2357
- def _test_real_sample_6
2387
+ def _test_real_sample_6
2358
2388
 
2359
- input = <<-EOF_main
2389
+ input = <<-EOF_main
2360
2390
 
2361
2391
 
2362
2392
 
@@ -2445,7 +2475,7 @@ namespace {
2445
2475
  default:
2446
2476
  // Check for control characters and invalid utf-8
2447
2477
  EOF_main
2448
- x1 = <<-EOF_main
2478
+ x1 = <<-EOF_main
2449
2479
  // Escape control characters in standard ascii
2450
2480
  // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
2451
2481
  if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {
@@ -2646,7 +2676,7 @@ x1 = <<-EOF_main
2646
2676
  }
2647
2677
  EOF_main
2648
2678
 
2649
- expected = <<-EOF_main
2679
+ expected = <<-EOF_main
2650
2680
 
2651
2681
 
2652
2682
 
@@ -2735,7 +2765,7 @@ namespace {
2735
2765
  default:
2736
2766
 
2737
2767
  EOF_main
2738
- x1 = <<-EOF_main
2768
+ x1 = <<-EOF_main
2739
2769
 
2740
2770
 
2741
2771
 
@@ -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 ############################# #