Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -16,6 +16,7 @@ |
17 | 17 | # cat add category links |
18 | 18 | # ill add inter-language links |
19 | 19 | # subpage enable subpages (disabled by default) |
| 20 | +# noxml don't check for XML well formdness |
20 | 21 | # title=[[XXX]] run test using article title XXX |
21 | 22 | # disabled do not run test |
22 | 23 | # |
— | — | @@ -218,6 +219,51 @@ |
219 | 220 | </p> |
220 | 221 | !! end |
221 | 222 | |
| 223 | +!! test |
| 224 | +Comment whitespace |
| 225 | +!! input |
| 226 | +<!-- returns a single newline, not nothing, since the newline after > is not stripped --> |
| 227 | +!! result |
| 228 | + |
| 229 | +!! end |
| 230 | + |
| 231 | +!! test |
| 232 | +Comment semantics and delimiters |
| 233 | +!! input |
| 234 | +<!-- --><!----><!-----><!------> |
| 235 | +!! result |
| 236 | + |
| 237 | +!! end |
| 238 | + |
| 239 | +!! test |
| 240 | +Comment semantics and delimiters, redux |
| 241 | +!! input |
| 242 | +<!-- In SGML every "foo" here would actually show up in the text -- foo -- bar |
| 243 | +-- foo -- funky huh? ... --> |
| 244 | +!! result |
| 245 | + |
| 246 | +!! end |
| 247 | + |
| 248 | +!! test |
| 249 | +Comment semantics and delimiters: directors cut |
| 250 | +!! input |
| 251 | +<!-- ... However we're purely an XML shop you see, so we eat everything |
| 252 | +starting with < followed by !-- until the first -- and > we see, observe: -->--> |
| 253 | +!! result |
| 254 | +<p>--> |
| 255 | +</p> |
| 256 | +!! end |
| 257 | + |
| 258 | +!! test |
| 259 | +Comment semantics: nesting |
| 260 | +!! input |
| 261 | +<!--<!-- no, we're not going to do anything fancy here -->--> |
| 262 | +!! result |
| 263 | +<p>--> |
| 264 | +</p> |
| 265 | +!! end |
| 266 | + |
| 267 | + |
222 | 268 | ### |
223 | 269 | ### Preformatted text |
224 | 270 | ### |
— | — | @@ -1014,6 +1060,24 @@ |
1015 | 1061 | !!end |
1016 | 1062 | |
1017 | 1063 | !! test |
| 1064 | +Link containing "#<" and "#>" % as a hex sequences |
| 1065 | +!! input |
| 1066 | +[[%23%3c]]<!-- Render this as "[[#%3c]]" maybe.. ? -->[[%23%3e]]<!-- ..."[[#%3e]]" ? --> |
| 1067 | +!! result |
| 1068 | +<p>[[%23%3c]][[%23%3e]] |
| 1069 | +</p> |
| 1070 | +!! end |
| 1071 | + |
| 1072 | +!! test |
| 1073 | +Link containing "<#" and ">#" as a hex sequences |
| 1074 | +!! input |
| 1075 | +[[%3c%23]][[%3e%23]] |
| 1076 | +!! result |
| 1077 | +<p>[[%3c%23]][[%3e%23]] |
| 1078 | +</p> |
| 1079 | +!! end |
| 1080 | + |
| 1081 | +!! test |
1018 | 1082 | Plain link to URL |
1019 | 1083 | !! input |
1020 | 1084 | [[http://www.example.org]] |
— | — | @@ -2778,6 +2842,7 @@ |
2779 | 2843 | |
2780 | 2844 | !! end |
2781 | 2845 | |
| 2846 | + |
2782 | 2847 | !! test |
2783 | 2848 | Bug 2304: HTML attribute safety (ISBN) |
2784 | 2849 | !! input |
— | — | @@ -2841,7 +2906,6 @@ |
2842 | 2907 | |
2843 | 2908 | !! end |
2844 | 2909 | |
2845 | | - |
2846 | 2910 | !! test |
2847 | 2911 | Math section safety when disabled |
2848 | 2912 | !! input |
— | — | @@ -2851,8 +2915,46 @@ |
2852 | 2916 | </p> |
2853 | 2917 | !! end |
2854 | 2918 | |
| 2919 | +# More MSIE fun discovered by Tom Gilder |
2855 | 2920 | |
2856 | 2921 | !! test |
| 2922 | +MSIE CSS safety test: spurious slash |
| 2923 | +!! input |
| 2924 | +<div style="background-image:u\rl(javascript:alert('boo'))">evil</div> |
| 2925 | +!! result |
| 2926 | +<div>evil</div> |
| 2927 | + |
| 2928 | +!! end |
| 2929 | + |
| 2930 | +!! test |
| 2931 | +MSIE CSS safety test: hex code |
| 2932 | +!! input |
| 2933 | +<div style="background-image:u\72l(javascript:alert('boo'))">evil</div> |
| 2934 | +!! result |
| 2935 | +<div>evil</div> |
| 2936 | + |
| 2937 | +!! end |
| 2938 | + |
| 2939 | +!! test |
| 2940 | +MSIE CSS safety test: comment in url |
| 2941 | +!! input |
| 2942 | +<div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div> |
| 2943 | +!! result |
| 2944 | +<div style="background-image:u rl(javascript:alert('boo'))">evil</div> |
| 2945 | + |
| 2946 | +!! end |
| 2947 | + |
| 2948 | +!! test |
| 2949 | +MSIE CSS safety test: comment in expression |
| 2950 | +!! input |
| 2951 | +<div style="background-image:expres/**/sion(alert('boo4'))">evil4</div> |
| 2952 | +!! result |
| 2953 | +<div style="background-image:expres sion(alert('boo4'))">evil4</div> |
| 2954 | + |
| 2955 | +!! end |
| 2956 | + |
| 2957 | + |
| 2958 | +!! test |
2857 | 2959 | Table attribute legitimate extension |
2858 | 2960 | !! input |
2859 | 2961 | {| |
— | — | @@ -2881,46 +2983,107 @@ |
2882 | 2984 | !! end |
2883 | 2985 | |
2884 | 2986 | ### |
2885 | | -### Parser hooks |
| 2987 | +### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension) |
2886 | 2988 | ### |
2887 | 2989 | !! test |
2888 | 2990 | Parser hook: empty input |
2889 | 2991 | !! input |
2890 | 2992 | <tag></tag> |
2891 | 2993 | !! result |
| 2994 | +<pre> |
| 2995 | +string(0) "" |
| 2996 | +array(0) { |
| 2997 | +} |
| 2998 | +</pre> |
| 2999 | + |
2892 | 3000 | !! end |
2893 | 3001 | |
2894 | 3002 | !! test |
| 3003 | +Parser hook: empty input using terminated empty elements |
| 3004 | +!! input |
| 3005 | +<tag/> |
| 3006 | +!! result |
| 3007 | +<pre> |
| 3008 | +NULL |
| 3009 | +array(0) { |
| 3010 | +} |
| 3011 | +</pre> |
| 3012 | + |
| 3013 | +!! end |
| 3014 | + |
| 3015 | +!! test |
2895 | 3016 | Parser hook: basic input |
2896 | 3017 | !! input |
2897 | 3018 | <tag>input</tag> |
2898 | 3019 | !! result |
2899 | | -<p>input |
2900 | | -</p> |
| 3020 | +<pre> |
| 3021 | +string(5) "input" |
| 3022 | +array(0) { |
| 3023 | +} |
| 3024 | +</pre> |
| 3025 | + |
2901 | 3026 | !! end |
2902 | 3027 | |
| 3028 | + |
2903 | 3029 | !! test |
2904 | 3030 | Parser hook: case insensetive |
2905 | 3031 | !! input |
| 3032 | +<TAG>input</TAG> |
| 3033 | +!! result |
| 3034 | +<pre> |
| 3035 | +string(5) "input" |
| 3036 | +array(0) { |
| 3037 | +} |
| 3038 | +</pre> |
| 3039 | + |
| 3040 | +!! end |
| 3041 | + |
| 3042 | + |
| 3043 | +!! test |
| 3044 | +Parser hook: case insensetive, redux |
| 3045 | +!! input |
2906 | 3046 | <TaG>input</TAg> |
2907 | 3047 | !! result |
2908 | | -<p>input |
2909 | | -</p> |
| 3048 | +<pre> |
| 3049 | +string(5) "input" |
| 3050 | +array(0) { |
| 3051 | +} |
| 3052 | +</pre> |
| 3053 | + |
2910 | 3054 | !! end |
2911 | 3055 | |
2912 | 3056 | !! test |
| 3057 | +Parser hook: nested tags |
| 3058 | +!! options |
| 3059 | +noxml |
| 3060 | +!! input |
| 3061 | +<tag><tag></tag></tag> |
| 3062 | +!! result |
| 3063 | +<pre> |
| 3064 | +string(5) "<tag>" |
| 3065 | +array(0) { |
| 3066 | +} |
| 3067 | +</pre></tag> |
| 3068 | + |
| 3069 | +!! end |
| 3070 | + |
| 3071 | +!! test |
2913 | 3072 | Parser hook: basic arguments |
2914 | 3073 | !! input |
2915 | 3074 | <tag width=200 height = "100" depth = '50' square></tag> |
2916 | 3075 | !! result |
2917 | 3076 | <pre> |
2918 | | -Array |
2919 | | -( |
2920 | | - [width] => 200 |
2921 | | - [height] => 100 |
2922 | | - [depth] => 50 |
2923 | | - [square] => square |
2924 | | -) |
| 3077 | +string(0) "" |
| 3078 | +array(4) { |
| 3079 | + ["width"]=> |
| 3080 | + string(3) "200" |
| 3081 | + ["height"]=> |
| 3082 | + string(3) "100" |
| 3083 | + ["depth"]=> |
| 3084 | + string(2) "50" |
| 3085 | + ["square"]=> |
| 3086 | + string(6) "square" |
| 3087 | +} |
2925 | 3088 | </pre> |
2926 | 3089 | |
2927 | 3090 | !! end |
— | — | @@ -2931,12 +3094,13 @@ |
2932 | 3095 | <tag foo=bar/>text |
2933 | 3096 | !! result |
2934 | 3097 | <pre> |
2935 | | -Array |
2936 | | -( |
2937 | | - [foo] => bar |
2938 | | -) |
2939 | | -</pre> |
2940 | | -text |
| 3098 | +NULL |
| 3099 | +array(1) { |
| 3100 | + ["foo"]=> |
| 3101 | + string(3) "bar" |
| 3102 | +} |
| 3103 | +</pre>text |
| 3104 | + |
2941 | 3105 | !! end |
2942 | 3106 | |
2943 | 3107 | # </tag> should be output literally since there is no matching tag that begins it |
— | — | @@ -2948,17 +3112,21 @@ |
2949 | 3113 | </tag> |
2950 | 3114 | !! result |
2951 | 3115 | <pre> |
2952 | | -Array |
2953 | | -( |
2954 | | - [width] => 200 |
2955 | | - [height] => 100 |
2956 | | - [depth] => 50 |
2957 | | - [square] => square |
2958 | | -) |
| 3116 | +NULL |
| 3117 | +array(4) { |
| 3118 | + ["width"]=> |
| 3119 | + string(3) "200" |
| 3120 | + ["height"]=> |
| 3121 | + string(3) "100" |
| 3122 | + ["depth"]=> |
| 3123 | + string(2) "50" |
| 3124 | + ["square"]=> |
| 3125 | + string(6) "square" |
| 3126 | +} |
2959 | 3127 | </pre> |
2960 | | -other stuff |
2961 | | -</tag> |
2962 | | - |
| 3128 | +<p>other stuff |
| 3129 | +</tag> |
| 3130 | +</p> |
2963 | 3131 | !! end |
2964 | 3132 | |
2965 | 3133 | |
— | — | @@ -2987,44 +3155,6 @@ |
2988 | 3156 | !! end |
2989 | 3157 | |
2990 | 3158 | |
2991 | | -# More MSIE fun discovered by Tom Gilder |
2992 | | - |
2993 | | -!! test |
2994 | | -MSIE CSS safety test: spurious slash |
2995 | | -!! input |
2996 | | -<div style="background-image:u\rl(javascript:alert('boo'))">evil</div> |
2997 | | -!! result |
2998 | | -<div>evil</div> |
2999 | | - |
3000 | | -!! end |
3001 | | - |
3002 | | -!! test |
3003 | | -MSIE CSS safety test: hex code |
3004 | | -!! input |
3005 | | -<div style="background-image:u\72l(javascript:alert('boo'))">evil</div> |
3006 | | -!! result |
3007 | | -<div>evil</div> |
3008 | | - |
3009 | | -!! end |
3010 | | - |
3011 | | -!! test |
3012 | | -MSIE CSS safety test: comment in url |
3013 | | -!! input |
3014 | | -<div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div> |
3015 | | -!! result |
3016 | | -<div style="background-image:u rl(javascript:alert('boo'))">evil</div> |
3017 | | - |
3018 | | -!! end |
3019 | | - |
3020 | | -!! test |
3021 | | -MSIE CSS safety test: comment in expression |
3022 | | -!! input |
3023 | | -<div style="background-image:expres/**/sion(alert('boo4'))">evil4</div> |
3024 | | -!! result |
3025 | | -<div style="background-image:expres sion(alert('boo4'))">evil4</div> |
3026 | | - |
3027 | | -!! end |
3028 | | - |
3029 | 3159 | ### |
3030 | 3160 | ### Sanitizer |
3031 | 3161 | ### |