File: new_multiple.t

package info (click to toggle)
libconfigreader-simple-perl 1.28-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 212 kB
  • ctags: 27
  • sloc: perl: 696; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,441 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl
use strict;
use warnings;

use Test::More 'no_plan';

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
my $class  = 'ConfigReader::Simple';
my $method = 'new_multiple';

use_ok( $class );
can_ok( $class, $method );

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Test with no arguments
{
my $rc = eval{ $class->$method() }; 
my $at = $@;
ok( length $at, "eval fails with no arguments" );
like( $at, qr/must be an array reference/, 
	"reports that it must be an array ref" );
like( $at, qr/Files/, 
	"reports that Files is the problem" );
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Test with Files argument which is not an array ref
{
my $rc = eval{ $class->$method( Files => 'a b c' ) }; 
my $at = $@;
ok( length $at, "eval fails with no arguments" );
like( $at, qr/must be an array reference/, 
	"reports that it must be an array ref" );
like( $at, qr/Files/, 
	"reports that Files is the problem" );
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Test with Files arguments which is an array ref, Keys that isn't
{
my $rc = eval{ $class->$method( Files => [], Keys => 'a b c' ) }; 
my $at = $@;
ok( length $at, "eval fails with no arguments" );
like( $at, qr/must be an array reference/, 
	"reports that it must be an array ref" );
like( $at, qr/Keys/, 
	"reports that Keys is the problem" );
}