File: CSSValueList.t

package info (click to toggle)
libcss-dom-perl 0.17-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,044 kB
  • sloc: perl: 7,310; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 930 bytes parent folder | download
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
#!/usr/bin/perl -T

use strict; use warnings;
our $tests;
BEGIN { ++$INC{'tests.pm'} }
sub tests::VERSION { $tests += pop };
use Test::More;
plan tests => $tests;

use CSS::DOM::Constants ':primitive';
use CSS::DOM::Value::List;

use tests 1; # DOES
ok +CSS::DOM::Value::List->DOES('CSS::DOM::Value'), 'DOES';

my $v = new CSS::DOM::Value::List values => [
 [ type => CSS_STRING, value => 'sphed' ],
 [ type => CSS_STRING, value => 'flit' ],
];

use tests 3; # item
isa_ok $v->item(0), "CSS::DOM::Value::Primitive", "retval of item";
like $v->item(0)->cssText, qr/^(['"])sphed\1\z/,
  'which item item(0) returns';
like $v->item(1)->cssText, qr/^(['"])flit\1\z/,
  'which item item(1) returns';

use tests 1; # length
is $v->length, 2, 'length';

use tests 3; # @{}
is @$v, 2, '@{ value list }';
like $v->[0]->cssText, qr/^(['"])sphed\1\z/,
  'value list ->[0]';
like $v->[01]->cssText, qr/^(['"])flit\1\z/,
  'value list ->[1]';