forked from kingpong/perl-Test-Spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
136 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env perl | ||
# | ||
# disabled.t | ||
# | ||
# Test cases for disabled specs (xit, xdescribe, xthey). | ||
# Executes disabled_spec.pl and validates its TAP output. | ||
# | ||
######################################################################## | ||
# | ||
use strict; | ||
use warnings; | ||
use FindBin qw($Bin); | ||
BEGIN { require "$Bin/test_helper.pl" }; | ||
|
||
use Test::More; | ||
use TAP::Parser; | ||
|
||
my @results = parse_tap("disabled_spec.pl"); | ||
my %passing = map { $_->description => $_ } grep { $_->is_test } @results; | ||
|
||
sub test_passed { | ||
my $desc = shift; | ||
my $testdesc = "- $desc"; | ||
ok($passing{$testdesc}, $desc); | ||
} | ||
|
||
sub test_todo { | ||
my $desc = shift; | ||
my $testdesc = "- $desc"; | ||
ok($passing{$testdesc} && $passing{$testdesc}->directive eq 'TODO', $desc); | ||
} | ||
|
||
test_todo('Test::Spec disabled spec should not execute "it" examples'); | ||
test_todo('Test::Spec disabled spec should not execute "they" examples'); | ||
test_todo('Test::Spec should not execute disabled "it" example'); | ||
test_todo('Test::Spec should not execute disabled "they" example'); | ||
test_passed('Test::Spec should execute enabled "it" example'); | ||
test_passed('Test::Spec should execute enabled "they" example'); | ||
|
||
done_testing(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env perl | ||
# | ||
# disabled.t | ||
# | ||
# Disabled specs. | ||
# | ||
######################################################################## | ||
# | ||
|
||
package Testcase::Spec::Disabled; | ||
use Test::Spec; | ||
|
||
describe 'Test::Spec' => sub { | ||
xdescribe 'disabled spec' => sub { | ||
it 'should not execute "it" examples' => sub { | ||
fail; | ||
}; | ||
they 'should not execute "they" examples' => sub { | ||
fail; | ||
}; | ||
}; | ||
|
||
xit 'should not execute disabled "it" example' => sub { | ||
fail; | ||
}; | ||
|
||
xthey 'should not execute disabled "they" example' => sub { | ||
fail; | ||
}; | ||
|
||
it 'should execute enabled "it" example' => sub { | ||
pass; | ||
}; | ||
they 'should execute enabled "they" example' => sub { | ||
pass; | ||
}; | ||
}; | ||
|
||
runtests unless caller; |