Skip to content
Browse files

fix the case when mulitiple and accessories_dir bot used

  • Loading branch information...
1 parent b408b10 commit 1a4e10512a79966869da36932d613e0ff4c4e621 @szabgab committed Apr 10, 2009
View
3 Changes
@@ -1,5 +1,8 @@
Changes of Test::Snapshots
+
+ Fix when multiple caseses are in a separate directory
+
v0.02 2009.04.10
Add lots of test cases
View
1 eg/multiple_accessories/other.pl.01.err
@@ -0,0 +1 @@
+Some warning
View
1 eg/multiple_accessories/other.pl.01.exit
@@ -0,0 +1 @@
+10
View
1 eg/multiple_accessories/other.pl.01.in
@@ -0,0 +1 @@
+Foo
View
2 eg/multiple_accessories/other.pl.01.out
@@ -0,0 +1,2 @@
+Please type in your name
+Hello Foo
View
1 eg/multiple_accessories/script.pl.17.err
@@ -0,0 +1 @@
+Some warning
View
1 eg/multiple_accessories/script.pl.17.in
@@ -0,0 +1 @@
+Foo
View
2 eg/multiple_accessories/script.pl.17.out
@@ -0,0 +1,2 @@
+Please type in your name
+Hello Foo
View
1 eg/multiple_accessories/script.pl.8.err
@@ -0,0 +1 @@
+Some warning
View
1 eg/multiple_accessories/script.pl.8.in
@@ -0,0 +1 @@
+Bar
View
2 eg/multiple_accessories/script.pl.8.out
@@ -0,0 +1,2 @@
+Please type in your name
+Hello Bar
View
12 eg/multiple_code/other.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+print "Please type in your name\n";
+my $name = <STDIN>;
+chomp $name;
+print "Hello $name\n";
+
+warn "Some warning\n";
+exit(10);
+
View
10 eg/multiple_code/script.pl
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+print "Please type in your name\n";
+my $name = <STDIN>;
+chomp $name;
+print "Hello $name\n";
+
+warn "Some warning\n";
View
4 lib/Test/Snapshots.pm
@@ -354,10 +354,12 @@ sub test_all_snapshots {
my %tests;
if ($multiple) {
foreach my $file (@files) {
+ my $accessories_path = $accessories_dir ? $accessories_dir . substr($file, $prefix_length) : $file;
+
my %seen;
my @extras = grep { !$seen{$_}++ }
map {$_ =~ /\.(\d+)\.(out|err|in|exit)$/; $1}
- glob "$file.*";
+ glob "$accessories_path.*";
$tests{$file} = \@extras;
}
}
View
10 t/09-otherdir-multiple.t
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Snapshots;
+
+Test::Snapshots::multiple(1);
+Test::Snapshots::set_accessories_dir('eg/multiple_accessories');
+test_all_snapshots('eg/multiple_code');
+

0 comments on commit 1a4e105

Please sign in to comment.
Something went wrong with that request. Please try again.