From dd92d82b111f388fe16091939c704dfcfa4c561f Mon Sep 17 00:00:00 2001 From: Wil Mahan Date: Wed, 22 Sep 2004 21:22:51 +0000 Subject: [PATCH] Remove the comment check I added (wasn't necessary); add a way do disable tests. Add nowiki, comment, and external links tests (some disabled at the moment). --- maintenance/parserTests.php | 10 ++- maintenance/parserTests.txt | 162 ++++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+), 4 deletions(-) diff --git a/maintenance/parserTests.php b/maintenance/parserTests.php index c17f9995b3..3726d65bb3 100644 --- a/maintenance/parserTests.php +++ b/maintenance/parserTests.php @@ -25,13 +25,15 @@ class ParserTest { $n = 0; while( false !== ($line = fgets( $infile ) ) ) { $n++; - if (is_null($section) && preg_match('/^#/', $line)) { - # skip comment - continue; - } if( preg_match( '/^!!\s*(\w+)/', $line, $matches ) ) { $section = strtolower( $matches[1] ); if( $section == 'end' ) { + if (isset ($data['disabled'])) { + # disabled test + $data = array(); + $section = null; + continue; + } if( !isset( $data['test'] ) ) { die( "'end' without 'test' at line $n\n" ); } diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index d6c8e62976..7107def334 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1,3 +1,9 @@ +# MediaWiki Parser test cases +# see also http://meta.wikimedia.org/wiki/Parser_testing + +# At present these assume that $wgUseTidy is false and may break +# if it is enabled. + !! test Blank input !! input @@ -58,3 +64,159 @@ Italics and bold
  • plain l'italicplain
  • !! end + +### +### test cases +### + +!! test + unordered list +!! input +* This is not an unordered list item. +!! result +

    * This is not an unordered list item. +

    +!! end + +!! test + spacing +!! input +Lorem ipsum dolor + +sed abit. + sed nullum. + +:and a colon + +!! result +

    Lorem ipsum dolor sed abit. sed nullum. :and a colon

    +!! end + +!! test +nowiki 3 +!! input +:There is not nowiki. +:There is nowiki. + +#There is not nowiki. +#There is nowiki. + +*There is not nowiki. +*There is nowiki. +!! result +
    There is not nowiki. +
    There is nowiki. +
    +
    1. There is not nowiki. +
    2. There is nowiki. +
    +
    • There is not nowiki. +
    • There is nowiki. +
    +!! end + +### +### comment test cases +### +!! test +comment test 1 +!! input + asdf + +!! result +
    asdf
    +
    +!! end + +!! test +!! disabled +comment test 2 +!! input +asdf + +jkl +!! result +

    asdf jkl +

    +!! end + +!! test +comment test 3 +!! disabled +!! input +asdf + + +jkl +!! result +

    asdf jkl +

    +!! end + +!! test +comment test 4 +!! input +asdfjkl +!! result +

    asdfjkl +

    +!! end + +### +### External links +### +!! test +External links 1 +!! input +Non-bracketed: http://example.com +!! result +

    Non-bracketed: http://example.com +

    +!! end + +!! test +!! disabled +External links +!! input +Numbered: [http://example.com] +Specified text: [http://example.com link] +Trail (not sure if this is meant to work): [http://example.com link]s +Unrecognised characters (for no good reason): http://example.com/1$2345 [http://example.com/1$2345] +External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +Link to non-http image, no img tag: ftp://example.com/test.jpg +Terminating separator: http://example.com/thing, +Intervening separator: http://example.com/1,2,3 +Old bug with URL in query: [http://example.com/thing?url=http://example.com link] +And again with mixed protocols: [ftp://example.com?url=http://example.com link] +URL in text: [http://example.com http://example.com] +ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] +Old & use: http://x&y +Escaping without &: http://x&y +!! result +

    Numbered: [2] (http://example.com)

    +

    Specified text: link (http://example.com)

    +

    Trail (not sure if this is meant to work): link (http://example.com)s

    +

    Unrecognised characters (for no good reason): http://example.com/1$2345 +[http://example.com/1$2345]

    +

    External image: test.jpg

    +

    External image from https: test.jpg

    +

    Link to non-http image, no img tag: ftp://example.com/test.jpg

    +

    Terminating separator: http://example.com/thing,

    +

    Intervening separator: http://example.com/1,2,3

    +

    Old bug with URL in query: [http://example.com/thing?url=http://example.com +link]

    +

    And again with mixed protocols: [ftp://example.com?url=http://example.com +link]

    +

    URL in text: http://example.com (http://example.com)

    +

    ja-style clickable images: Ncwikicol.png (http://example.com)

    +

    Old & use: http://x&y

    +

    Escaping without &: http://x&y

    +!! end + -- 2.20.1