17 |
ok(my $abs_path = abs_path($0), "abs_path"); |
ok(my $abs_path = abs_path($0), "abs_path"); |
18 |
$abs_path =~ s#/[^/]*$#/#; |
$abs_path =~ s#/[^/]*$#/#; |
19 |
|
|
|
my $validate_path = "$abs_path/data/validate_test"; |
|
|
$validate_path =~ s#//+#/#g; |
|
|
|
|
20 |
ok(my $v = new WebPAC::Validate( |
ok(my $v = new WebPAC::Validate( |
21 |
path => $validate_path, |
path => "$abs_path/data/validate_test_simple", |
22 |
debug => $debug, |
debug => $debug, |
23 |
), "new with path"); |
), "new with path"); |
24 |
|
|
25 |
ok($v->{rules}, "rules exist"); |
ok($v->{rules}, "rules exist"); |
26 |
|
|
27 |
is_deeply( $v->{rules}, { |
is_deeply( $v->{rules}, { |
28 |
'900' => 1, |
'900' => [ 'a', 'b', 'c', 'd' ], |
29 |
'901' => [ 'a' ], |
}, 'simple rules parsed'); |
|
'902' => [ 'b', 'c' ], |
|
|
'903' => [ 'a', 'b', 'c' ], |
|
|
'904' => [ 'a' ], |
|
|
'905' => [ 'a*' ], |
|
|
}, 'rules parsed'); |
|
30 |
|
|
31 |
ok($v = new WebPAC::Validate( |
ok($v = new WebPAC::Validate( |
32 |
debug => $debug, |
debug => $debug, |
34 |
|
|
35 |
ok( ! $v->{rules}, 'no path' ); |
ok( ! $v->{rules}, 'no path' ); |
36 |
|
|
37 |
ok( $v->read_validate_file( $validate_path ), "read_validate_file( $validate_path )" ); |
ok( $v->read_validate_file( "$abs_path/data/validate_test" ), "read_validate_file" ); |
38 |
|
|
39 |
ok($v->{rules}, "rules exist"); |
ok($v->{rules}, "rules exist"); |
40 |
|
|