Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
Track which phases causes each failure
Browse files Browse the repository at this point in the history
Each merge test consists of three phases: merge, run, check output.
Until I added t/indent-block-py.t all failing tests did so during the
merge phase.  Now we have a test which causes Git to fail during the run
phase.

Eventually I'll visual this new data in a convenient format.  For now
it's available in the raw TAP output if anyone wants to see it.

Closes #11
  • Loading branch information
mndrix committed Sep 4, 2015
1 parent 9a46019 commit a1392f6
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 11 deletions.
14 changes: 12 additions & 2 deletions lib/Test/Merges.pm
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,24 @@ sub merge_ok {
my $repo_name = "merge-$y-into-$x";
clone $x, $repo_name;
chdir $repo_name;

my @phases = qw( merge run output );
my $check = sub {
my $phase = shift @phases;
pass("$phase ($y into $x)");
};
try {
perform_merge("../$y");
$check->();
system("./run > obtained.txt");
$check->();
system("diff -u expected.txt obtained.txt");
pass("merge $y into $x");
$check->();
pass("$y into $x");
}
catch {
fail("merge $y into $x");
fail($_) for @phases;
fail("$y into $x");
};
chdir '..';
}
Expand Down
2 changes: 1 addition & 1 deletion t/adjacent-changes.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# Perform two changes on immediately adjacent lines.
Expand Down
2 changes: 1 addition & 1 deletion t/dual-renames.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# One branch renames a function. The other branch renames that function's
Expand Down
2 changes: 1 addition & 1 deletion t/eol-comment.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# Add an end-of-line comment and change the same line
Expand Down
2 changes: 1 addition & 1 deletion t/indent-block-py.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# indent-block in Python
Expand Down
2 changes: 1 addition & 1 deletion t/indent-block.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# Modify and indent a block of code
Expand Down
2 changes: 1 addition & 1 deletion t/move-modify.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# One branch moves a file. Another branch modifies the file.
Expand Down
2 changes: 1 addition & 1 deletion t/nearby-changes.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# Perform two changes on nearby lines
Expand Down
2 changes: 1 addition & 1 deletion t/same-change.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# Perform the exact same change in two separate branches.
Expand Down
2 changes: 1 addition & 1 deletion t/trailing-whitespace.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 2;
use Test::More tests => 8;
use Test::Merges;

# Remove trailing whitespace on the same line as a meaningful change
Expand Down

0 comments on commit a1392f6

Please sign in to comment.