File: 09_regression.t

package info (click to toggle)
libtest-inline-perl 2.214-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 596 kB
  • sloc: perl: 2,016; makefile: 2
file content (82 lines) | stat: -rw-r--r-- 1,640 bytes parent folder | download | duplicates (4)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/perl

# Regression testing for rt.cpan.org

use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use File::Spec::Functions ':ALL';
use Test::More tests => 7;
use Test::Inline ();





# Change to the correct directory
chdir catdir( 't', 'data', '09_regression' ) or die "Failed to change to test directory";





#####################################################################
# Regression tests for rt.cpan.org bug #557
# (Test::Inline doesn't catch improper nesting)

{
	# Create basic Test::Inline object
	my $Inline = My::Inline->new();
	isa_ok( $Inline, 'Test::Inline' );

	my @errors = '';

	# Add the files
	my $rv = $Inline->add( 'My/BadPodNesting.pm' );
	is( $rv, undef, 'Adding bad file returns undef' );
	is_deeply( \@errors, [ 
		'Failed to parse sections: Test::Inline::Section: POD statement \'=begin testing bar\' illegally nested inside of section \'=begin testing foo\''
		],
		'Bad nesting error is triggered as expected' );

	package My::Inline;
	
	use base 'Test::Inline';

	sub _error {
		shift;
		@errors = @_;
		undef;
	}

	1;
}




#####################################################################
# Regression tests for anonymous bug
# "=begin testing SETUP after DDS::Info 1" is not a setup section

{
	my $POD = <<'END_POD';
=begin testing SETUP after DDS::Info 1

# This is ok
ok( 1, 'This is true' );

=end testing
END_POD

	# Create the Section
	my $Section = Test::Inline::Section->new( $POD );
	isa_ok( $Section, 'Test::Inline::Section' );

	ok( $Section->setup, 'Is a setup section' );
	ok( ! $Section->example, 'Is not an example section' );
	is( $Section->name, '', 'Does not have a name' );
}