stdouttoggler 1.0.0 → 1.0.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.
- data/stdouttoggler.gemspec +1 -1
- data/test/test_file_writer.rb +58 -3
- metadata +1 -1
data/stdouttoggler.gemspec
CHANGED
data/test/test_file_writer.rb
CHANGED
@@ -239,6 +239,61 @@ EOS
|
|
239
239
|
|
240
240
|
end #end ruby test
|
241
241
|
|
242
|
-
|
243
|
-
|
244
|
-
|
242
|
+
|
243
|
+
#####################################
|
244
|
+
def test_perl
|
245
|
+
|
246
|
+
@perl_file_uncommented = <<EOS
|
247
|
+
#!/bin/perl
|
248
|
+
#do not change
|
249
|
+
|
250
|
+
print "starting";
|
251
|
+
|
252
|
+
print "slice\n";
|
253
|
+
|
254
|
+
open(F,"<","JavaFile.java") or die "file: $!";
|
255
|
+
while(<F>) {
|
256
|
+
print "line";
|
257
|
+
}
|
258
|
+
close F;
|
259
|
+
|
260
|
+
print "\n\n";
|
261
|
+
EOS
|
262
|
+
|
263
|
+
@perl_file_commented = <<EOS
|
264
|
+
#!/bin/perl
|
265
|
+
#do not change
|
266
|
+
|
267
|
+
#print "starting";
|
268
|
+
|
269
|
+
#print "slice\n";
|
270
|
+
|
271
|
+
open(F,"<","JavaFile.java") or die "file: $!";
|
272
|
+
while(<F>) {
|
273
|
+
#print "line";
|
274
|
+
}
|
275
|
+
close F;
|
276
|
+
|
277
|
+
#print "\n\n";
|
278
|
+
EOS
|
279
|
+
|
280
|
+
#this is the perl type map
|
281
|
+
StdOutToggler::StdOutRegex::Producer.create_methods_for_producing_stdout_regex_strings(@stdout_type_maps[4])
|
282
|
+
|
283
|
+
#comment
|
284
|
+
perl_comment_regex_holder = StdOutToggler::StdOutRegex::Producer.new().perl_comment_regex
|
285
|
+
input = StringIO.new(@perl_file_uncommented)
|
286
|
+
output = StringIO.new
|
287
|
+
StdOutToggler::FileWriter.modify_file(input, output, perl_comment_regex_holder)
|
288
|
+
assert_equal(@perl_file_commented, output.string)
|
289
|
+
|
290
|
+
#uncomment
|
291
|
+
perl_uncomment_regex_holder = StdOutToggler::StdOutRegex::Producer.new().perl_uncomment_regex
|
292
|
+
input = StringIO.new(@perl_file_commented)
|
293
|
+
output = StringIO.new
|
294
|
+
StdOutToggler::FileWriter.modify_file(input, output, perl_uncomment_regex_holder)
|
295
|
+
assert_equal(@perl_file_uncommented, output.string)
|
296
|
+
|
297
|
+
end #end perl test
|
298
|
+
|
299
|
+
end
|