/[suikacvs]/www/test/dom/document/header/mktest.pl
Suika

Contents of /www/test/dom/document/header/mktest.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Sun Jun 17 01:03:24 2007 UTC (17 years, 10 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
See <http://suika.fam.cx/gate/2005/sw/xmlVersion>, <http://suika.fam.cx/gate/2005/sw/xmlStandalone>, and <http://suika.fam.cx/gate/2005/sw/xmlEncoding>; note that all files other than mktest.pl are generated by mktest.pl

1 wakaba 1.1 #!/usr/bin/perl
2     use strict;
3    
4     my $html_header = q[<!DOCTYPE html><html>];
5     my $xhtml_header = q[<html xmlns="http://www.w3.org/1999/xhtml">];
6    
7     my @type = ({id => 'noxml.html', header => $html_header},
8     {id => 'noxml.xhtml', header => $xhtml_header});
9     for my $xv (
10     [noversion => ''],
11     ['v10' => ' version="1.0"'],
12     ['v11' => ' version="1.1"'],
13     [unknownversion1 => ' version="unKnown"'],
14     [unknownversion2 => ' version="unknown"'],
15     [illegalversion => qq[ version="\x{4E00}"]],
16     ) {
17     for my $xe (
18     [noenc => '', ''],
19     [httpenc1 => ' encoding="iso-2022-JP"', '.jis'],
20     [httpenc2 => ' encoding="iso-2022-jp"', '.jis'],
21     [incorrectenc => ' encoding="utf-16"', ''],
22     [unknownenc => ' encoding="unknown-encoding-name"', ''],
23     [illegalenc => qq[ encoding="\x{4E00}"], ''],
24     ) {
25     for my $xs (
26     [nosa => '', ''],
27     [sayes1 => ' standalone="yes"', ''],
28     [sayes2 => ' standalone="Yes"', ''],
29     [sayesinvalid => ' standalone="yes"',
30     '<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'],
31     [sano1 => ' standalone="no"',
32     '<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'],
33     [sano2 => ' standalone="nO"',
34     '<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'],
35     [sanoinvalid => ' standalone="no"', ''],
36     ) {
37     push @type, {id => qq[xml-$xv->[0]-$xe->[0]-$xs->[0].html$xe->[2]],
38     header => qq[<?xml$xv->[1]$xe->[1]$xs->[1]?>$xs->[2]$xhtml_header]};
39     push @type, {id => qq[xml-$xv->[0]-$xe->[0]-$xs->[0].xhtml$xe->[2]],
40     header => qq[<?xml$xv->[1]$xe->[1]$xs->[1]?>$xs->[2]$xhtml_header]};
41     }
42     }
43     }
44    
45     for my $prop (
46     {id => 'xml-version', name => 'xmlVersion'},
47     {id => 'xml-encoding', name => 'xmlEncoding'},
48     {id => 'xml-standalone', name => 'xmlStandalone'},
49     ) {
50     for my $type (@type) {
51     my $file_name = qq[$prop->{id}/get-$type->{id}];
52     warn $file_name, "\n";
53     open my $file, '>:encoding(iso-2022-jp)', $file_name
54     or die "$0: $file_name: $!";
55     print $file qq[$type->{header}<head>
56     <title>document.$prop->{name} Get</title>
57     <script src="../../../../support/result.js"></script>
58     </head>
59     <body>
60     <p id="result" class="FAIL">FAIL (not executed)</p>
61     <script> setResult ('result', document.$prop->{name}) </script>
62     </body>
63     </html>];
64     }
65     }
66    
67     for my $type (
68     {id => '.html', header => $html_header,
69     original_value => 'null'},
70     {id => '-noxml.xhtml', header => $xhtml_header,
71     original_value => '"1.0"'},
72     {id => '-xml10.xhtml',
73     header => '<?xml version="1.0"?>'.$xhtml_header,
74     original_value => '"1.0"'},
75     {id => '-xml11.xhtml',
76     header => '<?xml version="1.1"?>'.$xhtml_header,
77     original_value => '"1.1"'},
78     ) {
79     for my $new_value (
80     {id => 'null', new_value => 'null'},
81     {id => 'undefined', new_value => 'undefined'},
82     {id => 'empty', new_value => '""'},
83     {id => 'num1', new_value => '1.0'},
84     {id => 'num11', new_value => '1.1'},
85     {id => 'str10', new_value => '"1.0"'},
86     {id => 'str11', new_value => '"1.1"'},
87     {id => 'unknown', new_value => '"unknown"'},
88     {id => 'illegal', new_value => '"\1"'},
89     ) {
90     my $file_name = qq[xml-version/set-$new_value->{id}$type->{id}];
91     warn $file_name, "\n";
92     open my $file, '>', $file_name or die "$0: $file_name: $!";
93     print $file qq[$type->{header}<head>
94     <title>document.xmlVersion = $new_value->{new_value}</title>
95     <script src="../../../../support/result.js"></script>
96     </head>
97     <body>
98     <p id="result" class="FAIL">FAIL (not executed)</p>
99     <script>
100     var result = document.getElementById ('result');
101     result.firstChild.data = 'FAIL (script error)';
102     if (document.xmlVersion === $type->{original_value}) {
103     try {
104     document.xmlVersion = $new_value->{new_value};
105     var xv = document.xmlVersion;
106     if (xv === $new_value->{new_value}) {
107     result.firstChild.data = 'new value';
108     result.className = 'see-detail';
109     } else if (xv === $type->{original_value}) {
110     result.firstChild.data = 'original value';
111     result.className = 'see-detail';
112     } else {
113     setResult ('result', xv);
114     }
115     } catch (e) {
116     result.firstChild.data = e.toString ();
117     result.className = 'see-detail';
118     }
119     } else {
120     result.firstChild.data = 'N/A';
121     result.className = 'NA';
122     }
123     </script>
124     </body>
125     </html>];
126     }
127     }
128    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24