File: harness_parse

package info (click to toggle)
libcss-perl 1.09-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 980 kB
  • sloc: perl: 13,716; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 959 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
use Test::Simple tests => 8;

use CSS;
my $css = new CSS({'parser' => $::PARSER});
ok(1, "Created the CSS object ok");

#
# SIMPLE TESTS
#

$css->read_file("t/css_simple");
ok(1, "Parsed the simple file ok");

ok(scalar(@{$css->{styles}}) == 3, "Correct number of rulesets");

#
# PURGE TEST
#

$css->purge();
ok(scalar(@{$css->{styles}}) == 0, "CSS::purge() worked");

#
# SELECTOR GROUPS
#

$css->read_file("t/css_selector_groups");
my $is_ok = 1;
my @selector_counts = (1,2,2,2,2,2,2,2,3,3);
ok(scalar(@{$css->{styles}}) == 10, "Correct number of rulesets");
for(@{$css->{styles}}){
	$is_ok = 0 if (scalar(@{$_->{selectors}}) != shift @selector_counts);
}
ok($is_ok, "Correct number of selectors parsed");

#
# test for odd rules
#

$css->purge();
$css->read_file("t/css_oddities");
my @props = @{$css->{styles}->[0]->{properties}};
ok($props[0]->{simple_value} eq 'a', "first property ok");
ok($props[1]->{simple_value} eq '0', "second property ok");

1;