From ff45f15409ee1adf2e7c0d01568dc93ea9ac2b78 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Mon, 25 May 2009 16:46:46 +0200 Subject: [PATCH] sanitized tests --- t/6-library/TEST-noplan.t | 46 ++++++++-------------------------------------- t/6-library/TEST-plan.t | 46 ++++++++-------------------------------------- 2 files changed, 16 insertions(+), 76 deletions(-) diff --git a/t/6-library/TEST-noplan.t b/t/6-library/TEST-noplan.t index e0b7709..5bbc077 100644 --- a/t/6-library/TEST-noplan.t +++ b/t/6-library/TEST-noplan.t @@ -8,48 +8,20 @@ # # -#--------------------------------# -# TEST library # -#--------------------------------# - use strict; -use Language::Befunge; -use POSIX qw! tmpnam !; -use Test::More; - -# Vars. -my $file; -my $fh; -my $tests; -my $out; -my $bef = Language::Befunge->new; -BEGIN { $tests = 0 }; +use warnings; -# In order to see what happens... -sub sel () { - $file = tmpnam(); - open OUT, ">$file" or die $!; - $fh = select OUT; -} -sub slurp () { - select $fh; - close OUT; - open OUT, "<$file" or die $!; - my $content; - { - local $/; - $content = ; - } - close OUT; - unlink $file; - return $content; -} +# -- TEST library -# TEST.pm and this test script share the same plan. +# this test is not like the others, where we check whether the output matches +# what is expected. indeed, since we're testing a test library, we're just +# running the befunge snippets, which should output some regular tap. +use Language::Befunge; +my $bef = Language::Befunge->new; +# TEST.pm and this test script share the same plan. -#$bef->set_DEBUG(1); # plan (no_plan) $bef->store_code( <<'END_OF_CODE' ); 0"TSET"4(#@0P)@ @@ -57,14 +29,12 @@ END_OF_CODE $bef->run_code; # ok -sel; $bef->store_code( <<'END_OF_CODE' ); 0"TSET"4(0"dnammoc O"1O)@ END_OF_CODE $bef->run_code; # is -sel; $bef->store_code( <<'END_OF_CODE' ); 0"TSET"4(0"dnammoc I"44I)@ END_OF_CODE diff --git a/t/6-library/TEST-plan.t b/t/6-library/TEST-plan.t index a4e16e4..c73193d 100644 --- a/t/6-library/TEST-plan.t +++ b/t/6-library/TEST-plan.t @@ -8,48 +8,20 @@ # # -#--------------------------------# -# TEST library # -#--------------------------------# - use strict; -use Language::Befunge; -use POSIX qw! tmpnam !; -use Test::More; - -# Vars. -my $file; -my $fh; -my $tests; -my $out; -my $bef = Language::Befunge->new; -BEGIN { $tests = 0 }; +use warnings; -# In order to see what happens... -sub sel () { - $file = tmpnam(); - open OUT, ">$file" or die $!; - $fh = select OUT; -} -sub slurp () { - select $fh; - close OUT; - open OUT, "<$file" or die $!; - my $content; - { - local $/; - $content = ; - } - close OUT; - unlink $file; - return $content; -} +# -- TEST library -# TEST.pm and this test script share the same plan. +# this test is not like the others, where we check whether the output matches +# what is expected. indeed, since we're testing a test library, we're just +# running the befunge snippets, which should output some regular tap. +use Language::Befunge; +my $bef = Language::Befunge->new; +# TEST.pm and this test script share the same plan. -#$bef->set_DEBUG(1); # plan (2 tests) $bef->store_code( <<'END_OF_CODE' ); 0"TSET"4(#@2P)@ @@ -57,14 +29,12 @@ END_OF_CODE $bef->run_code; # ok -sel; $bef->store_code( <<'END_OF_CODE' ); 0"TSET"4(0"dnammoc O"1O)@ END_OF_CODE $bef->run_code; # is -sel; $bef->store_code( <<'END_OF_CODE' ); 0"TSET"4(0"dnammoc I"44I)@ END_OF_CODE -- 2.11.4.GIT