/[suikacvs]/markup/html/whatpm/t/HTML-tokenizer.t
Suika

Diff of /markup/html/whatpm/t/HTML-tokenizer.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by wakaba, Sat Jul 21 05:36:50 2007 UTC revision 1.23 by wakaba, Sun Mar 2 14:41:28 2008 UTC
# Line 24  BEGIN { Line 24  BEGIN {
24  }  }
25    
26  use Test;  use Test;
27  BEGIN { plan tests => 337 }  BEGIN { plan tests => 416 }
28    
29  use Data::Dumper;  use Data::Dumper;
30  $Data::Dumper::Useqq = 1;  $Data::Dumper::Useqq = 1;
# Line 123  for my $file_name (grep {$_} split /\s+/ Line 123  for my $file_name (grep {$_} split /\s+/
123    
124        while (1) {        while (1) {
125          my $token = $p->_get_next_token;          my $token = $p->_get_next_token;
126          last if $token->{type} eq 'end-of-file';          last if $token->{type} == Whatpm::HTML::END_OF_FILE_TOKEN ();
127                    
128          my $test_token = [          my $test_token = [
129           {           {
130            DOCTYPE => 'DOCTYPE',            Whatpm::HTML::DOCTYPE_TOKEN () => 'DOCTYPE',
131            'start tag' => 'StartTag',            Whatpm::HTML::START_TAG_TOKEN () => 'StartTag',
132            'end tag' => 'EndTag',            Whatpm::HTML::END_TAG_TOKEN () => 'EndTag',
133            comment => 'Comment',            Whatpm::HTML::COMMENT_TOKEN () => 'Comment',
134            character => 'Character',            Whatpm::HTML::CHARACTER_TOKEN () => 'Character',
135           }->{$token->{type}} || $token->{type},           }->{$token->{type}} || $token->{type},
136          ];          ];
137          $test_token->[1] = $token->{tag_name} if defined $token->{tag_name};          $test_token->[1] = $token->{tag_name} if defined $token->{tag_name};
138          $test_token->[1] = $token->{data} if defined $token->{data};          $test_token->[1] = $token->{data} if defined $token->{data};
139          if ($token->{type} eq 'start tag') {          if ($token->{type} == Whatpm::HTML::START_TAG_TOKEN ()) {
140            $test_token->[2] = {map {$_->{name} => $_->{value}} values %{$token->{attributes}}};            $test_token->[2] = {map {$_->{name} => $_->{value}} values %{$token->{attributes}}};
141          } elsif ($token->{type} eq 'DOCTYPE') {          } elsif ($token->{type} == Whatpm::HTML::DOCTYPE_TOKEN ()) {
142            $test_token->[1] = $token->{name};            $test_token->[1] = $token->{name};
143            $test_token->[2] = $token->{public_identifier};            $test_token->[2] = $token->{public_identifier};
144            $test_token->[3] = $token->{system_identifier};            $test_token->[3] = $token->{system_identifier};
# Line 161  for my $file_name (grep {$_} split /\s+/ Line 161  for my $file_name (grep {$_} split /\s+/
161    }    }
162  }  }
163    
164    ## License: Public Domain.
165  ## $Date$  ## $Date$

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24