[Bioperl-guts-l] bioperl-live/t/lib BioperlTest.pm,1.6,1.7

Senduran Balasubramaniam sendu at dev.open-bio.org
Fri Jun 22 06:52:35 EDT 2007


Update of /home/repository/bioperl/bioperl-live/t/lib
In directory dev.open-bio.org:/tmp/cvs-serv2766/t/lib

Modified Files:
	BioperlTest.pm 
Log Message:
added test_output_file() and test_input_file() methods

Index: BioperlTest.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/lib/BioperlTest.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** BioperlTest.pm	22 Jun 2007 09:42:59 -0000	1.6
--- BioperlTest.pm	22 Jun 2007 10:52:33 -0000	1.7
***************
*** 92,95 ****
--- 92,97 ----
  use warnings;
  
+ use File::Temp ();
+ use File::Spec;
  use Exporter qw(import);
  
***************
*** 125,132 ****
--- 127,137 ----
                   test_begin
                   test_skip
+                  test_output_file
+                  test_input_file
                   test_network
                   test_debug);
  
  our $GLOBAL_FRAMEWORK = 'Test::More';
+ our @TEMP_FILES;
  
  
***************
*** 222,225 ****
--- 227,268 ----
  }
  
+ =head2 test_output_file
+ 
+  Title   : test_output_file
+  Usage   : my $output_file = test_output_file();
+  Function: Get the full path of a file suitable for writing to.
+            When your test script ends, the file will be automatically deleted.
+  Returns : string (file path)
+  Args    : none
+ 
+ =cut
+ 
+ sub test_output_file {
+     my %args = @_;
+     
+     my $tmp = File::Temp->new();
+     push(@TEMP_FILES, $tmp);
+     
+     return $tmp->filename;
+ }
+ 
+ =head2 test_input_file
+ 
+  Title   : test_input_file
+  Usage   : my $input_file = test_input_file();
+  Function: Get the path of a desired input file stored in the standard location
+            (currently t/data), but correct for all platforms.
+  Returns : string (file path)
+  Args    : list of strings (ie. at least the input filename, preceded by the
+            names of any subdirectories within t/data)
+            eg. for the file t/data/in.file pass 'in.file', for the file
+            t/data/subdir/in.file, pass ('subdir', 'in.file')
+ 
+ =cut
+ 
+ sub test_input_file {
+     return File::Spec->catfile('t', 'data', @_);
+ }
+ 
  =head2 test_network
  



More information about the Bioperl-guts-l mailing list