File: disabled.t

package info (click to toggle)
libtest-spec-perl 0.45-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 252 kB
  • sloc: perl: 2,050; makefile: 2
file content (41 lines) | stat: -rwxr-xr-x 1,148 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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();