Add fuzz test for the Syntax Highlighting extension, as per Tim's request for comment...
authorNick Jenkins <nickj@users.mediawiki.org>
Tue, 10 Apr 2007 09:10:02 +0000 (09:10 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Tue, 10 Apr 2007 09:10:02 +0000 (09:10 +0000)
Invoke this specific test with:
php fuzz-tester.php --specific-test=GeSHi_Test

maintenance/fuzz-tester.php

index 00f66c1..4e90d52 100644 (file)
@@ -2160,6 +2160,48 @@ class api extends pageTest {
 }
 
 
+/**
+ ** a page test for the GeSHi extension.
+ */
+class GeSHi_Test extends pageTest {
+       
+       private function getGeSHiContent()       {
+               return "<source lang=\"" . $this->getLang() . "\" "
+                      . (wikiFuzz::randnum(2) == 0 ? "line " : "")
+                      . (wikiFuzz::randnum(2) == 0 ? "strict " : "")
+                          . "start=" . wikiFuzz::chooseInput( array(wikiFuzz::randnum(-6000,6000), wikifuzz::makeFuzz(2)) )
+                          . ">"
+                      . wikiFuzz::makeFuzz(2)
+                      . "</source>";
+       }
+       
+       private function getLang() {
+               return wikiFuzz::chooseInput( array( "actionscript", "ada", "apache", "applescript", "asm", "asp", "autoit", "bash", "blitzbasic", "bnf", "c", "c_mac", "caddcl", "cadlisp", "cfdg", "cfm", "cpp", "cpp-qt", 
+               "csharp", "css", "d", "delphi", "diff", "div", "dos", "eiffel", "fortran", "freebasic", "gml", "groovy", "html4strict", "idl", "ini", "inno", "io", "java", "java5",
+               "javascript", "latex", "lisp", "lua", "matlab", "mirc", "mpasm", "mysql", "nsis", "objc", "ocaml", "ocaml-brief", "oobas", "oracle8", "pascal", "perl", "php",
+               "php-brief", "plsql", "python", "qbasic", "rails", "reg", "robots", "ruby", "sas", "scheme", "sdlbasic", "smalltalk", "smarty", "sql", "tcl", "text", "thinbasic",
+               "tsql", "vb", "vbnet", "vhdl", "visualfoxpro", "winbatch", "xml", "xpp", "z80", wikifuzz::makeFuzz(1) ) );
+       }
+       
+    function __construct() {
+        $this->pagePath = "index.php?title=WIKIFUZZ";
+
+        $this->params = array (
+                "action"        => "submit",
+                "wpMinoredit"   => "test",
+                "wpPreview"     => "test",
+                "wpSection"     => "test",
+                "wpEdittime"    => "test",
+                "wpSummary"     => "test",
+                "wpScrolltop"   => "test",
+                "wpStarttime"   => "test",
+                "wpAutoSummary" => "test",
+                "wpTextbox1"    => $this->getGeSHiContent() // the main wiki text, contains fake GeSHi content.
+                );
+    }
+}
+
+
 /**
  ** selects a page test to run.
  */