From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- tests/RunSeleniumTests.php | 258 - tests/TestsAutoLoader.php | 30 +- tests/parser/ParserTestResult.php | 42 + tests/parser/parserTest.inc | 274 +- tests/parser/parserTests.txt | 9493 +++++++++++++++----- .../parser/preprocess/All_system_messages.expected | 21 - tests/parser/preprocess/All_system_messages.txt | 21 - tests/parserTests.php | 8 +- tests/phpunit/AutoLoaderTest.php | 51 - tests/phpunit/MediaWikiLangTestCase.php | 4 + tests/phpunit/MediaWikiPHPUnitCommand.php | 22 +- tests/phpunit/MediaWikiPHPUnitTestListener.php | 114 + tests/phpunit/MediaWikiTestCase.php | 32 +- tests/phpunit/StructureTest.php | 63 - tests/phpunit/bootstrap.php | 19 +- tests/phpunit/data/db/sqlite/tables-1.16.sql | 5 - tests/phpunit/data/db/sqlite/tables-1.17.sql | 5 - tests/phpunit/data/db/sqlite/tables-1.18.sql | 5 - .../data/less/common/test.common.mixins.less | 5 + tests/phpunit/data/less/module/dependency.less | 3 + tests/phpunit/data/less/module/styles.css | 6 + tests/phpunit/data/less/module/styles.less | 6 + tests/phpunit/data/xmp/7.result.php | 18 +- tests/phpunit/includes/ArticleTablesTest.php | 7 +- tests/phpunit/includes/ArticleTest.php | 12 +- tests/phpunit/includes/BlockTest.php | 143 +- tests/phpunit/includes/CdbTest.php | 2 +- tests/phpunit/includes/CollationTest.php | 8 +- tests/phpunit/includes/DiffHistoryBlobTest.php | 9 +- tests/phpunit/includes/EditPageTest.php | 93 +- tests/phpunit/includes/ExternalStoreTest.php | 2 +- tests/phpunit/includes/ExtraParserTest.php | 27 +- tests/phpunit/includes/FallbackTest.php | 73 + tests/phpunit/includes/FauxRequestTest.php | 15 + tests/phpunit/includes/FauxResponseTest.php | 9 +- .../includes/FormOptionsInitializationTest.php | 1 - .../includes/GlobalFunctions/GlobalTest.php | 201 +- .../includes/GlobalFunctions/GlobalWithDBTest.php | 6 +- .../includes/GlobalFunctions/wfAssembleUrlTest.php | 7 +- .../includes/GlobalFunctions/wfBCP47Test.php | 20 +- .../includes/GlobalFunctions/wfBaseConvertTest.php | 3 +- .../includes/GlobalFunctions/wfBaseNameTest.php | 6 +- .../includes/GlobalFunctions/wfExpandUrlTest.php | 20 +- .../includes/GlobalFunctions/wfGetCallerTest.php | 15 +- .../includes/GlobalFunctions/wfParseUrlTest.php | 9 +- .../GlobalFunctions/wfRemoveDotSegmentsTest.php | 6 +- .../GlobalFunctions/wfShorthandToIntegerTest.php | 8 +- .../includes/GlobalFunctions/wfTimestampTest.php | 19 +- .../includes/GlobalFunctions/wfUrlencodeTest.php | 11 +- tests/phpunit/includes/HTMLCheckMatrixTest.php | 102 + tests/phpunit/includes/HashRingTest.php | 53 + tests/phpunit/includes/HooksTest.php | 171 +- tests/phpunit/includes/HtmlFormatterTest.php | 81 + tests/phpunit/includes/HtmlTest.php | 65 +- tests/phpunit/includes/HttpTest.php | 11 +- tests/phpunit/includes/IPTest.php | 78 +- tests/phpunit/includes/JsonTest.php | 27 - tests/phpunit/includes/LanguageConverterTest.php | 35 +- tests/phpunit/includes/LicensesTest.php | 2 +- tests/phpunit/includes/LinkerTest.php | 4 +- tests/phpunit/includes/LinksUpdateTest.php | 23 +- tests/phpunit/includes/LocalFileTest.php | 22 +- tests/phpunit/includes/MWExceptionHandlerTest.php | 73 + tests/phpunit/includes/MWFunctionTest.php | 47 +- tests/phpunit/includes/MWNamespaceTest.php | 21 +- tests/phpunit/includes/MessageTest.php | 78 +- tests/phpunit/includes/OutputPageTest.php | 73 +- tests/phpunit/includes/PathRouterTest.php | 36 +- tests/phpunit/includes/PreferencesTest.php | 23 +- tests/phpunit/includes/Providers.php | 44 - tests/phpunit/includes/RecentChangeTest.php | 34 +- tests/phpunit/includes/RequestContextTest.php | 8 +- tests/phpunit/includes/ResourceLoaderTest.php | 62 +- tests/phpunit/includes/RevisionStorageTest.php | 16 +- .../RevisionStorageTest_ContentHandlerUseDB.php | 20 +- tests/phpunit/includes/RevisionTest.php | 78 +- tests/phpunit/includes/SampleTest.php | 4 +- tests/phpunit/includes/SanitizerTest.php | 114 +- .../includes/SanitizerValidateEmailTest.php | 35 +- .../phpunit/includes/SeleniumConfigurationTest.php | 222 - tests/phpunit/includes/SiteConfigurationTest.php | 39 +- tests/phpunit/includes/StringUtilsTest.php | 166 +- tests/phpunit/includes/TemplateCategoriesTest.php | 24 +- tests/phpunit/includes/TestUser.php | 7 +- tests/phpunit/includes/TimeAdjustTest.php | 40 +- tests/phpunit/includes/TimestampTest.php | 264 +- tests/phpunit/includes/TitleMethodsTest.php | 20 +- tests/phpunit/includes/TitlePermissionTest.php | 142 +- tests/phpunit/includes/TitleTest.php | 194 +- tests/phpunit/includes/UIDGeneratorTest.php | 22 + tests/phpunit/includes/UserMailerTest.php | 14 + tests/phpunit/includes/UserTest.php | 20 + tests/phpunit/includes/WebRequestTest.php | 114 +- tests/phpunit/includes/WikiPageTest.php | 68 +- .../includes/WikiPageTest_ContentHandlerUseDB.php | 25 +- tests/phpunit/includes/XmlJsTest.php | 25 +- tests/phpunit/includes/XmlSelectTest.php | 39 +- tests/phpunit/includes/XmlTest.php | 132 +- tests/phpunit/includes/XmlTypeCheckTest.php | 30 + tests/phpunit/includes/ZipDirectoryReaderTest.php | 27 +- .../includes/api/ApiAccountCreationTest.php | 56 +- tests/phpunit/includes/api/ApiBlockTest.php | 21 +- tests/phpunit/includes/api/ApiEditPageTest.php | 107 +- tests/phpunit/includes/api/ApiOptionsTest.php | 38 +- tests/phpunit/includes/api/ApiParseTest.php | 5 +- tests/phpunit/includes/api/ApiPurgeTest.php | 3 +- tests/phpunit/includes/api/ApiTest.php | 47 +- tests/phpunit/includes/api/ApiTestCase.php | 40 +- tests/phpunit/includes/api/ApiTestCaseUpload.php | 4 +- tests/phpunit/includes/api/ApiUploadTest.php | 42 +- tests/phpunit/includes/api/ApiWatchTest.php | 55 +- .../phpunit/includes/api/RandomImageGenerator.php | 13 +- .../includes/api/format/ApiFormatPhpTest.php | 4 +- .../phpunit/includes/api/generateRandomImages.php | 6 +- .../includes/api/query/ApiQueryBasicTest.php | 77 +- .../includes/api/query/ApiQueryContinue2Test.php | 14 +- .../includes/api/query/ApiQueryContinueTest.php | 198 +- .../api/query/ApiQueryContinueTestBase.php | 62 +- .../includes/api/query/ApiQueryRevisionsTest.php | 2 +- tests/phpunit/includes/api/query/ApiQueryTest.php | 7 +- .../includes/api/query/ApiQueryTestBase.php | 15 +- tests/phpunit/includes/cache/GenderCacheTest.php | 9 +- tests/phpunit/includes/cache/MessageCacheTest.php | 128 + .../phpunit/includes/cache/ProcessCacheLRUTest.php | 24 +- .../includes/content/ContentHandlerTest.php | 99 +- tests/phpunit/includes/content/CssContentTest.php | 8 +- .../includes/content/JavaScriptContentTest.php | 20 +- tests/phpunit/includes/content/TextContentTest.php | 43 +- .../content/WikitextContentHandlerTest.php | 44 +- .../includes/content/WikitextContentTest.php | 24 +- .../phpunit/includes/db/DatabaseMysqlBaseTest.php | 209 + tests/phpunit/includes/db/DatabaseSQLTest.php | 633 +- tests/phpunit/includes/db/DatabaseSqliteTest.php | 46 +- tests/phpunit/includes/db/DatabaseTest.php | 62 +- tests/phpunit/includes/db/DatabaseTestHelper.php | 166 + tests/phpunit/includes/db/ORMRowTest.php | 1 + tests/phpunit/includes/db/ORMTableTest.php | 2 +- tests/phpunit/includes/db/TestORMRowTest.php | 52 +- tests/phpunit/includes/debug/MWDebugTest.php | 8 +- .../includes/filebackend/FileBackendTest.php | 251 +- tests/phpunit/includes/filerepo/FileRepoTest.php | 25 +- tests/phpunit/includes/filerepo/StoreBatchTest.php | 13 +- .../includes/installer/InstallDocFormatterTest.php | 7 +- .../includes/installer/OracleInstallerTest.php | 48 + tests/phpunit/includes/jobqueue/JobQueueTest.php | 129 +- tests/phpunit/includes/json/FormatJsonTest.php | 161 + tests/phpunit/includes/json/ServicesJsonTest.php | 93 - tests/phpunit/includes/libs/CSSJanusTest.php | 72 +- tests/phpunit/includes/libs/CSSMinTest.php | 12 +- .../includes/libs/GenericArrayObjectTest.php | 3 +- tests/phpunit/includes/libs/IEUrlExtensionTest.php | 30 +- .../includes/libs/JavaScriptMinifierTest.php | 8 +- .../includes/media/BitmapMetadataHandlerTest.php | 29 +- tests/phpunit/includes/media/BitmapScalingTest.php | 47 +- tests/phpunit/includes/media/ExifBitmapTest.php | 53 +- tests/phpunit/includes/media/ExifRotationTest.php | 49 +- tests/phpunit/includes/media/ExifTest.php | 12 +- tests/phpunit/includes/media/FakeDimensionFile.php | 28 + .../phpunit/includes/media/FormatMetadataTest.php | 11 +- .../includes/media/GIFMetadataExtractorTest.php | 1 + tests/phpunit/includes/media/GIFTest.php | 16 + tests/phpunit/includes/media/IPTCTest.php | 31 +- .../includes/media/JpegMetadataExtractorTest.php | 5 +- tests/phpunit/includes/media/JpegTest.php | 10 +- tests/phpunit/includes/media/MediaHandlerTest.php | 7 +- .../includes/media/PNGMetadataExtractorTest.php | 32 +- tests/phpunit/includes/media/PNGTest.php | 16 + .../includes/media/SVGMetadataExtractorTest.php | 9 +- tests/phpunit/includes/media/TiffTest.php | 20 +- tests/phpunit/includes/media/XMPTest.php | 17 +- tests/phpunit/includes/media/XMPValidateTest.php | 5 +- tests/phpunit/includes/normal/CleanUpTest.php | 32 +- .../phpunit/includes/objectcache/BagOStuffTest.php | 13 +- .../phpunit/includes/parser/MagicVariableTest.php | 107 +- .../includes/parser/MediaWikiParserTest.php | 108 +- tests/phpunit/includes/parser/NewParserTest.php | 347 +- .../phpunit/includes/parser/ParserMethodsTest.php | 48 +- tests/phpunit/includes/parser/ParserOutputTest.php | 12 +- .../phpunit/includes/parser/ParserPreloadTest.php | 18 +- tests/phpunit/includes/parser/PreprocessorTest.php | 38 +- tests/phpunit/includes/parser/TagHooksTest.php | 8 +- tests/phpunit/includes/parser/TidyTest.php | 44 + tests/phpunit/includes/search/SearchEngineTest.php | 14 +- tests/phpunit/includes/search/SearchUpdateTest.php | 15 +- tests/phpunit/includes/site/MediaWikiSiteTest.php | 5 +- tests/phpunit/includes/site/SiteListTest.php | 9 +- tests/phpunit/includes/site/SiteSQLStoreTest.php | 13 +- tests/phpunit/includes/site/SiteTest.php | 33 +- tests/phpunit/includes/site/TestSites.php | 1 - .../includes/specials/QueryAllSpecialPagesTest.php | 2 +- .../includes/specials/SpecialPreferencesTest.php | 60 + .../includes/specials/SpecialRecentchangesTest.php | 2 - .../includes/specials/SpecialSearchTest.php | 9 +- tests/phpunit/includes/upload/UploadBaseTest.php | 147 + .../phpunit/includes/upload/UploadFromUrlTest.php | 18 +- tests/phpunit/includes/upload/UploadStashTest.php | 3 +- tests/phpunit/includes/upload/UploadTest.php | 144 - tests/phpunit/install-phpunit.sh | 2 +- tests/phpunit/languages/LanguageAmTest.php | 18 +- tests/phpunit/languages/LanguageArTest.php | 29 +- tests/phpunit/languages/LanguageBeTest.php | 18 +- tests/phpunit/languages/LanguageBe_taraskTest.php | 59 +- tests/phpunit/languages/LanguageBhoTest.php | 19 +- tests/phpunit/languages/LanguageBsTest.php | 19 +- .../phpunit/languages/LanguageClassesTestCase.php | 58 +- tests/phpunit/languages/LanguageCsTest.php | 19 +- tests/phpunit/languages/LanguageCuTest.php | 31 +- tests/phpunit/languages/LanguageCyTest.php | 19 +- tests/phpunit/languages/LanguageDsbTest.php | 19 +- tests/phpunit/languages/LanguageFrTest.php | 19 +- tests/phpunit/languages/LanguageGaTest.php | 19 +- tests/phpunit/languages/LanguageGdTest.php | 39 +- tests/phpunit/languages/LanguageGvTest.php | 21 +- tests/phpunit/languages/LanguageHeTest.php | 119 +- tests/phpunit/languages/LanguageHiTest.php | 19 +- tests/phpunit/languages/LanguageHrTest.php | 19 +- tests/phpunit/languages/LanguageHsbTest.php | 19 +- tests/phpunit/languages/LanguageHuTest.php | 19 +- tests/phpunit/languages/LanguageHyTest.php | 20 +- tests/phpunit/languages/LanguageKshTest.php | 19 +- tests/phpunit/languages/LanguageLnTest.php | 19 +- tests/phpunit/languages/LanguageLtTest.php | 38 +- tests/phpunit/languages/LanguageLvTest.php | 19 +- tests/phpunit/languages/LanguageMgTest.php | 19 +- tests/phpunit/languages/LanguageMkTest.php | 21 +- tests/phpunit/languages/LanguageMlTest.php | 11 +- tests/phpunit/languages/LanguageMoTest.php | 18 +- tests/phpunit/languages/LanguageMtTest.php | 59 +- tests/phpunit/languages/LanguageNlTest.php | 6 +- tests/phpunit/languages/LanguageNsoTest.php | 22 +- tests/phpunit/languages/LanguagePlTest.php | 59 +- tests/phpunit/languages/LanguageRoTest.php | 18 +- tests/phpunit/languages/LanguageRuTest.php | 44 +- tests/phpunit/languages/LanguageSeTest.php | 27 +- tests/phpunit/languages/LanguageSgsTest.php | 27 +- tests/phpunit/languages/LanguageShTest.php | 30 +- tests/phpunit/languages/LanguageSkTest.php | 18 +- tests/phpunit/languages/LanguageSlTest.php | 22 +- tests/phpunit/languages/LanguageSmaTest.php | 27 +- tests/phpunit/languages/LanguageSrTest.php | 84 +- tests/phpunit/languages/LanguageTest.php | 311 +- tests/phpunit/languages/LanguageTiTest.php | 22 +- tests/phpunit/languages/LanguageTlTest.php | 22 +- tests/phpunit/languages/LanguageTrTest.php | 5 +- tests/phpunit/languages/LanguageUkTest.php | 35 +- tests/phpunit/languages/LanguageUzTest.php | 28 +- tests/phpunit/languages/LanguageWaTest.php | 22 +- .../utils/CLDRPluralRuleEvaluatorTest.php | 2 +- tests/phpunit/maintenance/DumpTestCase.php | 26 +- tests/phpunit/maintenance/MaintenanceTest.php | 6 +- tests/phpunit/maintenance/backupPrefetchTest.php | 3 - tests/phpunit/maintenance/backupTextPassTest.php | 7 +- tests/phpunit/maintenance/backup_LogTest.php | 4 +- tests/phpunit/maintenance/backup_PageTest.php | 6 +- tests/phpunit/maintenance/fetchTextTest.php | 2 - tests/phpunit/maintenance/getSlaveServerTest.php | 2 - tests/phpunit/mocks/filebackend/MockFSFile.php | 69 + .../phpunit/mocks/filebackend/MockFileBackend.php | 122 + tests/phpunit/mocks/media/MockBitmapHandler.php | 92 + tests/phpunit/phpunit.php | 24 +- tests/phpunit/resources/ResourcesTest.php | 128 - tests/phpunit/skins/SideBarTest.php | 75 +- tests/phpunit/structure/AutoLoaderTest.php | 56 + tests/phpunit/structure/ResourcesTest.php | 131 + tests/phpunit/structure/StructureTest.php | 63 + tests/phpunit/suite.xml | 27 +- tests/phpunit/suites/ExtensionsParserTestSuite.php | 8 + tests/phpunit/suites/UploadFromUrlTestSuite.php | 13 +- tests/qunit/QUnitTestResources.php | 4 +- tests/qunit/data/generateJqueryMsgData.php | 4 +- tests/qunit/data/load.mock.php | 3 +- tests/qunit/data/testrunner.js | 29 +- .../resources/jquery/jquery.byteLength.test.js | 24 +- .../resources/jquery/jquery.byteLimit.test.js | 120 +- .../suites/resources/jquery/jquery.client.test.js | 283 +- .../resources/jquery/jquery.localize.test.js | 10 +- .../jquery/jquery.makeCollapsible.test.js | 287 + .../resources/jquery/jquery.tablesorter.test.js | 166 +- .../resources/jquery/jquery.textSelection.test.js | 7 - .../mediawiki.special.recentchanges.test.js | 2 +- .../resources/mediawiki/mediawiki.Title.test.js | 268 +- .../mediawiki/mediawiki.jqueryMsg.test.js | 337 +- .../suites/resources/mediawiki/mediawiki.test.js | 171 +- .../resources/mediawiki/mediawiki.user.test.js | 6 +- .../resources/mediawiki/mediawiki.util.test.js | 91 +- tests/qunit/suites/resources/startup.test.js | 129 + tests/selenium/Selenium.php | 191 - tests/selenium/SeleniumConfig.php | 80 - tests/selenium/SeleniumLoader.php | 9 - tests/selenium/SeleniumServerManager.php | 252 - tests/selenium/SeleniumTestCase.php | 127 - tests/selenium/SeleniumTestConsoleLogger.php | 25 - tests/selenium/SeleniumTestConstants.php | 24 - tests/selenium/SeleniumTestHTMLLogger.php | 36 - tests/selenium/SeleniumTestListener.php | 65 - tests/selenium/SeleniumTestSuite.php | 57 - tests/selenium/data/SimpleSeleniumTestDB.sql | 1453 --- tests/selenium/data/SimpleSeleniumTestImages.zip | Bin 21993 -> 0 bytes tests/selenium/data/Wikipedia-logo-v2-de.png | Bin 21479 -> 0 bytes .../data/mediawiki118_fresh_installation.sql | 1543 ---- .../MediaWikiButtonsAvailabilityTestCase.php | 90 - .../MediaWikiDifferentDatabaseAccountTestCase.php | 73 - .../MediaWikiDifferntDatabasePrefixTestCase.php | 88 - ...ediaWikiErrorsConnectToDatabasePageTestCase.php | 131 - .../installer/MediaWikiErrorsNamepageTestCase.php | 119 - .../installer/MediaWikiHelpFieldHintTestCase.php | 128 - .../MediaWikiInstallationCommonFunction.php | 259 - .../installer/MediaWikiInstallationConfig.php | 45 - .../installer/MediaWikiInstallationMessage.php | 53 - .../installer/MediaWikiInstallationVariables.php | 73 - .../installer/MediaWikiInstallerTestSuite.php | 49 - .../installer/MediaWikiMySQLDataBaseTestCase.php | 71 - .../MediaWikiMySQLiteDataBaseTestCase.php | 73 - .../MediaWikiOnAlreadyInstalledTestCase.php | 65 - .../MediaWikiRestartInstallationTestCase.php | 104 - .../MediaWikiRightFrameworkLinksTestCase.php | 83 - .../MediaWikiUpgradeExistingDatabaseTestCase.php | 111 - .../installer/MediaWikiUserInterfaceTestCase.php | 494 - tests/selenium/installer/README.txt | 32 - tests/selenium/selenium_settings.ini.sample | 32 - tests/selenium/selenium_settings_grid.ini.sample | 16 - .../suites/AddContentToNewPageTestCase.php | 173 - tests/selenium/suites/AddNewPageTestCase.php | 59 - tests/selenium/suites/CreateAccountTestCase.php | 109 - tests/selenium/suites/DeletePageAdminTestCase.php | 82 - tests/selenium/suites/EmailPasswordTestCase.php | 74 - tests/selenium/suites/MediaWikiEditorConfig.php | 41 - tests/selenium/suites/MediaWikiEditorTestSuite.php | 19 - tests/selenium/suites/MediaWikiExtraTestSuite.php | 21 - .../selenium/suites/MediawikiCoreSmokeTestCase.php | 70 - .../suites/MediawikiCoreSmokeTestSuite.php | 19 - tests/selenium/suites/MovePageTestCase.php | 111 - tests/selenium/suites/MyContributionsTestCase.php | 59 - tests/selenium/suites/MyWatchListTestCase.php | 51 - tests/selenium/suites/PageDeleteTestSuite.php | 15 - tests/selenium/suites/PageSearchTestCase.php | 98 - tests/selenium/suites/PreviewPageTestCase.php | 48 - tests/selenium/suites/SavePageTestCase.php | 53 - tests/selenium/suites/SimpleSeleniumConfig.php | 30 - tests/selenium/suites/SimpleSeleniumTestCase.php | 39 - tests/selenium/suites/SimpleSeleniumTestSuite.php | 26 - tests/selenium/suites/UserPreferencesTestCase.php | 170 - tests/testHelpers.inc | 33 +- 343 files changed, 17118 insertions(+), 14020 deletions(-) delete mode 100644 tests/RunSeleniumTests.php create mode 100644 tests/parser/ParserTestResult.php delete mode 100644 tests/phpunit/AutoLoaderTest.php create mode 100644 tests/phpunit/MediaWikiPHPUnitTestListener.php delete mode 100644 tests/phpunit/StructureTest.php create mode 100644 tests/phpunit/data/less/common/test.common.mixins.less create mode 100644 tests/phpunit/data/less/module/dependency.less create mode 100644 tests/phpunit/data/less/module/styles.css create mode 100644 tests/phpunit/data/less/module/styles.less create mode 100644 tests/phpunit/includes/FallbackTest.php create mode 100644 tests/phpunit/includes/FauxRequestTest.php create mode 100644 tests/phpunit/includes/HTMLCheckMatrixTest.php create mode 100644 tests/phpunit/includes/HashRingTest.php create mode 100644 tests/phpunit/includes/HtmlFormatterTest.php delete mode 100644 tests/phpunit/includes/JsonTest.php create mode 100644 tests/phpunit/includes/MWExceptionHandlerTest.php delete mode 100644 tests/phpunit/includes/Providers.php delete mode 100644 tests/phpunit/includes/SeleniumConfigurationTest.php create mode 100644 tests/phpunit/includes/UserMailerTest.php create mode 100644 tests/phpunit/includes/XmlTypeCheckTest.php create mode 100644 tests/phpunit/includes/cache/MessageCacheTest.php create mode 100644 tests/phpunit/includes/db/DatabaseMysqlBaseTest.php create mode 100644 tests/phpunit/includes/db/DatabaseTestHelper.php create mode 100644 tests/phpunit/includes/installer/OracleInstallerTest.php create mode 100644 tests/phpunit/includes/json/FormatJsonTest.php delete mode 100644 tests/phpunit/includes/json/ServicesJsonTest.php create mode 100644 tests/phpunit/includes/media/FakeDimensionFile.php create mode 100644 tests/phpunit/includes/parser/TidyTest.php create mode 100644 tests/phpunit/includes/specials/SpecialPreferencesTest.php create mode 100644 tests/phpunit/includes/upload/UploadBaseTest.php delete mode 100644 tests/phpunit/includes/upload/UploadTest.php create mode 100644 tests/phpunit/mocks/filebackend/MockFSFile.php create mode 100644 tests/phpunit/mocks/filebackend/MockFileBackend.php create mode 100644 tests/phpunit/mocks/media/MockBitmapHandler.php delete mode 100644 tests/phpunit/resources/ResourcesTest.php create mode 100644 tests/phpunit/structure/AutoLoaderTest.php create mode 100644 tests/phpunit/structure/ResourcesTest.php create mode 100644 tests/phpunit/structure/StructureTest.php create mode 100644 tests/phpunit/suites/ExtensionsParserTestSuite.php create mode 100644 tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js create mode 100644 tests/qunit/suites/resources/startup.test.js delete mode 100644 tests/selenium/Selenium.php delete mode 100644 tests/selenium/SeleniumConfig.php delete mode 100644 tests/selenium/SeleniumLoader.php delete mode 100644 tests/selenium/SeleniumServerManager.php delete mode 100644 tests/selenium/SeleniumTestCase.php delete mode 100644 tests/selenium/SeleniumTestConsoleLogger.php delete mode 100644 tests/selenium/SeleniumTestConstants.php delete mode 100644 tests/selenium/SeleniumTestHTMLLogger.php delete mode 100644 tests/selenium/SeleniumTestListener.php delete mode 100644 tests/selenium/SeleniumTestSuite.php delete mode 100644 tests/selenium/data/SimpleSeleniumTestDB.sql delete mode 100644 tests/selenium/data/SimpleSeleniumTestImages.zip delete mode 100644 tests/selenium/data/Wikipedia-logo-v2-de.png delete mode 100644 tests/selenium/data/mediawiki118_fresh_installation.sql delete mode 100644 tests/selenium/installer/MediaWikiButtonsAvailabilityTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiDifferentDatabaseAccountTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiDifferntDatabasePrefixTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiErrorsConnectToDatabasePageTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiErrorsNamepageTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiHelpFieldHintTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiInstallationCommonFunction.php delete mode 100644 tests/selenium/installer/MediaWikiInstallationConfig.php delete mode 100644 tests/selenium/installer/MediaWikiInstallationMessage.php delete mode 100644 tests/selenium/installer/MediaWikiInstallationVariables.php delete mode 100644 tests/selenium/installer/MediaWikiInstallerTestSuite.php delete mode 100644 tests/selenium/installer/MediaWikiMySQLDataBaseTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiMySQLiteDataBaseTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiOnAlreadyInstalledTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiRestartInstallationTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiRightFrameworkLinksTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiUpgradeExistingDatabaseTestCase.php delete mode 100644 tests/selenium/installer/MediaWikiUserInterfaceTestCase.php delete mode 100644 tests/selenium/installer/README.txt delete mode 100644 tests/selenium/selenium_settings.ini.sample delete mode 100644 tests/selenium/selenium_settings_grid.ini.sample delete mode 100644 tests/selenium/suites/AddContentToNewPageTestCase.php delete mode 100644 tests/selenium/suites/AddNewPageTestCase.php delete mode 100644 tests/selenium/suites/CreateAccountTestCase.php delete mode 100644 tests/selenium/suites/DeletePageAdminTestCase.php delete mode 100644 tests/selenium/suites/EmailPasswordTestCase.php delete mode 100644 tests/selenium/suites/MediaWikiEditorConfig.php delete mode 100644 tests/selenium/suites/MediaWikiEditorTestSuite.php delete mode 100644 tests/selenium/suites/MediaWikiExtraTestSuite.php delete mode 100644 tests/selenium/suites/MediawikiCoreSmokeTestCase.php delete mode 100644 tests/selenium/suites/MediawikiCoreSmokeTestSuite.php delete mode 100644 tests/selenium/suites/MovePageTestCase.php delete mode 100644 tests/selenium/suites/MyContributionsTestCase.php delete mode 100644 tests/selenium/suites/MyWatchListTestCase.php delete mode 100644 tests/selenium/suites/PageDeleteTestSuite.php delete mode 100644 tests/selenium/suites/PageSearchTestCase.php delete mode 100644 tests/selenium/suites/PreviewPageTestCase.php delete mode 100644 tests/selenium/suites/SavePageTestCase.php delete mode 100644 tests/selenium/suites/SimpleSeleniumConfig.php delete mode 100644 tests/selenium/suites/SimpleSeleniumTestCase.php delete mode 100644 tests/selenium/suites/SimpleSeleniumTestSuite.php delete mode 100644 tests/selenium/suites/UserPreferencesTestCase.php (limited to 'tests') diff --git a/tests/RunSeleniumTests.php b/tests/RunSeleniumTests.php deleted file mode 100644 index b7320cb1..00000000 --- a/tests/RunSeleniumTests.php +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env php -=' ) ) { - # PHPUnit 3.5.0 introduced a nice autoloader based on class name - require_once( 'PHPUnit/Autoload.php' ); -} else { - # Keep the old pre PHPUnit 3.5.0 behavior for compatibility - require_once( 'PHPUnit/TextUI/Command.php' ); -} - -require_once( 'PHPUnit/Extensions/SeleniumTestCase.php' ); -include_once( 'PHPUnit/Util/Log/JUnit.php' ); - -require_once( __DIR__ . "/selenium/SeleniumServerManager.php" ); - -class SeleniumTester extends Maintenance { - protected $selenium; - protected $serverManager; - protected $seleniumServerExecPath; - - public function __construct() { - parent::__construct(); - $this->mDescription = "Selenium Test Runner. For documentation, visit http://www.mediawiki.org/wiki/SeleniumFramework"; - $this->addOption( 'port', 'Port used by selenium server. Default: 4444', false, true ); - $this->addOption( 'host', 'Host selenium server. Default: $wgServer . $wgScriptPath', false, true ); - $this->addOption( 'testBrowser', 'The browser used during testing. Default: firefox', false, true ); - $this->addOption( 'wikiUrl', 'The Mediawiki installation to point to. Default: http://localhost', false, true ); - $this->addOption( 'username', 'The login username for sunning tests. Default: empty', false, true ); - $this->addOption( 'userPassword', 'The login password for running tests. Default: empty', false, true ); - $this->addOption( 'seleniumConfig', 'Location of the selenium config file. Default: empty', false, true ); - $this->addOption( 'list-browsers', 'List the available browsers.' ); - $this->addOption( 'verbose', 'Be noisier.' ); - $this->addOption( 'startserver', 'Start Selenium Server (on localhost) before the run.' ); - $this->addOption( 'stopserver', 'Stop Selenium Server (on localhost) after the run.' ); - $this->addOption( 'jUnitLogFile', 'Log results in a specified JUnit log file. Default: empty', false, true ); - $this->addOption( 'runAgainstGrid', 'The test will be run against a Selenium Grid. Default: false.', false, true ); - $this->deleteOption( 'dbpass' ); - $this->deleteOption( 'dbuser' ); - $this->deleteOption( 'globals' ); - $this->deleteOption( 'wiki' ); - } - - public function listBrowsers() { - $desc = "Available browsers:\n"; - - foreach ( $this->selenium->getAvailableBrowsers() as $k => $v ) { - $desc .= " $k => $v\n"; - } - - echo $desc; - } - - protected function startServer() { - if ( $this->seleniumServerExecPath == '' ) { - die ( "The selenium server exec path is not set in " . - "selenium_settings.ini. Cannot start server \n" . - "as requested - terminating RunSeleniumTests\n" ); - } - $this->serverManager = new SeleniumServerManager( 'true', - $this->selenium->getPort(), - $this->seleniumServerExecPath ); - switch ( $this->serverManager->start() ) { - case 'started': - break; - case 'failed': - die ( "Unable to start the Selenium Server - " . - "terminating RunSeleniumTests\n" ); - case 'running': - echo ( "Warning: The Selenium Server is " . - "already running\n" ); - break; - } - - return; - } - - protected function stopServer() { - if ( !isset ( $this->serverManager ) ) { - echo ( "Warning: Request to stop Selenium Server, but it was " . - "not stared by RunSeleniumTests\n" . - "RunSeleniumTests cannot stop a Selenium Server it " . - "did not start\n" ); - } else { - switch ( $this->serverManager->stop() ) { - case 'stopped': - break; - case 'failed': - echo ( "unable to stop the Selenium Server\n" ); - } - } - return; - } - - protected function runTests( $seleniumTestSuites = array() ) { - $result = new PHPUnit_Framework_TestResult; - $result->addListener( new SeleniumTestListener( $this->selenium->getLogger() ) ); - if ( $this->selenium->getJUnitLogFile() ) { - $jUnitListener = new PHPUnit_Util_Log_JUnit( $this->selenium->getJUnitLogFile(), true ); - $result->addListener( $jUnitListener ); - } - - foreach ( $seleniumTestSuites as $testSuiteName => $testSuiteFile ) { - require( $testSuiteFile ); - $suite = new $testSuiteName(); - $suite->setName( $testSuiteName ); - $suite->addTests(); - - try { - $suite->run( $result ); - } catch ( Testing_Selenium_Exception $e ) { - $suite->tearDown(); - throw new MWException( $e->getMessage() ); - } - } - - if ( $this->selenium->getJUnitLogFile() ) { - $jUnitListener->flush(); - } - } - - public function execute() { - global $wgServer, $wgScriptPath, $wgHooks; - - $seleniumSettings = array(); - $seleniumBrowsers = array(); - $seleniumTestSuites = array(); - - $configFile = $this->getOption( 'seleniumConfig', '' ); - if ( strlen( $configFile ) > 0 ) { - $this->output( "Using Selenium Configuration file: " . $configFile . "\n" ); - SeleniumConfig::getSeleniumSettings( $seleniumSettings, - $seleniumBrowsers, - $seleniumTestSuites, - $configFile ); - } elseif ( !isset( $wgHooks['SeleniumSettings'] ) ) { - $this->output( "No command line, configuration file or configuration hook found.\n" ); - SeleniumConfig::getSeleniumSettings( $seleniumSettings, - $seleniumBrowsers, - $seleniumTestSuites - ); - } else { - $this->output( "Using 'SeleniumSettings' hook for configuration.\n" ); - wfRunHooks( 'SeleniumSettings', array( $seleniumSettings, - $seleniumBrowsers, - $seleniumTestSuites ) ); - } - - // State for starting/stopping the Selenium server has nothing to do with the Selenium - // class. Keep this state local to SeleniumTester class. Using getOption() is clumsy, but - // the Maintenance class does not have a setOption() - if ( !isset( $seleniumSettings['startserver'] ) ) { - $this->getOption( 'startserver', true ); - } - if ( !isset( $seleniumSettings['stopserver'] ) ) { - $this->getOption( 'stopserver', true ); - } - if ( !isset( $seleniumSettings['seleniumserverexecpath'] ) ) { - $seleniumSettings['seleniumserverexecpath'] = ''; - } - $this->seleniumServerExecPath = $seleniumSettings['seleniumserverexecpath']; - - //set reasonable defaults if we did not find the settings - if ( !isset( $seleniumBrowsers ) ) { - $seleniumBrowsers = array( 'firefox' => '*firefox' ); - } - if ( !isset( $seleniumSettings['host'] ) ) { - $seleniumSettings['host'] = $wgServer . $wgScriptPath; - } - if ( !isset( $seleniumSettings['port'] ) ) { - $seleniumSettings['port'] = '4444'; - } - if ( !isset( $seleniumSettings['wikiUrl'] ) ) { - $seleniumSettings['wikiUrl'] = 'http://localhost'; - } - if ( !isset( $seleniumSettings['username'] ) ) { - $seleniumSettings['username'] = ''; - } - if ( !isset( $seleniumSettings['userPassword'] ) ) { - $seleniumSettings['userPassword'] = ''; - } - if ( !isset( $seleniumSettings['testBrowser'] ) ) { - $seleniumSettings['testBrowser'] = 'firefox'; - } - if ( !isset( $seleniumSettings['jUnitLogFile'] ) ) { - $seleniumSettings['jUnitLogFile'] = false; - } - if ( !isset( $seleniumSettings['runAgainstGrid'] ) ) { - $seleniumSettings['runAgainstGrid'] = false; - } - - // Setup Selenium class - $this->selenium = new Selenium(); - $this->selenium->setAvailableBrowsers( $seleniumBrowsers ); - $this->selenium->setRunAgainstGrid( $this->getOption( 'runAgainstGrid', $seleniumSettings['runAgainstGrid'] ) ); - $this->selenium->setUrl( $this->getOption( 'wikiUrl', $seleniumSettings['wikiUrl'] ) ); - $this->selenium->setBrowser( $this->getOption( 'testBrowser', $seleniumSettings['testBrowser'] ) ); - $this->selenium->setPort( $this->getOption( 'port', $seleniumSettings['port'] ) ); - $this->selenium->setHost( $this->getOption( 'host', $seleniumSettings['host'] ) ); - $this->selenium->setUser( $this->getOption( 'username', $seleniumSettings['username'] ) ); - $this->selenium->setPass( $this->getOption( 'userPassword', $seleniumSettings['userPassword'] ) ); - $this->selenium->setVerbose( $this->hasOption( 'verbose' ) ); - $this->selenium->setJUnitLogFile( $this->getOption( 'jUnitLogFile', $seleniumSettings['jUnitLogFile'] ) ); - - if ( $this->hasOption( 'list-browsers' ) ) { - $this->listBrowsers(); - exit( 0 ); - } - if ( $this->hasOption( 'startserver' ) ) { - $this->startServer(); - } - - $logger = new SeleniumTestConsoleLogger; - $this->selenium->setLogger( $logger ); - - $this->runTests( $seleniumTestSuites ); - - if ( $this->hasOption( 'stopserver' ) ) { - $this->stopServer(); - } - } -} - -$maintClass = "SeleniumTester"; - -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/tests/TestsAutoLoader.php b/tests/TestsAutoLoader.php index c1c301f6..00ce13c8 100644 --- a/tests/TestsAutoLoader.php +++ b/tests/TestsAutoLoader.php @@ -30,14 +30,16 @@ $wgAutoloadClasses += array( 'DbTestPreviewer' => "$testDir/testHelpers.inc", 'DbTestRecorder' => "$testDir/testHelpers.inc", 'DelayedParserTest' => "$testDir/testHelpers.inc", + 'ParserTestResult' => "$testDir/parser/ParserTestResult.php", 'TestFileIterator' => "$testDir/testHelpers.inc", 'TestRecorder' => "$testDir/testHelpers.inc", + 'ITestRecorder' => "$testDir/testHelpers.inc", # tests/phpunit 'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php", 'MediaWikiPHPUnitCommand' => "$testDir/phpunit/MediaWikiPHPUnitCommand.php", + 'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php", 'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php", - 'MediaWikiProvide' => "$testDir/phpunit/includes/Providers.php", 'TestUser' => "$testDir/phpunit/includes/TestUser.php", # tests/phpunit/includes @@ -48,9 +50,7 @@ $wgAutoloadClasses += array( //db 'ORMTableTest' => "$testDir/phpunit/includes/db/ORMTableTest.php", 'PageORMTableForTesting' => "$testDir/phpunit/includes/db/ORMTableTest.php", - - //Selenium - 'SeleniumTestConstants' => "$testDir/selenium/SeleniumTestConstants.php", + 'DatabaseTestHelper' => "$testDir/phpunit/includes/db/DatabaseTestHelper.php", # tests/phpunit/includes/api 'ApiFormatTestBase' => "$testDir/phpunit/includes/api/format/ApiFormatTestBase.php", @@ -73,14 +73,25 @@ $wgAutoloadClasses += array( # tests/phpunit/includes/parser 'NewParserTest' => "$testDir/phpunit/includes/parser/NewParserTest.php", + 'MediaWikiParserTest' => "$testDir/phpunit/includes/parser/MediaWikiParserTest.php", # tests/phpunit/includes/libs 'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php", + # tests/phpunit/media + 'FakeDimensionFile' => "$testDir/phpunit/includes/media/FakeDimensionFile.php", + # tests/phpunit/includes/site 'SiteTest' => "$testDir/phpunit/includes/site/SiteTest.php", 'TestSites' => "$testDir/phpunit/includes/site/TestSites.php", + # tests/phpunit/mocks + 'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php", + 'MockFileBackend' => "$testDir/phpunit/mocks/filebackend/MockFileBackend.php", + 'MockBitmapHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php", + 'MockImageHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php", + 'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php", + # tests/phpunit/languages 'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php", @@ -90,15 +101,4 @@ $wgAutoloadClasses += array( # tests/parser 'ParserTest' => "$testDir/parser/parserTest.inc", 'ParserTestParserHook' => "$testDir/parser/parserTestsParserHook.php", - - # tests/selenium - 'Selenium' => "$testDir/selenium/Selenium.php", - 'SeleniumLoader' => "$testDir/selenium/SeleniumLoader.php", - 'SeleniumTestCase' => "$testDir/selenium/SeleniumTestCase.php", - 'SeleniumTestConsoleLogger' => "$testDir/selenium/SeleniumTestConsoleLogger.php", - 'SeleniumTestConstants' => "$testDir/selenium/SeleniumTestConstants.php", - 'SeleniumTestHTMLLogger' => "$testDir/selenium/SeleniumTestHTMLLogger.php", - 'SeleniumTestListener' => "$testDir/selenium/SeleniumTestListener.php", - 'SeleniumTestSuite' => "$testDir/selenium/SeleniumTestSuite.php", - 'SeleniumConfig' => "$testDir/selenium/SeleniumConfig.php", ); diff --git a/tests/parser/ParserTestResult.php b/tests/parser/ParserTestResult.php new file mode 100644 index 00000000..d9ad773d --- /dev/null +++ b/tests/parser/ParserTestResult.php @@ -0,0 +1,42 @@ +description = $description; + } + + /** Whether the test passed */ + public function isSuccess() { + return $this->expected === $this->actual; + } +} diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index ce621f4e..58ea1ed0 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -1,6 +1,8 @@ * http://www.mediawiki.org/ @@ -31,22 +33,22 @@ */ class ParserTest { /** - * boolean $color whereas output should be colorized + * @var bool $color whereas output should be colorized */ private $color; /** - * boolean $showOutput Show test output + * @var bool $showOutput Show test output */ private $showOutput; /** - * boolean $useTemporaryTables Use temporary tables for the temporary database + * @var bool $useTemporaryTables Use temporary tables for the temporary database */ private $useTemporaryTables = true; /** - * boolean $databaseSetupDone True if the database has been set up + * @var bool $databaseSetupDone True if the database has been set up */ private $databaseSetupDone = false; @@ -63,7 +65,7 @@ class ParserTest { private $dbClone; /** - * string $oldTablePrefix Original table prefix + * @var string $oldTablePrefix Original table prefix */ private $oldTablePrefix; @@ -141,15 +143,14 @@ class ParserTest { static function setUp() { global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache, - $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo, + $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo, $parserMemc, $wgThumbnailScriptPath, $wgScriptPath, - $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath, $wgExtensionAssetsPath, + $wgArticlePath, $wgScript, $wgStylePath, $wgExtensionAssetsPath, $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgLockManagers; $wgScript = '/index.php'; $wgScriptPath = '/'; $wgArticlePath = '/wiki/$1'; - $wgStyleSheetPath = '/skins'; $wgStylePath = '/skins'; $wgExtensionAssetsPath = '/extensions'; $wgThumbnailScriptPath = false; @@ -181,6 +182,9 @@ class ParserTest { $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface'; $wgNamespaceAliases['Image'] = NS_FILE; $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK; + # add a namespace shadowing a interwiki link, to test + # proper precedence when resolving links. (bug 51680) + $wgExtraNamespaces[100] = 'MemoryAlpha'; // XXX: tests won't run without this (for CACHE_DB) if ( $wgMainCacheType === CACHE_DB ) { @@ -211,6 +215,73 @@ class ParserTest { $wgStyleDirectory = "$IP/skins"; } + self::setupInterwikis(); + } + + /** + * Insert hardcoded interwiki in the lookup table. + * + * This function insert a set of well known interwikis that are used in + * the parser tests. They can be considered has fixtures are injected in + * the interwiki cache by using the 'InterwikiLoadPrefix' hook. + * Since we are not interested in looking up interwikis in the database, + * the hook completely replace the existing mechanism (hook returns false). + */ + public static function setupInterwikis() { + # Hack: insert a few Wikipedia in-project interwiki prefixes, + # for testing inter-language links + Hooks::register( 'InterwikiLoadPrefix', function ( $prefix, &$iwData ) { + static $testInterwikis = array( + 'wikipedia' => array( + 'iw_url' => 'http://en.wikipedia.org/wiki/$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 0 ), + 'meatball' => array( + 'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 0 ), + 'memoryalpha' => array( + 'iw_url' => 'http://www.memory-alpha.org/en/index.php/$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 0 ), + 'zh' => array( + 'iw_url' => 'http://zh.wikipedia.org/wiki/$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 1 ), + 'es' => array( + 'iw_url' => 'http://es.wikipedia.org/wiki/$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 1 ), + 'fr' => array( + 'iw_url' => 'http://fr.wikipedia.org/wiki/$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 1 ), + 'ru' => array( + 'iw_url' => 'http://ru.wikipedia.org/wiki/$1', + 'iw_api' => '', + 'iw_wikiid' => '', + 'iw_local' => 1 ), + ); + if ( array_key_exists( $prefix, $testInterwikis ) ) { + $iwData = $testInterwikis[$prefix]; + } + + // We only want to rely on the above fixtures + return false; + } );// hooks::register + } + + /** + * Remove the hardcoded interwiki lookup table. + */ + public static function tearDownInterwikis() { + Hooks::clear( 'InterwikiLoadPrefix' ); } public function setupRecorder( $options ) { @@ -378,7 +449,12 @@ class ParserTest { */ public function runTestsFromFiles( $filenames ) { $ok = false; + + // be sure, ParserTest::addArticle has correct language set, + // so that system messages gets into the right language cache + $GLOBALS['wgLanguageCode'] = 'en'; $GLOBALS['wgContLang'] = Language::factory( 'en' ); + $this->recorder->start(); try { $this->setupDatabase(); @@ -418,6 +494,9 @@ class ParserTest { /** * Get a Parser object + * + * @param string $preprocessor + * @return Parser */ function getParser( $preprocessor = null ) { global $wgParserConf; @@ -487,9 +566,10 @@ class ParserTest { } elseif ( isset( $opts['comment'] ) ) { $out = Linker::formatComment( $input, $title, $local ); } elseif ( isset( $opts['preload'] ) ) { - $out = $parser->getpreloadText( $input, $title, $options ); + $out = $parser->getPreloadText( $input, $title, $options ); } else { $output = $parser->parse( $input, $title, $options, true, true, 1337 ); + $output->setTOCEnabled( !isset( $opts['notoc'] ) ); $out = $output->getText(); if ( isset( $opts['showtitle'] ) ) { @@ -518,18 +598,23 @@ class ParserTest { } $this->teardownGlobals(); - return $this->showTestResult( $desc, $result, $out ); + + $testResult = new ParserTestResult( $desc ); + $testResult->expected = $result; + $testResult->actual = $out; + + return $this->showTestResult( $testResult ); } /** - * + * Refactored in 1.22 to use ParserTestResult */ - function showTestResult( $desc, $result, $out ) { - if ( $result === $out ) { - $this->showSuccess( $desc ); + function showTestResult( ParserTestResult $testResult ) { + if ( $testResult->isSuccess() ) { + $this->showSuccess( $testResult ); return true; } else { - $this->showFailure( $desc, $result, $out ); + $this->showFailure( $testResult ); return false; } } @@ -537,7 +622,7 @@ class ParserTest { /** * Use a regex to find out the value of an option * @param $key String: name of option val to retrieve - * @param $opts Options array to look in + * @param $opts array: Options array to look in * @param $default Mixed: default value returned if not found */ private static function getOptionValue( $key, $opts, $default ) { @@ -664,11 +749,10 @@ class ParserTest { ), 'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ), 'wgStylePath' => '/skins', - 'wgStyleSheetPath' => '/skins', 'wgSitename' => 'MediaWiki', 'wgLanguageCode' => $lang, 'wgDBprefix' => $this->db->getType() != 'oracle' ? 'parsertest_' : 'pt_', - 'wgRawHtml' => isset( $opts['rawhtml'] ), + 'wgRawHtml' => self::getOptionValue( 'wgRawHtml', $opts, false ), 'wgLang' => null, 'wgContLang' => null, 'wgNamespacesWithSubpages' => array( 0 => isset( $opts['subpage'] ) ), @@ -678,8 +762,10 @@ class ParserTest { 'wgNoFollowDomainExceptions' => array(), 'wgThumbnailScriptPath' => false, 'wgUseImageResize' => true, + 'wgSVGConverter' => 'null', + 'wgSVGConverters' => array( 'null' => 'echo "1">$output' ), 'wgLocaltimezone' => 'UTC', - 'wgAllowExternalImages' => true, + 'wgAllowExternalImages' => self::getOptionValue( 'wgAllowExternalImages', $opts, true ), 'wgUseTidy' => false, 'wgDefaultLanguageVariant' => $variant, 'wgVariantArticlePath' => false, @@ -822,43 +908,9 @@ class ParserTest { 'user_name' => 'Anonymous' ) ); } - # Hack: insert a few Wikipedia in-project interwiki prefixes, - # for testing inter-language links - $this->db->insert( 'interwiki', array( - array( 'iw_prefix' => 'wikipedia', - 'iw_url' => 'http://en.wikipedia.org/wiki/$1', - 'iw_api' => '', - 'iw_wikiid' => '', - 'iw_local' => 0 ), - array( 'iw_prefix' => 'meatball', - 'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', - 'iw_api' => '', - 'iw_wikiid' => '', - 'iw_local' => 0 ), - array( 'iw_prefix' => 'zh', - 'iw_url' => 'http://zh.wikipedia.org/wiki/$1', - 'iw_api' => '', - 'iw_wikiid' => '', - 'iw_local' => 1 ), - array( 'iw_prefix' => 'es', - 'iw_url' => 'http://es.wikipedia.org/wiki/$1', - 'iw_api' => '', - 'iw_wikiid' => '', - 'iw_local' => 1 ), - array( 'iw_prefix' => 'fr', - 'iw_url' => 'http://fr.wikipedia.org/wiki/$1', - 'iw_api' => '', - 'iw_wikiid' => '', - 'iw_local' => 1 ), - array( 'iw_prefix' => 'ru', - 'iw_url' => 'http://ru.wikipedia.org/wiki/$1', - 'iw_api' => '', - 'iw_wikiid' => '', - 'iw_local' => 1 ), - ) ); - # Update certain things in site_stats - $this->db->insert( 'site_stats', array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) ); + $this->db->insert( 'site_stats', + array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) ); # Reinitialise the LocalisationCache to match the database state Language::getLocalisationCache()->unloadAll(); @@ -866,19 +918,52 @@ class ParserTest { # Clear the message cache MessageCache::singleton()->clear(); + // Remember to update newParserTests.php after changing the below + // (and it uses a slightly different syntax just for teh lulz) $this->uploadDir = $this->setupUploadDir(); $user = User::createNew( 'WikiSysop' ); $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) ); + # note that the size/width/height/bits/etc of the file + # are actually set by inspecting the file itself; the arguments + # to recordUpload2 have no effect. That said, we try to make things + # match up so it is less confusing to readers of the code & tests. $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array( - 'size' => 12345, + 'size' => 7881, 'width' => 1941, 'height' => 220, - 'bits' => 24, + 'bits' => 8, 'media_type' => MEDIATYPE_BITMAP, 'mime' => 'image/jpeg', 'metadata' => serialize( array() ), - 'sha1' => wfBaseConvert( '', 16, 36, 31 ), + 'sha1' => wfBaseConvert( '1', 16, 36, 31 ), + 'fileExists' => true + ), $this->db->timestamp( '20010115123500' ), $user ); + + $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Thumb.png' ) ); + # again, note that size/width/height below are ignored; see above. + $image->recordUpload2( '', 'Upload of some lame thumbnail', 'Some lame thumbnail', array( + 'size' => 22589, + 'width' => 135, + 'height' => 135, + 'bits' => 8, + 'media_type' => MEDIATYPE_BITMAP, + 'mime' => 'image/png', + 'metadata' => serialize( array() ), + 'sha1' => wfBaseConvert( '2', 16, 36, 31 ), 'fileExists' => true + ), $this->db->timestamp( '20130225203040' ), $user ); + + $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.svg' ) ); + $image->recordUpload2( '', 'Upload of some lame SVG', 'Some lame SVG', array( + 'size' => 12345, + 'width' => 240, + 'height' => 180, + 'bits' => 24, + 'media_type' => MEDIATYPE_DRAWING, + 'mime' => 'image/svg+xml', + 'metadata' => serialize( array() ), + 'sha1' => wfBaseConvert( '', 16, 36, 31 ), + 'fileExists' => true ), $this->db->timestamp( '20010115123500' ), $user ); # This image will be blacklisted in [[MediaWiki:Bad image list]] @@ -891,7 +976,7 @@ class ParserTest { 'media_type' => MEDIATYPE_BITMAP, 'mime' => 'image/jpeg', 'metadata' => serialize( array() ), - 'sha1' => wfBaseConvert( '', 16, 36, 31 ), + 'sha1' => wfBaseConvert( '3', 16, 36, 31 ), 'fileExists' => true ), $this->db->timestamp( '20010115123500' ), $user ); } @@ -922,8 +1007,11 @@ class ParserTest { $tables = $this->listTables(); foreach ( $tables as $table ) { - $sql = $this->db->getType() == 'oracle' ? "DROP TABLE pt_$table DROP CONSTRAINTS" : "DROP TABLE `parsertest_$table`"; - $this->db->query( $sql ); + if ( $this->db->getType() == 'oracle' ) { + $this->db->query( "DROP TABLE pt_$table DROP CONSTRAINTS" ); + } else { + $this->db->query( "DROP TABLE `parsertest_$table`" ); + } } if ( $this->db->getType() == 'oracle' ) { @@ -960,9 +1048,15 @@ class ParserTest { wfMkdirParents( $dir . '/3/3a', null, __METHOD__ ); copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); + wfMkdirParents( $dir . '/e/ea', null, __METHOD__ ); + copy( "$IP/skins/monobook/wiki.png", "$dir/e/ea/Thumb.png" ); wfMkdirParents( $dir . '/0/09', null, __METHOD__ ); copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); - + wfMkdirParents( $dir . '/f/ff', null, __METHOD__ ); + copy( "$IP/skins/monobook/headbg.jpg", "$dir/f/ff/Foobar.svg" ); + file_put_contents( "$dir/f/ff/Foobar.svg", + '' . + '' ); return $dir; } @@ -1008,8 +1102,18 @@ class ParserTest { "$dir/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg", "$dir/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg", + "$dir/e/ea/Thumb.png", + "$dir/0/09/Bad.jpg", + "$dir/f/ff/Foobar.svg", + "$dir/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png", + "$dir/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png", + "$dir/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png", + "$dir/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png", + "$dir/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png", + "$dir/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png", + "$dir/math/f/a/5/fa50b8b616463173474302ca3e63586b.png", ) ); @@ -1023,7 +1127,13 @@ class ParserTest { "$dir/thumb/3/3a/Foobar.jpg", "$dir/thumb/3/3a", "$dir/thumb/3", - + "$dir/e/ea", + "$dir/e", + "$dir/f/ff/", + "$dir/f/", + "$dir/thumb/f/ff/Foobar.svg", + "$dir/thumb/f/ff/", + "$dir/thumb/f/", "$dir/0/09/", "$dir/0/", "$dir/thumb", @@ -1070,10 +1180,12 @@ class ParserTest { /** * Print a happy success message. * - * @param $desc String: the test name + * Refactored in 1.22 to use ParserTestResult + * + * @param $testResult ParserTestResult * @return Boolean */ - protected function showSuccess( $desc ) { + protected function showSuccess( ParserTestResult $testResult ) { if ( $this->showProgress ) { print $this->term->color( '1;32' ) . 'PASSED' . $this->term->reset() . "\n"; } @@ -1085,28 +1197,29 @@ class ParserTest { * Print a failure message and provide some explanatory output * about what went wrong if so configured. * - * @param $desc String: the test name - * @param $result String: expected HTML output - * @param $html String: actual HTML output + * Refactored in 1.22 to use ParserTestResult + * + * @param $testResult ParserTestResult * @return Boolean */ - protected function showFailure( $desc, $result, $html ) { + protected function showFailure( ParserTestResult $testResult ) { if ( $this->showFailure ) { if ( !$this->showProgress ) { # In quiet mode we didn't show the 'Testing' message before the # test, in case it succeeded. Show it now: - $this->showTesting( $desc ); + $this->showTesting( $testResult->description ); } print $this->term->color( '31' ) . 'FAILED!' . $this->term->reset() . "\n"; if ( $this->showOutput ) { - print "--- Expected ---\n$result\n--- Actual ---\n$html\n"; + print "--- Expected ---\n{$testResult->expected}\n"; + print "--- Actual ---\n{$testResult->actual}\n"; } if ( $this->showDiffs ) { - print $this->quickDiff( $result, $html ); - if ( !$this->wellFormed( $html ) ) { + print $this->quickDiff( $testResult->expected, $testResult->actual ); + if ( !$this->wellFormed( $testResult->actual ) ) { print "XML error: $this->mXmlError\n"; } } @@ -1125,7 +1238,9 @@ class ParserTest { * @param $outFileTail String: tailing for the output file name * @return String */ - protected function quickDiff( $input, $output, $inFileTail = 'expected', $outFileTail = 'actual' ) { + protected function quickDiff( $input, $output, + $inFileTail = 'expected', $outFileTail = 'actual' + ) { # Windows, or at least the fc utility, is retarded $slash = wfIsWindows() ? '\\' : '/'; $prefix = wfTempDir() . "{$slash}mwParser-" . mt_rand(); @@ -1141,9 +1256,10 @@ class ParserTest { global $wgDiff3; // we assume that people with diff3 also have usual diff - $diff = ( wfIsWindows() && !$wgDiff3 ) - ? `fc $shellInfile $shellOutfile` - : `diff -au $shellInfile $shellOutfile`; + $shellCommand = ( wfIsWindows() && !$wgDiff3 ) ? 'fc' : 'diff -au'; + + $diff = wfShellExec( "$shellCommand $shellInfile $shellOutfile" ); + unlink( $infile ); unlink( $outfile ); @@ -1343,7 +1459,7 @@ class ParserTest { } static function getFakeTimestamp( &$parser, &$ts ) { - $ts = 123; + $ts = 123; //parsed as '1970-01-01T00:02:03Z' return true; } } diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index f0603e75..02a66b51 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -26,6 +26,11 @@ # showtitle make the first line the title # comment run through Linker::formatComment() instead of main parser # local format section links in edit comment text as local links +# notoc disable table of contents +# +# You can also set the following parser properties via test options: +# wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel, +# wgLinkHolderBatchSize, wgRawHtml # # For testing purposes, temporary articles can created: # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle @@ -116,12 +121,31 @@ Template:table_attribs |style="color: red"| Foo !! endarticle +!! article +Template:table_cells +!! text +{{table_attribs}} || Bar || Baz +!! endarticle + +!! article +Template:image_attribs +!! text + +[[File:foobar.jpg|right|Caption text]] +!! endarticle + !! article A?b !! text Weirdo titles! !! endarticle +!!article +Template:Bullet +!!text +* Bar +!!endarticle + ### ### Basic tests ### @@ -164,6 +188,206 @@ baz

!! end +!! test +Paragraphs with newline spacing with comment lines in between +!! input +---- +a + +b +---- +a + +b +---- +a + +b +---- +a + + +b +---- +a + + +b +---- +a + + + +b +---- +a + + + +b +---- +!! result +
+

a +b +

+
+

a +b +

+
+

a +b +

+
+

a +

b +

+
+

a +

b +

+
+

a +


+b +

+
+

a +


+b +

+
+ +!! end + +!! test +Paragraphs with newline spacing with non-empty white-space lines in between +!! input +---- +a + +b +---- +a + + +b +---- +!! result +
+

a +

b +

+
+

a +


+b +

+
+ +!! end + +!! test +Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between +!! input +---- +a + +b +---- +a + +b +---- +a + + + +b +---- +a + + + + +b +---- +!! result +
+

a +b +

+
+

a +b +

+
+

a +

b +

+
+

a +


+b +

+
+ +!! end + +!! test +Extra newlines: More paragraphs with indented comment +!! input +a + + + +b +!!result +

a +


+b +

+!!end + +!! test +Extra newlines followed by heading +!! input +a + + + +=b= +[[a]] + + +=b= +!! result +

a +


+

+

b[edit]

+

a +


+

+

b[edit]

+ +!! end + +!! test +Extra newlines between heading and content are swallowed +!! input +=b= + + + +[[a]] +!! result +

b[edit]

+

a +

+!! end + !! test Parsing an URL !! input @@ -180,9 +404,12 @@ Simple list * Item 1 * Item 2 !! result - + !! end @@ -205,25 +432,72 @@ Italics and bold * plain l'''italic''plain * plain l''''bold''' plain !! result - + + +!! end + +# this example taken from the [[simple:Moon]] article (bug 47326) +!! test +Italics and possessives (1) +!! input +obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer +!! result +

obtained by Lunar Prospector's gamma-ray spectrometer +

+!! end + +# this example taken from [[en:Flaming Pie]] (bug 49926) +!! test +Italics and possessives (2) +!! input +'''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes +!! result +

Flaming Pie is ... released in 1997. In Flaming Pie's liner notes +

+!! end +# this example taken from [[en:Dictionary]] (bug 49926) +!! test +Italics and possessives (3) +!! input +The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''. +!! result +

The first monolingual dictionary written in a Romance language was Sebastián Covarrubias' Tesoro de la lengua castellana o española, published in 1611 in Madrid. In 1612 the first edition of the Vocabolario dell'Accademia della Crusca, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the Dictionnaire Universel. +

!! end + ### ### 2-quote opening sequence tests ### @@ -258,13 +532,26 @@ Italics and bold: 2-quote opening sequence: (2,4) !! test -Italics and bold: 2-quote opening sequence: (2,5) +Italics and bold: 2-quote opening sequence: (2,5) (php) +!! options +php !! input ''foo''''' !! result

foo

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 2-quote opening sequence: (2,5) (parsoid) +!! options +parsoid +!! input +''foo''''' +!! result +

foo +

+!!end ### @@ -302,13 +589,26 @@ Italics and bold: 3-quote opening sequence: (3,4) !! test -Italics and bold: 3-quote opening sequence: (3,5) +Italics and bold: 3-quote opening sequence: (3,5) (php) +!! options +php !! input '''foo''''' !! result

foo

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 3-quote opening sequence: (3,5) (parsoid) +!! options +parsoid +!! input +'''foo''''' +!! result +

foo +

+!!end ### @@ -346,13 +646,26 @@ Italics and bold: 4-quote opening sequence: (4,4) !! test -Italics and bold: 4-quote opening sequence: (4,5) +Italics and bold: 4-quote opening sequence: (4,5) (php) +!! options +php !! input ''''foo''''' !! result

'foo

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 4-quote opening sequence: (4,5) (parsoid) +!! options +parsoid +!! input +''''foo''''' +!! result +

'foo +

+!!end ### @@ -361,6 +674,7 @@ Italics and bold: 4-quote opening sequence: (4,5) !! test Italics and bold: 5-quote opening sequence: (5,2) +!! options !! input '''''foo'' !! result @@ -432,23 +746,49 @@ Italics and bold: multiple quote sequences: (2,4,4) !! test -Italics and bold: multiple quote sequences: (3,4,2) +Italics and bold: multiple quote sequences: (3,4,2) (php) +!! options +php !! input '''foo''''bar'' !! result

foo'bar

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: multiple quote sequences: (3,4,2) (parsoid) +!! options +parsoid +!! input +'''foo''''bar'' +!! result +

foo'bar +

+!!end + - !! test -Italics and bold: multiple quote sequences: (3,4,3) +Italics and bold: multiple quote sequences: (3,4,3) (php) +!! options +php !! input '''foo''''bar''' !! result

foo'bar

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: multiple quote sequences: (3,4,3) (parsoid) +!! options +parsoid +!! input +'''foo''''bar''' +!! result +

foo'bar +

+!!end ### ### other quote tests @@ -485,6 +825,7 @@ Italics and bold: other quote tests: (3,2,3,2) !! test Italics and bold: other quote tests: (3,2,3,3) +!! options !! input '''this is about ''foo'''s family''' !! result @@ -512,6 +853,23 @@ The ''[[Main Page]]'''s talk page.

!! end +!! test +Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line +(Requires tidy for PHP parser output to be fixed up) +!! options +parsoid=wt2html,wt2wt +!! input +{| +!''a!!''b +|''a||''b +|} +!! result + + + +
abab
+!! end + ### ### Non-html5 tags ### @@ -533,6 +891,74 @@ Non-html5 tags should be accepted

!! end +!! test + is valid wikitext (bug 52468) +!! input + +!! result +

+

+!! end + +# is HTML4, is HTML4/5. +!! test + or for strikethrough +!! input +strike + +s +!! result +

strike +

s +

+!! end + +!! test +Non-word characters don't terminate tag names (bug 17663, 40670, 52022) +!! input + doesn't work! + + doesn't work! + + works fine + +foo
+ +s.foo + + +!! result +

<b→> doesn't work! </b> +

<bä> doesn't work! </b> +

<boo> works fine </b> +

<s.foo>foo</s> +

<s.foo>s.foo</s.foo> +

<sub-ID#1> +

+!! end + +### +### Special characters +### + +!! test +Bare pipe character (bug 52363) +!! input +| +!! result +

| +

+!! end + +!! test +Bare pipe character from a template (bug 52363) +!! input +{{pipe}} +!! result +

| +

+!! end + ### ### test cases ### @@ -579,15 +1005,24 @@ nowiki 3 *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. -
+
+
There is not nowiki. +
+
There is nowiki. +
+
+
    +
  1. There is not nowiki. +
  2. +
  3. There is nowiki. +
  4. +
+
    +
  • There is not nowiki. +
  • +
  • There is nowiki. +
  • +
!! end @@ -600,6 +1035,16 @@ Entities inside

!! end +!! test +Entities inside template parameters +!! options +parsoid +!! input +{{echo|–}} +!! result +

+

+!! end ### ### Comments @@ -781,7 +1226,7 @@ b !! end ### -### paragraph wraping tests +### paragraph wrapping tests ### !! test No block tags @@ -794,8 +1239,9 @@ b

b

!! end + !! test -Block tag on one line +Block tag on one line (
) !! input a
foo
@@ -807,7 +1253,19 @@ a
foo
!! end !! test -Block tag on both lines +Block tag on one line (
) +!! input +a
foo
+ +b +!! result +a
foo
+

b +

+!! end + +!! test +Block tag on both lines (
) !! input a
foo
@@ -818,6 +1276,18 @@ b
foo
!! end +!! test +Block tag on both lines (
) +!! input +a
foo
+ +b
foo
+!! result +a
foo
+b
foo
+ +!! end + !! test Multiple lines without block tags !! input @@ -837,7 +1307,7 @@ x
foo
z !! end !! test -Empty lines between block tags to test open p-tags are closed between the block tags +Empty lines between lines with block tags !! input
@@ -845,6 +1315,12 @@ Empty lines between block tags to test open p-tags are closed between the block
a b +
a
b + +
b
d + + +
e
!! result


@@ -852,6 +1328,12 @@ b

a

b

+
a
b +
b
d +


+

+
e
+ !! end ### @@ -874,6 +1356,22 @@ And a link !! end +!! test +Tabs don't trigger preformatted text +!! input + This is not + preformatted text. + This is preformatted text. + So is this. +!! result +

This is not + preformatted text. +

+
This is preformatted text.
+	So is this.
+
+!! end + !! test Ident preformatting with inline content !! input @@ -916,17 +1414,61 @@ Regression with preformatted in
!! end -# Expected output in the following test is not really expected (there should be -#
 in the output) -- it's only testing for well-formedness.
 !! test
-Bug 6200: Preformatted in 
+Bug 52763: Preformatted in
!! input
Blah
!! result
- Blah +

Blah +

+
+ +!! end + +!! test +Bug 51086: Double newlines in blockquotes should be turned into paragraphs +!! input +
+Foo + +Bar +
+!! result +
+

Foo +

Bar +

+
+ +!! end + +!! test +Bug 15491: / in blockquote +!! input +
+Foo bar baz quux +
+!! result +
+

Foo bar baz quux +

+
+ +!! end + +# Note that the p-wrapping is newline sensitive, which could be +# considered a bug: tidy will wrap only the 'Foo' in the example +# below in a

tag. (see comment 23-25 of bug #6200) +!! test +Bug 15491: / in blockquote (2) +!! input +

Foo bar baz quux +
+!! result +
Foo bar baz quux
!! end @@ -1156,82 +1698,253 @@ Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
!!end +# TODO / maybe: fix wt2wt for this !! test -Templates: Single-line variant of parameter whitespace stripping test +Parsoid: Don't paragraph-wrap fosterable content +!! options +parsoid=wt2html !! input -{{echo| a}} +{| + + -{{echo|1= a}} -{{echo|{{echo| a}}}} -{{echo|1={{echo| a}}}} +|} !! result -
a
-
-

a -

-
a
-
-

a -

+ + + + + + + + + + +
!! end !! test -Templates: Strip whitespace from named parameters, but not positional ones +Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced +!! options +parsoid=wt2html !! input -{{echo| - foo}} +{| + + + -{{echo| -* foo}} + + +|} +!! result + + + + + + + + + + +
+
+!! end + + +#-------------------------------------------------------------------- +# Transclusion parameter whitespace stripping tests +# Behavior is different for positional and named parameters +#-------------------------------------------------------------------- +!! test +Templates: Strip leading and trailing whitespace from named-param values +!! input +{{echo|1= a }} + +{{echo|1= {{echo|b}} }} {{echo| 1 = - foo}} + c }} {{echo| 1 = -* foo}} +* d +}} !! result -
foo
-
-


-

-
  • foo -
-

foo +

a +

b +

c

-
  • foo -
+
    +
  • d +
  • +
!! end -### -### Parsoid-centric tests for testing RT edge cases for pre -### +!! test +Templates: Don't strip whitespace from positional-param values +!! input +{{echo|a }} -!!test -1a. Indent-Pre and Comments -!!input - a - -c -!!result -
a
+{{echo|{{echo|b}} }}
+
+{{echo| c 
+}}
+
+{{echo| {{echo|d}}
+}}
+
+{{echo|
+ e}}
+
+{{echo|
+* f}}
+
+{{echo|
+ }}g
+!! result
+

a +

b +

+
c 
 
-

c +


-!!end - -!!test -1b. Indent-Pre and Comments -!!input - a - -c -!!result -
a
+
d
 
-

c +


+

+
e
+
+


+

+
    +
  • f +
  • +
+


+

+
g
+
+!! end + +!! test +Templates: Handle empty comment-and-ws-only lines correctly +!! input +{{echo|foo + + +bar}} +!! result +

foo +bar +

+!! end + +#-------------------------------------------------------------------- +# Transclusion parameter escaping tests +#-------------------------------------------------------------------- +!! test +Templates: Parsoid parameter escaping test 1 +!! options +parsoid +!! input +{{echo|[foo]|{{echo|[bar]}}}} +!! result +

[foo]

+!! end + +!! test +Parsoid: Pipes in external links in template parameter +!! options +parsoid +!! input +{{echo|[{{echo|http://example.com}} link]}} +!! result +

link

+!! end + +!! test +Parsoid: pipe in transclusion parameter +!! options +parsoid +!! input +{{echo|http://foo.com/a|b}} +!! result +

http://foo.com/a|b

+!! end + +!! test +Parsoid: Pipe in external link target and content in template parameter +!! options +parsoid=html2wt,wt2wt +!! input +{{echo|[http://foo.com/a|b a|b]}} +!! result +

a|b

+!! end + +!! test +Templates: Dont escape already nowiki-escaped text in template parameters +!! options +parsoid=html2wt,wt2wt +!! input +{{echo|foo|bar}} +{{echo|<div>}} +{{echo|}} +!! result +

foo|bar +<div> + +

+!! end + +## Bug 52824 +!! test +Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param +!! options +parsoid=html2wt,wt2wt +!! input +{{echo|{{echo|1=bar}}}} +!! result +

bar

+!! end + +### +### Parsoid-centric tests for testing RT edge cases for pre +### + +!!test +1a. Indent-Pre and Comments +!!input + a + +c +!!result +
a
+
+

c +

+!!end + +!!test +1b. Indent-Pre and Comments +!!input + a + +c +!!result +
a
+
+

c

!!end @@ -1248,6 +1961,20 @@ c
!!end +!!test +1d. Indent-Pre and Comments +(Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order) +!!input + a + + b +!!result +
a
+
+
b
+
+!!end + !!test 2a. Indent-Pre and tables !!input @@ -1307,10 +2034,12 @@ c !!input

foo

foo
+
foo
foo !!result

foo

foo
+
foo
 foo 
 
!!end @@ -1334,6 +2063,12 @@ c foo
+
+
+foo
+
+
+
foo
@@ -1355,7 +2090,13 @@ c
- foo +

foo +

+
+
+
+foo
+
foo
@@ -1400,6 +2141,56 @@ b
 
!! end +!! test +6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content +!! input + a + + + b + + c + +d +!! result +
a
+
+b
+
+
c
+
+
+

d +

+!! end + +!! test +7a. Indent-pre and category links +!! options +parsoid=wt2html,wt2wt +!! input + [[Category:foo]] +{{echo| [[Category:foo]]}} +!! result + + + +!! end + +!! test +7b. Indent-pre and category links +!! options +parsoid=wt2html,wt2wt +!! input + [[Category:foo]] a + [[Category:foo]] {{echo|b}} +!! result +
+ a
+
+ b
+!! end + ### ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric) ### @@ -1482,8 +2273,11 @@ Simple definition !! input ; name : Definition !! result -
name 
Definition -
+
+
name 
+
Definition +
+
!! end @@ -1492,8 +2286,10 @@ Definition list for indentation only !! input : Indented text !! result -
Indented text -
+
+
Indented text +
+
!! end @@ -1502,8 +2298,11 @@ Definition list with no space !! input ;name:Definition !! result -
name
Definition -
+
+
name
+
Definition +
+
!!end @@ -1512,8 +2311,11 @@ Definition list with URL link !! input ; http://example.com/ : definition !! result -
http://example.com/ 
definition -
+
+
http://example.com/ 
+
definition +
+
!! end @@ -1522,8 +2324,11 @@ Definition list with bracketed URL link !! input ;[http://www.example.com/ Example]:Something about it !! result -
Example
Something about it -
+
+
Example
+
Something about it +
+
!! end @@ -1532,8 +2337,11 @@ Definition list with wikilink containing colon !! input ; [[Help:FAQ]]: The least-read page on Wikipedia !! result -
Help:FAQ
The least-read page on Wikipedia -
+
+
Help:FAQ
+
The least-read page on Wikipedia +
+
!! end @@ -1543,8 +2351,11 @@ Definition list with news link containing colon !! input ; news:alt.wikipedia.rox: This isn't even a real newsgroup! !! result -
news:alt.wikipedia.rox
This isn't even a real newsgroup! -
+
+
news:alt.wikipedia.rox
+
This isn't even a real newsgroup! +
+
!! end @@ -1553,8 +2364,10 @@ Malformed definition list with colon !! input ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop !! result -
news:alt.wikipedia.rox -- don't crash or enter an infinite loop -
+
+
news:alt.wikipedia.rox -- don't crash or enter an infinite loop +
+
!! end @@ -1563,8 +2376,11 @@ Definition lists: colon in external link text !! input ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up !! result -
Wikipedia : The Next Generation
OK, I made that up -
+
+
Wikipedia : The Next Generation
+
OK, I made that up +
+
!! end @@ -1573,8 +2389,10 @@ Definition lists: colon in HTML attribute !! input ;bold !! result -
bold -
+
+
bold +
+
!! end @@ -1583,8 +2401,11 @@ Definition lists: self-closed tag !! input ;one
two : two-line fun !! result -
one
two 
two-line fun -
+
+
one
two 
+
two-line fun +
+
!! end @@ -1613,16 +2434,19 @@ Definition and unordered list using wiki syntax nested in unordered list using h
  • ; term : description * unordered -
  • -
+ !! result
  • -
    term 
    description -
    -
    • unordered -
    +
    +
    term 
    +
    description +
    +
    +
      +
    • unordered
    +
!! end @@ -1633,8 +2457,11 @@ Definition list with empty definition and following paragraph ; term: Paragraph text !! result -
term
-
+
+
term
+
+
+

Paragraph text

!! end @@ -1663,10 +2490,14 @@ Definition Lists: No nesting: Multiple dd's :a :b !! result -
x -
a -
b -
+
+
x +
+
a +
+
b +
+
!! end @@ -1677,12 +2508,18 @@ Definition Lists: Indentation: Regular ::i2 :::i3 !! result -
i1 -
i2 -
i3 -
-
-
+
+
i1 +
+
i2 +
+
i3 +
+
+
+
+
+
!! end @@ -1692,11 +2529,17 @@ Definition Lists: Indentation: Missing 1st level ::i2 :::i3 !! result -
i2 -
i3 -
-
-
+
+
+
i2 +
+
i3 +
+
+
+
+
+
!! end @@ -1705,10 +2548,16 @@ Definition Lists: Indentation: Multi-level indent !! input :::i3 !! result -
i3 -
-
-
+
+
+
+
i3 +
+
+
+
+
+
!! end @@ -1732,6 +2581,21 @@ should be left alone should be left alone

!! end + +# Bug 52473 +!! test +Definition Lists: Hacky use to indent tables (WS-insensitive) +!! options +parsoid +!! input +: {| +|a +|} +!! result +
+
a
+
+!! end ## The PHP parser treats : items (dd) without a corresponding ; item (dt) ## as an empty dt item. It also ignores all but the last ";" when followed ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in @@ -1783,13 +2647,17 @@ Table / list interaction: indented table with lists in table contents
a -
  • b -
+
    +
  • b +
  • +
c -
  • d -
+
    +
  • d +
  • +
!! end @@ -1812,18 +2680,27 @@ Table / list interaction: lists nested in tables nested in indented lists
-
a -
b -
+
+
a +
+
b +
+
-
  • c -
  • d -
+
    +
  • c +
  • +
  • d +
  • +
-
  • e -
  • f -
+
    +
  • e +
  • +
  • f +
  • +
!!end @@ -1911,43 +2788,91 @@ Definition Lists: Nesting: Test 4 ::;t3 :::d3 !! result -
t3 -
d3 -
-
-
+
+
+
+
t3 +
+
d3 +
+
+
+
+
+
!! end +## The Parsoid team believes the following three test exposes a +## bug in the PHP parser. (Parsoid team thinks the PHP parser is +## wrong to close the
after the
containing the
    .) !! test -Definition Lists: Mixed Lists: Test 1 +Definition Lists: Mixed Lists: Test 1 (php) +!! options +php !! input :;* foo ::* bar :; baz !! result -
    • foo -
    • bar -
    -
    -
    baz -
    -
    - -!! end - - +
    +
    +
      +
    • foo +
    • +
    • bar +
    • +
    +
    +
    +
    +
    baz +
    +
    +
    +
    + +!! end +!! test +Definition Lists: Mixed Lists: Test 1 (parsoid) +!! options +parsoid +!! input +:;* foo +::* bar +:; baz +!! result +
    +
    +
      +
    • foo +
    • +
    +
      +
    • bar +
    • +
    +
    baz
    +
    +
    +!! end + !! test Definition Lists: Mixed Lists: Test 2 !! input *: d1 *: d2 !! result -
    • d1 -
      d2 -
      -
    +
      +
    • +
      d1 +
      +
      d2 +
      +
      +
    • +
    !! end @@ -1958,12 +2883,21 @@ Definition Lists: Mixed Lists: Test 3 *::: d1 *::: d2 !! result -
    • d1 -
      d2 -
      -
      -
      -
    +
      +
    • +
      +
      +
      d1 +
      +
      d2 +
      +
      +
      +
      +
      +
      +
    • +
    !! end @@ -1974,10 +2908,17 @@ Definition Lists: Mixed Lists: Test 4 *;d1 :d2 *;d3 :d4 !! result -
    • d1 
      d2 -
      d3 
      d4 -
      -
    +
      +
    • +
      d1 
      +
      d2 +
      +
      d3 
      +
      d4 +
      +
      +
    • +
    !! end @@ -1988,11 +2929,17 @@ Definition Lists: Mixed Lists: Test 5 *:d1 *:: d2 !! result -
    • d1 -
      d2 -
      -
      -
    +
      +
    • +
      d1 +
      +
      d2 +
      +
      +
      +
      +
    • +
    !! end @@ -2003,13 +2950,23 @@ Definition Lists: Mixed Lists: Test 6 #*:d1 #*::: d3 !! result -
      • d1 -
        d3 -
        -
        -
        -
      -
    +
      +
      • +
      • +
        d1 +
        +
        +
        d3 +
        +
        +
        +
        +
        +
        +
      • +
      +
    1. +
    !! end @@ -2020,10 +2977,15 @@ Definition Lists: Mixed Lists: Test 7 :* d1 :* d2 !! result -
    • d1 -
    • d2 -
    -
    +
    +
      +
    • d1 +
    • +
    • d2 +
    • +
    +
    +
    !! end @@ -2034,12 +2996,20 @@ Definition Lists: Mixed Lists: Test 8 :* d1 ::* d2 !! result -
    • d1 -
    -
    • d2 -
    -
    -
    +
    +
      +
    • d1 +
    • +
    +
    +
      +
    • d2 +
    • +
    +
    +
    +
    +
    !! end @@ -2049,9 +3019,14 @@ Definition Lists: Mixed Lists: Test 9 !! input *;foo :bar !! result -
    • foo 
      bar -
      -
    +
      +
    • +
      foo 
      +
      bar +
      +
      +
    • +
    !! end @@ -2061,50 +3036,171 @@ Definition Lists: Mixed Lists: Test 10 !! input *#;foo :bar !! result -
      1. foo 
        bar -
        -
      -
    +
      +
      1. +
      2. +
        foo 
        +
        bar +
        +
        +
      3. +
      +
    • +
    !! end +# The Parsoid team disagrees with the PHP parser's seemingly-random +# rules regarding dd/dt on the next two tests. Parsoid is more +# consistent, and recognizes the shared nesting and keeps the +# still-open tags around until the nesting is complete. !! test -Definition Lists: Mixed Lists: Test 11 +Definition Lists: Mixed Lists: Test 11 (php) +!! options +php !! input *#*#;*;;foo :bar *#*#;boo :baz !! result -
          1. foo 
            • bar -
              -
            -
        -
-
boo 
baz -
- - - - +
    +
    1. +
      • +
        1. +
        2. +
          foo 
          +
            +
          • +
            +
            bar +
            +
            +
          +
          +
        3. +
      + + +
      +
      boo 
      +
      baz +
      +
      +
    2. +
    +
  • +
+ + + + !! end +!! test +Definition Lists: Mixed Lists: Test 11 (parsoid) +!! options +parsoid +!! input +*#*#;*;;foo :bar +*#*#;boo :baz +!! result +
    +
  • +
      +
    1. +
        +
      • +
          +
        1. +
          +
          +
            +
          • +
            +
            +
            +
            foo 
            +
            bar
            +
            +
          • +
          +
          boo 
          +
          baz
          +
        2. +
      • +
    2. +
  • +
+!! end !! test -Definition Lists: Weird Ones: Test 1 +Definition Lists: Weird Ones: Test 1 (php) +!! options +php !! input *#;*::;; foo : bar (who uses this?) !! result -
    1. foo 
      • bar (who uses this?) -
        -
        -
        -
      -
- - - +
    +
    1. +
    2. +
      foo 
      +
        +
      • +
        +
        +
        +
        bar (who uses this?) +
        +
        +
        +
        +
        +
        +
      +
      +
    3. +
+ + + + + + +!! end +!! test +Definition Lists: Weird Ones: Test 1 (parsoid) +!! options +parsoid +!! input +*#;*::;; foo : bar (who uses this?) +!! result +
    +
  • +
      +
    1. +
      +
      +
        +
      • +
        +
        +
        +
        +
        +
        +
        +
        foo 
        +
        bar (who uses this?)
        +
        +
        +
        +
      • +
      +
    2. +
  • +
!! end ### @@ -2269,6 +3365,17 @@ External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png

!! end +!! test +External image (when not allowed) +!! options +wgAllowExternalImages=0 +!! input +External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +!! result +

External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +

+!! end + !! test Link to non-http image, no img tag !! input @@ -2691,6 +3798,15 @@ External link containing double-single-quotes with no space separating the url f

!! end +!! test +External link with comments in link text +!! input +[http://www.google.com Google ] +!! result +

Google +

+!! end + !! test URL-encoding in URL functions (single parameter) !! input @@ -2763,6 +3879,28 @@ Non-extlinks in brackets

!! end +!! test +Parsoid: Percent encoding in external links +!! options +parsoid +!! input +[https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search] +!! result +

Search

+!! end + +!! test +Parsoid: use url link syntax for links where the content is equal the link +target +!! options +parsoid +!! input +http://example.com +!! result +

http://example.com

+!! end + ### ### Quotes ### @@ -2781,7 +3919,9 @@ Normal text. '''''Bold italic text.''''' Normal text. !! test -Unclosed and unmatched quotes +Unclosed and unmatched quotes (php) +!! options +php !! input '''''Bold italic text '''with bold deactivated''' in between.''''' @@ -2816,6 +3956,47 @@ Plain ''italic'''s plain

Plain italic's plain

!! end +# Parsoid inserts an empty bold tag pair at the end of the line, that the PHP +# parser strips. The wikitext contains just the first half of the bold +# quote pair. +!! test +Unclosed and unmatched quotes (parsoid) +!! options +parsoid +!! input +'''''Bold italic text '''with bold deactivated''' in between.''''' + +'''''Bold italic text ''with italic deactivated'' in between.''''' + +'''Bold text.. + +..spanning two paragraphs (should not work).''' + +'''Bold tag left open + +''Italic tag left open + +Normal text. + + +'''This year''''s election ''should'' beat '''last year''''s. + +''Tom'''s car is bigger than ''Susan'''s. + +Plain ''italic'''s plain +!! result +

Bold italic text with bold deactivated in between. +

Bold italic text with italic deactivated in between. +

Bold text.. +

..spanning two paragraphs (should not work). +

Bold tag left open +

Italic tag left open +

Normal text. +

This year's election should beat last year's. +

Toms car is bigger than Susans. +

Plain italic's plain +

+!! end ### ### Tables @@ -2824,19 +4005,33 @@ Plain ''italic'''s plain ### # This should not produce
as
-# is the bare minimun required by the spec, see: +# is the bare minimum required by the spec, see: # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables !! test -A table with no data. +A table with no data. (php) +!! options +php +!! input +{||} +!! result +!! end +# Parsoid team replies: empty table tags are legal in HTML5 +!! test +A table with no data. (parsoid) +!! options +parsoid !! input {||} !! result +
!! end # A table with nothing but a caption is invalid XHTML, we might want to render # this as

caption

!! test -A table with nothing but a caption +A table with nothing but a caption (php) +!! options +php !! input {| |+ caption @@ -2847,13 +4042,25 @@ A table with nothing but a caption !! end - +# Parsoid team replies: table with only a caption is legal in HTML5 !! test -A table with caption with default-spaced attributes and a table row +A table with nothing but a caption (parsoid) +!! options +parsoid !! input {| -|+ style="color: red;" | caption1 -|- +|+ caption +|} +!! result +
caption
+!! end + +!! test +A table with caption with default-spaced attributes and a table row +!! input +{| +|+ style="color: red;" | caption1 +|- | foo |} !! result @@ -3243,11 +4450,44 @@ Template-generated table cell attributes and cell content !! input {| |{{table_attribs}} +| {{table_attribs}} |} !! result +
Foo + Foo +
+ +!! end + +!! test +Template-generated table cell attributes and cell content (2) +!! input +{| +|align=center {{table_attribs}} +|} +!! result + + +
Foo +
+ +!! end + +!! test +Template-generated table cell attributes and cell content (3) +!! input +{| +|align=center {{table_cells}} +|} +!! result + + + + +
Foo Bar Baz
!! end @@ -3270,21 +4510,40 @@ Table with row followed by newlines and table heading !! end +!! test +Table with empty line following the start tag +!! input +{| + +|- +| foo +|} +!! result + + + + +
foo +
+ +!! end + # FIXME: Preserve the attribute properly (with an empty string as value) in # the PHP parser. Parsoid implements the behavior below. !! test Table attributes with empty value !! options -disabled +parsoid !! input {| | style=| hello |} !! result +
hello -
+ !! end @@ -3311,6 +4570,159 @@ Wikitext table with a lot of comments !! end +!! test +Wikitext table with double-line table cell +!! input +{| +|a +b +|} +!! result + + +
a +

b +

+
+ +!! end + +!! test +Table cell with a single comment +!! input +{| +| +| a +|} +!! result + + + +
+ a +
+ +!! end + +# The expected HTML structure in this test is debatable. The PHP parser does +# not parse this kind of table at all. The main focus for Parsoid is on +# round-tripping, so this output is ok for now. TODO: revisit! +!! test +Wikitext table with html-syntax row (Parsoid) +!! options +parsoid +!! input +{| +|- +foo +|} +!! result + + + +
foo
+!! end + +!! test +Implicit after a |- +(PHP parser relies on Tidy to add the missing tags) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|- +a +|} +!! result + + +
a
+!! end + +!! test +Pres should be recognized in an explicit context, but not in an implicit context +(PHP parser relies on Tidy to add the missing tags) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|- +| + a +|- + b +|} +!! result + + + + + +
a
b
+!! end + +!! test +Lists should be recognized in an implicit context +(PHP parser relies on Tidy to add the missing tags) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|- +*a +|} +!! result + + + + +
    +
  • a
  • +
+!! end + +!! test +Parsoid: Round-trip tables directly followed by content (bug 51219) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|foo +|} bar + +{| +|baz +|}quux +!! result + + +
foo
bar + + + +
baz
quux +!! end + +!! test +Parsoid: Default to a newline after tables in new content (bug 51219) +!! options +parsoid=html2wt +!! input +{| +|foo +|} + bar +{| +|baz +|} +'''quux''' +!! result + +
foo
bar + +
baz
quux +!! end + ### ### Internal links ### @@ -3341,6 +4753,15 @@ Piped link

!! end +!! test +Piped link with comment in link text +!! input +[[Main Page|The Main Page]] +!! result +

The Main Page +

+!! end + !! test Broken link !! input @@ -3462,6 +4883,22 @@ Link to namespaces

!! end +!! article +MemoryAlpha:AlphaTest +!! text +This is an article in the MemoryAlpha namespace +(which shadows the memoryalpha interwiki link). +!! endarticle + +!! test +Namespace takes precedence over interwiki link (bug 51680) +!! input +[[MemoryAlpha:AlphaTest]] +!! result +

MemoryAlpha:AlphaTest +

+!! end + !! test Piped link to namespace !! input @@ -3526,6 +4963,33 @@ Link containing "<#" and ">#" as a hex sequences

!! end +!! test +Link containing an equals sign +!! input +[[Special:BookSources/isbn=4-00-026157-6]] +!! result +

Special:BookSources/isbn=4-00-026157-6 +

+!! end + +!! article +Foo~bar +!! text +Just a test of an article title containing a tilde. +!! endarticle + +# note that links containing signatures, like [[Foo~~~~]], are +# massaged by the pre-save transform (PST) and so the tildes are never +# seen by the parser. +!! test +Link containing a tilde +!! input +[[Foo~bar]] +!! result +

Foo~bar +

+!! end + !! test Link containing double-single-quotes '' (bug 4598) !! input @@ -3787,6 +5251,69 @@ language=kaa

!! end +!! article +Söfnuður +!! text +Test. +!! endarticle + +!! test +Internal link with is link prefix +!! options +language=is +!! input +Aðrir mótmælenda[[söfnuður|söfnuðir]] og +!! result +

Aðrir mótmælendasöfnuðir og +

+!! end + +!! article +Mótmælendatrú +!! text +Test. +!! endarticle + +!! test +Internal link with is link trail and link prefix +!! options +language=is +!! input +[[mótmælendatrú|xxx]]ar +[[mótmælendatrú]]ar +mótmælenda[[söfnuður]] +mótmælenda[[söfnuður|söfnuðir]] +mótmælenda[[söfnuður|söfnuðir]]xxx +!! result +

xxxar +mótmælendatrúar +mótmælendasöfnuður +mótmælendasöfnuðir +mótmælendasöfnuðirxxx +

+!! end + +!! test +Parsoid link trail escaping +!! options +parsoid=html2wt,html2html +!! input +[[apple]]s +!! result +

apples

+!! end + +!! test +Parsoid link prefix escaping +!! options +language=is +parsoid=html2wt,html2html +!! input +Aðrir mótmælenda[[söfnuður]] +!! result +

Aðrir mótmælendasöfnuður

+!! end + !! test Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved !! input @@ -3833,9 +5360,12 @@ Interwiki link encoding conversion (bug 1636) *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] !! result - + !! end @@ -3848,6 +5378,12 @@ Interwiki link with fragment (bug 2130)

!! end + +### +### Interlanguage links +### Language links (so that searching for '### language' matches..) +### + !! test Interlanguage link !! input @@ -3905,21 +5441,206 @@ language=ln

!! end -## -## XHTML tidiness -### - !! test -
to
+Parsoid bug 53221: Wikilinks should be properly entity-escaped +!! options +parsoid=html2wt !! input -1
2
3 -!! result -

1
2
3 -

+He&nbsp;llo [[Foo|He&nbsp;llo]] + +He&nbsp;llo [[He&nbsp;llo]] +!!result +

He&nbsp;llo He&nbsp;llo

+

He&nbsp;llo He&nbsp;llo

!! end !! test -Broken br tag sanitization +Parsoid: handle constructor well +!! options +parsoid +!! input +[[constructor]] + +[[constructor:foo]] +!! result +

constructor

+ + +

constructor:foo

+!! end + +!! test +Parsoid: recognize interlanguage links without a target page +!! options +parsoid +!! input +[[ko:]] +!! result +

+

+!! end + +!! test +Parsoid: recognize interwiki links without a target page +!! options +parsoid +!! input +[[:ko:]] +!! result +

ko:

+!! end + +### +### Redirects, Parsoid-only +### +!! test +Simple redirect to page +!! options +parsoid +!! input +#REDIRECT [[Main Page]] +!! result + +!! end + +!! test +Optional colon in #REDIRECT +!! options +# the colon is archaic syntax. we support it for wt2html, but we +# don't care that it roundtrips back to the modern syntax. +parsoid=wt2html,html2html +!! input +#REDIRECT:[[Main Page]] +!! result + +!! end + +!! test +Whitespace in #REDIRECT with optional colon +!! options +# the colon and gratuitous whitespace is archaic syntax. we support +# it for wt2html, but we don't care that it roundtrips back to the +# modern syntax (without extra whitespace) +parsoid=wt2html,html2html +!! input + + #REDIRECT +: +[[Main Page]] +!! result + +!! end + +!! test +Piped link in #REDIRECT +!! options +# content after piped link is ignored. we support this syntax, +# but don't care that the piped link is lost when we roundtrip this. +parsoid=wt2html +!! input +#REDIRECT [[Main Page|bar]] +!! result + +!! end + +!! test +Redirect to category +!! options +parsoid=wt2html +!! input +#REDIRECT [[Category:Foo]] +!! result + +!! end + +!! test +Redirect to category with URL encoding +!! options +parsoid=wt2html +!! input +#REDIRECT [[Category%3AFoo]] +!! result + +!! end + +!! test +Redirect to category page +!! options +parsoid=wt2html,html2html +!! input +#REDIRECT [[:Category:Foo]] +!! result +

Category:Foo

+!! end + +!! test +Redirect to image page (1) +!! options +parsoid +!! input +#REDIRECT [[File:Wiki.png]] +!! result + +!! end + +!! test +Redirect to image page (2) +!! options +parsoid +!! input +#REDIRECT [[Image:Wiki.png]] +!! result + +!! end + +!! test +Redirect to language +!! options +parsoid +!! input +#REDIRECT [[en:File:Wiki.png]] +!! result + +!! end + +!! test +Redirect to interwiki +!! options +parsoid +!! input +#REDIRECT [[meatball:File:Wiki.png]] +!! result + +!! end + +!! test +Non-English #REDIRECT +!! options +parsoid +language=is +!! input +#TILVÍSUN [[Main Page]] +!! result + +!! end + +## +## XHTML tidiness +### + +!! test +
to
+!! input +1
2
3 +!! result +

1
2
3 +

+!! end + +!! test +Broken br tag sanitization +!! options +php !! input
!! result @@ -3927,6 +5648,17 @@ Broken br tag sanitization

!! end +# TODO: Fix html2html mode (bug 51055)! +!! test +Parsoid: Broken br tag recognition +!! options +parsoid=wt2html +!! input +
+!! result +


+!! end + !! test Incorrecly removing closing slashes from correctly formed XHTML !! input @@ -4023,7 +5755,7 @@ Horizontal ruler -- eats additional dashes on the same line !! end !! test -Horizontal ruler -- does not collaps dashes on consecutive lines +Horizontal ruler -- does not collapse dashes on consecutive lines !! input ---- ---- @@ -4061,10 +5793,14 @@ Common list * item 2 *item 3 !! result -
  • Common list -
  • item 2 -
  • item 3 -
+
    +
  • Common list +
  • +
  • item 2 +
  • +
  • item 3 +
  • +
!! end @@ -4075,10 +5811,14 @@ Numbered list #item 2 # item 3 !! result -
  1. Numbered list -
  2. item 2 -
  3. item 3 -
+
    +
  1. Numbered list +
  2. +
  3. item 2 +
  4. +
  5. item 3 +
  6. +
!! end @@ -4101,35 +5841,67 @@ Mixed list *** Level 3 #** Level 3, but ordered !! result -
  • Mixed list -
    1. with numbers -
    -
    • and bullets -
    -
    1. and numbers -
    -
  • bullets again -
    • bullet level 2 -
      • bullet level 3 -
        1. Number on level 4 -
        -
      -
    • bullet level 2 -
      1. Number on level 3 -
      2. Number on level 3 -
      -
    -
    1. number level 2 -
    -
  • Level 1 -
      • Level 3 -
      -
    -
-
      • Level 3, but ordered -
      -
    -
+
    +
  • Mixed list +
      +
    1. with numbers +
    2. +
    +
      +
    • and bullets +
    • +
    +
      +
    1. and numbers +
    2. +
    +
  • +
  • bullets again +
      +
    • bullet level 2 +
        +
      • bullet level 3 +
          +
        1. Number on level 4 +
        2. +
        +
      • +
      +
    • +
    • bullet level 2 +
        +
      1. Number on level 3 +
      2. +
      3. Number on level 3 +
      4. +
      +
    • +
    +
      +
    1. number level 2 +
    2. +
    +
  • +
  • Level 1 +
      +
      • +
      • Level 3 +
      • +
      +
    • +
    +
  • +
+
    +
    • +
      • +
      • Level 3, but ordered +
      • +
      +
    • +
    +
  1. +
!! end @@ -4139,10 +5911,14 @@ Nested lists 1 *foo **bar !! result -
  • foo -
    • bar -
    -
+
    +
  • foo +
      +
    • bar +
    • +
    +
  • +
!! end @@ -4152,10 +5928,15 @@ Nested lists 2 **foo *bar !! result -
    • foo -
    -
  • bar -
+
    +
    • +
    • foo +
    • +
    +
  • +
  • bar +
  • +
!! end @@ -4165,10 +5946,14 @@ Nested lists 3 (first element empty) * **bar !! result -
  • -
    • bar -
    -
+
    +
  • +
      +
    • bar +
    • +
    +
  • +
!! end @@ -4178,10 +5963,15 @@ Nested lists 4 (first element empty) ** *bar !! result -
    • -
    -
  • bar -
+
    +
    • +
    • +
    • +
    +
  • +
  • bar +
  • +
!! end @@ -4191,10 +5981,15 @@ Nested lists 5 (both elements empty) ** * !! result -
    • -
    -
  • -
+
    +
    • +
    • +
    • +
    +
  • +
  • +
  • +
!! end @@ -4204,10 +5999,14 @@ Nested lists 6 (both elements empty) * ** !! result -
  • -
    • -
    -
+
    +
  • +
      +
    • +
    • +
    +
  • +
!! end @@ -4216,10 +6015,16 @@ Nested lists 7 (skip initial nesting levels) !! input *** foo !! result -
      • foo -
      -
    -
+
    +
    • +
      • +
      • foo +
      • +
      +
    • +
    +
  • +
!! end @@ -4231,16 +6036,24 @@ Nested lists 8 (multiple nesting transitions) ** baz * boo !! result -
  • foo -
      • bar -
      -
    • baz -
    -
  • boo -
- -!! end - +
    +
  • foo +
      +
      • +
      • bar +
      • +
      +
    • +
    • baz +
    • +
    +
  • +
  • boo +
  • +
+ +!! end + !! test 1. Lists with start-of-line-transparent tokens before bullets: Comments !! input @@ -4248,10 +6061,14 @@ Nested lists 8 (multiple nesting transitions) *bar *baz !! result -
  • foo -
  • bar -
  • baz -
+
    +
  • foo +
  • +
  • bar +
  • +
  • baz +
  • +
!! end @@ -4261,78 +6078,14 @@ Nested lists 8 (multiple nesting transitions) *foo {{echo|bar }}*baz !! result -
  • foo bar -
  • baz -
- -!! end - -!! test -Unbalanced closing block tags break a list -(Disabled since php parser generates broken html -- relies on Tidy to fix up) -!! options -disabled -!! input -
-*a
-*b
-!! result -
-
  • a -
-
  • b -
-!! end - -!! test -Unbalanced closing non-block tags don't break a list -(Disabled since php parser generates broken html -- relies on Tidy to fix up) -!! options -disabled -!! input - -*a -*b -!! result -

-

-
  • a -
  • b -
-!! end - -!! test -Unclosed formatting tags that straddle lists are closed and reopened -(Disabled since php parser generates broken html -- relies on Tidy to fix up) -!! options -disabled -!! input -# a -# b -!! result -
  1. a -
  2. b -
-!! end - -!!test -List embedded in a non-block tag -(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy) -!! options -parsoid -!!input - -* foo - -!!result -

-
    -
  • foo
  • +
  • foo bar +
  • +
  • baz +
-
-

-!!end + +!! end !! test List items are not parsed correctly following a
 block (bug 785)
@@ -4341,10 +6094,14 @@ List items are not parsed correctly following a 
 block (bug 785)
 * 
bar
* zar !! result -
  • foo
    -
  • bar
    -
  • zar -
+
    +
  • foo
    +
  • +
  • bar
    +
  • +
  • zar +
  • +
!! end @@ -4363,18 +6120,30 @@ List items from template * notSOL{{inner list}} * item 2 !! result -
  • item 1 -
  • item 2 -
-
  • item 0 -
  • item 1 -
  • item 2 -
-
  • item 0 -
  • notSOL -
  • item 1 -
  • item 2 -
+
    +
  • item 1 +
  • +
  • item 2 +
  • +
+
    +
  • item 0 +
  • +
  • item 1 +
  • +
  • item 2 +
  • +
+
    +
  • item 0 +
  • +
  • notSOL +
  • +
  • item 1 +
  • +
  • item 2 +
  • +
!! end @@ -4387,14 +6156,22 @@ List interrupted by empty line or heading == A heading == * Another list item !! result -
  • foo -
-
    • bar -
    -
-

[edit] A heading

-
  • Another list item -
+
    +
  • foo +
  • +
+
    +
    • +
    • bar +
    • +
    +
  • +
+

A heading[edit]

+
    +
  • Another list item +
  • +
!!end @@ -4413,1629 +6190,2281 @@ Multiple list tags generated by templates !!end -### -### Magic Words -### +!!test +Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines +!!input +*a + +*b + +*c + +*d +!!result +
    +
  • a +
  • +
  • b +
  • +
  • c +
  • +
  • d +
  • +
-!! test -Magic Word: {{CURRENTDAY}} -!! input -{{CURRENTDAY}} -!! result -

1 -

-!! end +!!end -!! test -Magic Word: {{CURRENTDAY2}} -!! input -{{CURRENTDAY2}} -!! result -

01 -

-!! end +!!test +Replacing whitespace with tabs still doesn't break the list (gerrit 78327) +!!input +*a + +*b + +*c + +*d +!!result +
    +
  • a +
  • +
  • b +
  • +
  • c +
  • +
  • d +
  • +
+ +!!end + +!!test +Test the li-hack +(Cannot test this with PHP parser since it relies on Tidy for the hack) +!!options +parsoid=wt2html,wt2wt +!!input +* foo +*
  • li-hack +* {{echo|
  • templated li-hack}} +*
  • unsupported li-hack with preceding comments + +
      +
    • not a li-hack +
    • +
    +!!result +
      +
    • foo
    • +
    • li-hack
    • +
    • templated li-hack
    • +
    • +
    • li-hack with preceding comments
    • +
    + +
      +
    • +
    • not a li-hack +
    • +
    +!!end !! test -Magic Word: {{CURRENTDAYNAME}} +Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines +!! options +parsoid !! input -{{CURRENTDAYNAME}} +# foo +## bar +* foo +** bar +: foo +:: bar !! result -

    Thursday -

    +
      +
    1. foo
        +
      1. bar
      2. +
    2. +
      +
    • foo
        +
      • bar
      • +
    • +
    +
    foo
    +
    bar
    +
    +
    !! end !! test -Magic Word: {{CURRENTDOW}} +Parsoid: Test of whitespace serialization with Templated bullets +!! options +parsoid !! input -{{CURRENTDOW}} +* {{bullet}} !! result -

    4 -

    +
      +
    • Bar
    • +
    !! end +# ------------------------------------------------------------------------ +# The next set of tests are about Parsoid's ability to handle badly nested +# tags (parse, minimize scope of fixup, and roundtrip back) +# ------------------------------------------------------------------------ + !! test -Magic Word: {{CURRENTMONTH}} +Unbalanced closing block tags break a list +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) +!! options +parsoid !! input -{{CURRENTMONTH}} +
    +*a
    +*b
    !! result -

    01 -

    +
    +
      +
    • a +
    • +
    +
      +
    • b +
    • +
    !! end !! test -Magic Word: {{CURRENTMONTHABBREV}} +Unbalanced closing non-block tags don't break a list +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) +!! options +parsoid !! input -{{CURRENTMONTHABBREV}} + +*a +*b !! result -

    Jan +

    +
      +
    • a +
    • +
    • b +
    • +
    !! end !! test -Magic Word: {{CURRENTMONTHNAME}} +Unclosed formatting tags that straddle lists are closed and reopened +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) +!! options +parsoid !! input -{{CURRENTMONTHNAME}} +# a +# b !! result -

    January -

    +
      +
    1. a +
    2. +
    3. b +
    4. +
    !! end -!! test -Magic Word: {{CURRENTMONTHNAMEGEN}} -!! input -{{CURRENTMONTHNAMEGEN}} -!! result -

    January -

    -!! end +!!test +List embedded in a non-block tag +(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy) +!! options +parsoid +!!input + +* foo + +!!result +

    + +
      +
    • foo
    • +
    +
    +

    +!!end !! test -Magic Word: {{CURRENTTIME}} +Table with missing opening tag +!! options +parsoid=wt2html,wt2wt !! input -{{CURRENTTIME}} + + + +
    foo
    !! result -

    00:02 -

    + + + + +
    foo
    !! end +### +### Magic Words +### + +# Note that the current date is hard-coded as +# 1970-01-01T00:02:03Z (a Thursday) +# when running parser tests. The timezone is also fixed to GMT, so +# local date will be identical to current date. + !! test -Magic Word: {{CURRENTWEEK}} (@bug 4594) +Magic Word: {{CURRENTDAY}} !! input -{{CURRENTWEEK}} +{{CURRENTDAY}} !! result

    1

    !! end !! test -Magic Word: {{CURRENTYEAR}} +Magic Word: {{CURRENTDAY2}} !! input -{{CURRENTYEAR}} +{{CURRENTDAY2}} !! result -

    1970 +

    01

    !! end !! test -Magic Word: {{FULLPAGENAME}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTDAYNAME}} !! input -{{FULLPAGENAME}} +{{CURRENTDAYNAME}} !! result -

    User:Ævar Arnfjörð Bjarmason +

    Thursday

    !! end !! test -Magic Word: {{FULLPAGENAMEE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTDOW}} !! input -{{FULLPAGENAMEE}} +{{CURRENTDOW}} !! result -

    User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason +

    4

    !! end !! test -Magic Word: {{NAMESPACE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTH}} !! input -{{NAMESPACE}} +{{CURRENTMONTH}} !! result -

    User +

    01

    !! end !! test -Magic Word: {{NAMESPACEE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTH1}} !! input -{{NAMESPACEE}} +{{CURRENTMONTH1}} !! result -

    User +

    1

    !! end !! test -Magic Word: {{NAMESPACENUMBER}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTHABBREV}} !! input -{{NAMESPACENUMBER}} +{{CURRENTMONTHABBREV}} !! result -

    2 +

    Jan

    !! end !! test -Magic Word: {{NUMBEROFFILES}} +Magic Word: {{CURRENTMONTHNAME}} !! input -{{NUMBEROFFILES}} +{{CURRENTMONTHNAME}} !! result -

    2 +

    January

    !! end !! test -Magic Word: {{PAGENAME}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTHNAMEGEN}} !! input -{{PAGENAME}} +{{CURRENTMONTHNAMEGEN}} !! result -

    Ævar Arnfjörð Bjarmason +

    January

    !! end !! test -Magic Word: {{PAGENAME}} with metacharacters -!! options -title=[['foo & bar = baz']] +Magic Word: {{CURRENTTIME}} !! input -''{{PAGENAME}}'' +{{CURRENTTIME}} !! result -

    'foo & bar = baz' +

    00:02

    !! end !! test -Magic Word: {{PAGENAME}} with metacharacters (bug 26781) -!! options -title=[[*RFC 1234 http://example.com/]] +Magic Word: {{CURRENTHOUR}} !! input -{{PAGENAME}} +{{CURRENTHOUR}} !! result -

    *RFC 1234 http://example.com/ +

    00

    !! end !! test -Magic Word: {{PAGENAMEE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTWEEK}} (@bug 4594) !! input -{{PAGENAMEE}} +{{CURRENTWEEK}} !! result -

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason +

    1

    !! end !! test -Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781) -!! options -title=[[*RFC 1234 http://example.com/]] +Magic Word: {{CURRENTYEAR}} !! input -{{PAGENAMEE}} +{{CURRENTYEAR}} !! result -

    *RFC_1234_http://example.com/ +

    1970

    !! end !! test -Magic Word: {{REVISIONID}} +Magic Word: {{CURRENTTIMESTAMP}} !! input -{{REVISIONID}} +{{CURRENTTIMESTAMP}} !! result -

    1337 +

    19700101000203

    !! end !! test -Magic Word: {{SCRIPTPATH}} +Magic Words LOCAL (UTC) !! input -{{SCRIPTPATH}} +* {{LOCALMONTH}} +* {{LOCALMONTH1}} +* {{LOCALMONTHNAME}} +* {{LOCALMONTHNAMEGEN}} +* {{LOCALMONTHABBREV}} +* {{LOCALDAY}} +* {{LOCALDAY2}} +* {{LOCALDAYNAME}} +* {{LOCALYEAR}} +* {{LOCALTIME}} +* {{LOCALHOUR}} +* {{LOCALWEEK}} +* {{LOCALDOW}} +* {{LOCALTIMESTAMP}} !! result -

    / +

      +
    • 01 +
    • +
    • 1 +
    • +
    • January +
    • +
    • January +
    • +
    • Jan +
    • +
    • 1 +
    • +
    • 01 +
    • +
    • Thursday +
    • +
    • 1970 +
    • +
    • 00:02 +
    • +
    • 00 +
    • +
    • 1 +
    • +
    • 4 +
    • +
    • 19700101000203 +
    • +
    + +!! end + +!! test +Magic Word: {{FULLPAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +!! input +{{FULLPAGENAME}} +!! result +

    User:Ævar Arnfjörð Bjarmason

    !! end !! test -Magic Word: {{SERVER}} +Magic Word: {{FULLPAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{SERVER}} +{{FULLPAGENAMEE}} !! result -

    http://example.org +

    User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test -Magic Word: {{SERVERNAME}} +Magic Word: {{TALKSPACE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{SERVERNAME}} +{{TALKSPACE}} !! result -

    example.org +

    User talk

    !! end !! test -Magic Word: {{SITENAME}} +Magic Word: {{TALKSPACE}}, same namespace +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{SITENAME}} +{{TALKSPACE}} !! result -

    MediaWiki +

    User talk

    !! end !! test -Namespace 1 {{ns:1}} +Magic Word: {{TALKSPACE}}, main namespace +!! options +title=[[Parser Test]] !! input -{{ns:1}} +{{TALKSPACE}} !! result

    Talk

    !! end !! test -Namespace 1 {{ns:01}} +Magic Word: {{TALKSPACEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:01}} +{{TALKSPACEE}} !! result -

    Talk +

    User_talk

    !! end !! test -Namespace 0 {{ns:0}} (bug 4783) +Magic Word: {{SUBJECTSPACE}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{ns:0}} +{{SUBJECTSPACE}} !! result +

    User +

    +!! end +!! test +Magic Word: {{SUBJECTSPACE}}, same namespace +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +!! input +{{SUBJECTSPACE}} +!! result +

    User +

    !! end !! test -Namespace 0 {{ns:00}} (bug 4783) +Magic Word: {{SUBJECTSPACE}}, main namespace +!! options +title=[[Parser Test]] !! input -{{ns:00}} +{{SUBJECTSPACE}} !! result !! end !! test -Namespace -1 {{ns:-1}} +Magic Word: {{SUBJECTSPACEE}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{ns:-1}} +{{SUBJECTSPACEE}} !! result -

    Special +

    User

    !! end !! test -Namespace User {{ns:User}} +Magic Word: {{NAMESPACE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:User}} +{{NAMESPACE}} !! result

    User

    !! end !! test -Namespace User talk {{ns:User_talk}} +Magic Word: {{NAMESPACEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:User_talk}} +{{NAMESPACEE}} !! result -

    User talk +

    User

    !! end !! test -Namespace User talk {{ns:uSeR tAlK}} +Magic Word: {{NAMESPACENUMBER}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:uSeR tAlK}} +{{NAMESPACENUMBER}} !! result -

    User talk +

    2

    !! end !! test -Namespace File {{ns:File}} +Magic Word: {{SUBPAGENAME}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage !! input -{{ns:File}} +{{SUBPAGENAME}} !! result -

    File +

    sub ö

    !! end !! test -Namespace File {{ns:Image}} +Magic Word: {{SUBPAGENAMEE}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage !! input -{{ns:Image}} +{{SUBPAGENAMEE}} !! result -

    File +

    sub_%C3%B6

    !! end !! test -Namespace (lang=de) Benutzer {{ns:User}} +Magic Word: {{ROOTPAGENAME}} !! options -language=de +title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage !! input -{{ns:User}} +{{ROOTPAGENAME}} !! result -

    Benutzer +

    Ævar Arnfjörð Bjarmason

    !! end !! test -Namespace (lang=de) Benutzer Diskussion {{ns:3}} +Magic Word: {{ROOTPAGENAMEE}} !! options -language=de +title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage !! input -{{ns:3}} +{{ROOTPAGENAMEE}} !! result -

    Benutzer Diskussion +

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end - !! test -Urlencode +Magic Word: {{BASEPAGENAME}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub]] subpage !! input -{{urlencode:hi world?!}} -{{urlencode:hi world?!|WIKI}} -{{urlencode:hi world?!|PATH}} -{{urlencode:hi world?!|QUERY}} +{{BASEPAGENAME}} !! result -

    hi+world%3F%21 -hi_world%3F! -hi%20world%3F%21 -hi+world%3F%21 +

    Ævar Arnfjörð Bjarmason

    !! end -### -### Magic links -### !! test -Magic links: internal link to RFC (bug 479) +Magic Word: {{BASEPAGENAMEE}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub]] subpage !! input -[[RFC 123]] +{{BASEPAGENAMEE}} !! result -

    RFC 123 +

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test -Magic links: RFC (bug 479) +Magic Word: {{TALKPAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -RFC 822 +{{TALKPAGENAME}} !! result -

    RFC 822 +

    User talk:Ævar Arnfjörð Bjarmason

    !! end !! test -Magic links: ISBN (bug 1937) +Magic Word: {{TALKPAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -ISBN 0-306-40615-2 +{{TALKPAGENAMEE}} !! result -

    ISBN 0-306-40615-2 +

    User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test -Magic links: PMID incorrectly converts space to underscore +Magic Word: {{SUBJECTPAGENAME}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -PMID 1234 +{{SUBJECTPAGENAME}} !! result -

    PMID 1234 +

    User:Ævar Arnfjörð Bjarmason

    !! end -### -### Templates -#### - !! test -Nonexistent template +Magic Word: {{SUBJECTPAGENAMEE}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{thistemplatedoesnotexist}} +{{SUBJECTPAGENAMEE}} !! result -

    Template:Thistemplatedoesnotexist +

    User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test -Template with invalid target containing tags +Magic Word: {{NUMBEROFFILES}} !! input -{{ab|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +{{NUMBEROFFILES}} !! result -

    {{ab|foo|a=b|a = b}} +

    4

    !! end !! test -Template with invalid target containing unclosed tag +Magic Word: {{PAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{a|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +{{PAGENAME}} !! result -

    {{a|foo|a=b|a = b}} +

    Ævar Arnfjörð Bjarmason

    !! end -!! article -Template:test -!! text -This is a test template -!! endarticle - !! test -Simple template +Magic Word: {{PAGENAME}} with metacharacters +!! options +title=[['foo & bar = baz']] !! input -{{test}} +''{{PAGENAME}}'' !! result -

    This is a test template +

    'foo & bar = baz'

    !! end !! test -Template with explicit namespace +Magic Word: {{PAGENAME}} with metacharacters (bug 26781) +!! options +title=[[*RFC 1234 http://example.com/]] !! input -{{Template:test}} +{{PAGENAME}} !! result -

    This is a test template +

    *RFC 1234 http://example.com/

    !! end - -!! article -Template:paramtest -!! text -This is a test template with parameter {{{param}}} -!! endarticle - !! test -Template parameter +Magic Word: {{PAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{paramtest|param=foo}} +{{PAGENAMEE}} !! result -

    This is a test template with parameter foo +

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end -!! article -Template:paramtestnum -!! text -[[{{{1}}}|{{{2}}}]] -!! endarticle - !! test -Template unnamed parameter +Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781) +!! options +title=[[*RFC 1234 http://example.com/]] !! input -{{paramtestnum|Main Page|the main page}} +{{PAGENAMEE}} !! result -

    the main page +

    *RFC_1234_http://example.com/

    !! end -!! article -Template:templatesimple -!! text -(test) -!! endarticle - -!! article -Template:templateredirect -!! text -#redirect [[Template:templatesimple]] -!! endarticle - -!! article -Template:templateasargtestnum -!! text -{{{{{1}}}}} -!! endarticle - -!! article -Template:templateasargtest -!! text -{{template{{{templ}}}}} -!! endarticle - -!! article -Template:templateasargtest2 -!! text -{{{{{templ}}}}} -!! endarticle - !! test -Template with template name as unnamed argument +Magic Word: {{REVISIONID}} !! input -{{templateasargtestnum|templatesimple}} +{{REVISIONID}} !! result -

    (test) +

    1337

    !! end !! test -Template with template name as argument +Magic Word: {{SCRIPTPATH}} !! input -{{templateasargtest|templ=simple}} +{{SCRIPTPATH}} !! result -

    (test) +

    /

    !! end !! test -Template with template name as argument (2) +Magic Word: {{STYLEPATH}} !! input -{{templateasargtest2|templ=templatesimple}} +{{STYLEPATH}} !! result -

    (test) +

    /skins

    !! end -!! article -Template:templateasargtestdefault -!! text -{{{{{templ|templatesimple}}}}} -!! endarticle - -!! article -Template:templa -!! text -'''templ''' -!! endarticle - !! test -Template with default value +Magic Word: {{SERVER}} !! input -{{templateasargtestdefault}} +{{SERVER}} !! result -

    (test) +

    http://example.org

    !! end !! test -Template with default value (value set) +Magic Word: {{SERVERNAME}} !! input -{{templateasargtestdefault|templ=templa}} +{{SERVERNAME}} !! result -

    templ +

    example.org

    !! end !! test -Template redirect +Magic Word: {{SITENAME}} !! input -{{templateredirect}} +{{SITENAME}} !! result -

    (test) +

    MediaWiki

    !! end !! test -Template with argument in separate line +Case-sensitive magic words, when cased differently, should just be template transclusions !! input -{{ templateasargtest | - templ = simple }} +{{CurrentMonth}} +{{currentday}} +{{cURreNTweEK}} +{{currentHour}} !! result -

    (test) +

    Template:CurrentMonth +Template:Currentday +Template:CURreNTweEK +Template:CurrentHour

    !! end !! test -Template with complex template as argument +Case-insensitive magic words should still work with weird casing. !! input -{{paramtest| - param ={{ templateasargtest | - templ = simple }}}} +{{sErVeRNaMe}} +{{LCFirst:AOEU}} +{{ucFIRST:aoeu}} +{{SERver}} !! result -

    This is a test template with parameter (test) +

    example.org +aOEU +Aoeu +http://example.org

    !! end !! test -Template with thumb image (with link in description) +Namespace 1 {{ns:1}} !! input -{{paramtest| - param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} +{{ns:1}} !! result -This is a test template with parameter - +

    Talk +

    !! end -!! article -Template:complextemplate -!! text -{{{1}}} {{paramtest| - param ={{{param}}}}} -!! endarticle - !! test -Template with complex arguments +Namespace 1 {{ns:01}} !! input -{{complextemplate| - param ={{ templateasargtest | - templ = simple }}|[[Template:complextemplate|link]]}} +{{ns:01}} !! result -

    link This is a test template with parameter (test) +

    Talk

    !! end !! test -BUG 553: link with two variables in a piped link +Namespace 0 {{ns:0}} (bug 4783) !! input -{| -|[[{{{1}}}|{{{2}}}]] -|} +{{ns:0}} !! result - - -
    [[{{{1}}}|{{{2}}}]] -
    !! end !! test -Magic variable as template parameter +Namespace 0 {{ns:00}} (bug 4783) !! input -{{paramtest|param={{SITENAME}}}} +{{ns:00}} !! result -

    This is a test template with parameter MediaWiki -

    -!! end -!! article -Template:linktest -!! text -[[{{{param}}}|link]] -!! endarticle +!! end !! test -Template parameter as link source +Namespace -1 {{ns:-1}} !! input -{{linktest|param=Main Page}} +{{ns:-1}} !! result -

    link +

    Special

    !! end -!!test -Template-generated attribute string (k='v') -!!input -bar -!!result -

    bar +!! test +Namespace User {{ns:User}} +!! input +{{ns:User}} +!! result +

    User

    -!!end - -!!article -Template:paramtest2 -!! text -including another template, {{paramtest|param={{{arg}}}}} -!! endarticle +!! end !! test -Template passing argument to another template +Namespace User talk {{ns:User_talk}} !! input -{{paramtest2|arg='hmm'}} +{{ns:User_talk}} !! result -

    including another template, This is a test template with parameter 'hmm' +

    User talk

    !! end -!! article -Template:Linktest2 -!! text -Main Page -!! endarticle - !! test -Template as link source +Namespace User talk {{ns:uSeR tAlK}} !! input -[[{{linktest2}}]] - -[[{{linktest2}}|Main Page]] - -[[{{linktest2}}]]Page +{{ns:uSeR tAlK}} !! result -

    Main Page -

    Main Page -

    Main PagePage +

    User talk

    !! end +!! test +Namespace File {{ns:File}} +!! input +{{ns:File}} +!! result +

    File +

    +!! end -!! article -Template:loop1 -!! text -{{loop2}} -!! endarticle - -!! article -Template:loop2 -!! text -{{loop1}} -!! endarticle +!! test +Namespace File {{ns:Image}} +!! input +{{ns:Image}} +!! result +

    File +

    +!! end !! test -Template infinite loop +Namespace (lang=de) Benutzer {{ns:User}} +!! options +language=de !! input -{{loop1}} +{{ns:User}} !! result -

    Template loop detected: Template:Loop1 +

    Benutzer

    !! end !! test -Template from main namespace +Namespace (lang=de) Benutzer Diskussion {{ns:3}} +!! options +language=de !! input -{{:Main Page}} +{{ns:3}} !! result -

    blah blah +

    Benutzer Diskussion

    !! end -!! article -Template:table -!! text -{| -| 1 || 2 -|- -| 3 || 4 -|} -!! endarticle !! test -BUG 529: Template with table, not included at beginning of line +Urlencode !! input -foo {{table}} +{{urlencode:hi world?!}} +{{urlencode:hi world?!|WIKI}} +{{urlencode:hi world?!|PATH}} +{{urlencode:hi world?!|QUERY}} !! result -

    foo +

    hi+world%3F%21 +hi_world%3F! +hi%20world%3F%21 +hi+world%3F%21

    - - - - - - -
    1 2 -
    3 4 -
    +!! end +### +### Magic links +### +!! test +Magic links: internal link to RFC (bug 479) +!! input +[[RFC 123]] +!! result +

    RFC 123 +

    !! end !! test -BUG 523: Template shouldn't eat newline (or add an extra one before table) +Magic links: RFC (bug 479) !! input -foo -{{table}} +RFC 822 !! result -

    foo +

    RFC 822

    - - - - - - -
    1 2 -
    3 4 -
    +!! end +!! test +Magic links: ISBN (bug 1937) +!! input +ISBN 0-306-40615-2 +!! result +

    ISBN 0-306-40615-2 +

    !! end !! test -BUG 41: Template parameters shown as broken links +Magic links: PMID incorrectly converts space to underscore !! input -{{{parameter}}} +PMID 1234 !! result -

    {{{parameter}}} +

    PMID 1234

    !! end +### +### Templates +#### + !! test -Template with targets containing wikilinks +Nonexistent template !! input -{{[[foo]]}} +{{thistemplatedoesnotexist}} +!! result +

    Template:Thistemplatedoesnotexist +

    +!! end -{{[[{{echo|foo}}]]}} +!! test +Template with invalid target containing tags +!! input +{{ab|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +!! result +

    {{ab|foo|a=b|a = b}} +

    +!! end -{{{{echo|[[foo}}]]}} +!! test +Template with invalid target containing unclosed tag +!! input +{{a|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} !! result -

    {{foo}} -

    {{foo}} -

    {{[[foo}}]] +

    {{a|foo|a=b|a = b}}

    !! end !! article -Template:MSGNW test +Template:test !! text -''None'' of '''this''' should be -* interpreted - but rather passed unmodified -{{test}} +This is a test template !! endarticle -# hmm, fix this or just deprecate msgnw and document its behavior? !! test -msgnw keyword -!! options -disabled +Simple template !! input -{{msgnw:MSGNW test}} -!! result -

    ''None'' of '''this''' should be -* interpreted - but rather passed unmodified {{test}} +!! result +

    This is a test template

    !! end !! test -int keyword +Template with explicit namespace !! input -{{int:youhavenewmessages|lots of money|not!}} +{{Template:test}} !! result -

    You have lots of money (not!). +

    This is a test template

    !! end + !! article -Template:Includes +Template:paramtest !! text -Foozarbar +This is a test template with parameter {{{param}}} !! endarticle !! test - and being included +Template parameter !! input -{{Includes}} +{{paramtest|param=foo}} !! result -

    Foobar +

    This is a test template with parameter foo

    !! end !! article -Template:Includes2 +Template:paramtestnum !! text -Foobar +[[{{{1}}}|{{{2}}}]] !! endarticle !! test - being included +Template unnamed parameter !! input -{{Includes2}} +{{paramtestnum|Main Page|the main page}} !! result -

    Foo +

    the main page

    !! end +!! article +Template:templatesimple +!! text +(test) +!! endarticle + +!! article +Template:templateredirect +!! text +#redirect [[Template:templatesimple]] +!! endarticle !! article -Template:Includes3 +Template:templateasargtestnum !! text -Foobarzar +{{{{{1}}}}} +!! endarticle + +!! article +Template:templateasargtest +!! text +{{template{{{templ}}}}} +!! endarticle + +!! article +Template:templateasargtest2 +!! text +{{{{{templ}}}}} !! endarticle !! test - and being included +Template with template name as unnamed argument !! input -{{Includes3}} +{{templateasargtestnum|templatesimple}} !! result -

    Foo +

    (test)

    !! end !! test - and on a page +Template with template name as argument !! input -Foozarbar +{{templateasargtest|templ=simple}} !! result -

    Foozar +

    (test)

    !! end !! test -Un-closed +Template with template name as argument (2) !! input - +{{templateasargtest2|templ=templatesimple}} !! result +

    (test) +

    !! end +!! article +Template:templateasargtestdefault +!! text +{{{{{templ|templatesimple}}}}} +!! endarticle + +!! article +Template:templa +!! text +'''templ''' +!! endarticle + !! test - on a page +Template with default value !! input -Foobar +{{templateasargtestdefault}} !! result -

    Foobar +

    (test)

    !! end !! test -Un-closed +Template with default value (value set) !! input - +{{templateasargtestdefault|templ=templa}} !! result +

    templ +

    !! end -!!test -Self-closed noinclude, includeonly, onlyinclude tags -!!input - - - -!!result -


    +!! test +Template redirect +!! input +{{templateredirect}} +!! result +

    (test)

    -!!end - -!!test -Unbalanced includeonly and noinclude tags -!!input -{| -|a
    -|b
    -|c
    -|d
    -|} -!!result - - - - - -
    a -b -c</includeonly> -d</includeonly></includeonly> -
    - -!!end - -!! article -Template:Includeonly section -!! text - -==Includeonly section== - -==Section T-1== -!!endarticle +!! end !! test -Bug 6563: Edit link generation for section shown by +Template with argument in separate line !! input -{{includeonly section}} +{{ templateasargtest | + templ = simple }} !! result -

    [edit] Includeonly section

    -

    [edit] Section T-1

    - +

    (test) +

    !! end -# Uses same input as the contents of [[Template:Includeonly section]] !! test -Bug 6563: Section extraction for section shown by -!! options -section=T-2 +Template with complex template as argument !! input - -==Includeonly section== - -==Section T-2== +{{paramtest| + param ={{ templateasargtest | + templ = simple }}}} !! result -==Section T-2== +

    This is a test template with parameter (test) +

    !! end !! test -Bug 6563: Edit link generation for section suppressed by +Template with thumb image (with link in description) !! input - -==Includeonly section== - -==Section 1== +{{paramtest| + param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! result -

    [edit] Section 1

    +This is a test template with parameter !! end +!! article +Template:complextemplate +!! text +{{{1}}} {{paramtest| + param ={{{param}}}}} +!! endarticle + !! test -Bug 6563: Section extraction for section suppressed by -!! options -section=1 +Template with complex arguments !! input - -==Includeonly section== - -==Section 1== +{{complextemplate| + param ={{ templateasargtest | + templ = simple }}|[[Template:complextemplate|link]]}} !! result -==Section 1== +

    link This is a test template with parameter (test) +

    !! end !! test -Un-closed +BUG 553: link with two variables in a piped link !! input - +{| +|[[{{{1}}}|{{{2}}}]] +|} !! result + + +
    [[{{{1}}}|{{{2}}}]] +
    + !! end -### -### and in attributes -### -!!test -0. includeonly around the entire attribute -!!input -id="v1"id="v2">bar -!!result -

    bar +!! test +Magic variable as template parameter +!! input +{{paramtest|param={{SITENAME}}}} +!! result +

    This is a test template with parameter MediaWiki

    -!!end +!! end -!!test -1. includeonly in html attr key -!!input -idabout="foo">bar -!!result -

    bar +!! article +Template:linktest +!! text +[[{{{param}}}|link]] +!! endarticle + +!! test +Template parameter as link source +!! input +{{linktest|param=Main Page}} +!! result +

    link

    -!!end +!! end !!test -2. includeonly in html attr value +Template-generated attribute string (k='v') !!input -bar -"v1""v2">bar +bar !!result

    bar -bar

    !!end -!!test -3. includeonly in part of an attr value -!!input -bar -!!result -

    bar -

    -!!end +!!article +Template:paramtest2 +!! text +including another template, {{paramtest|param={{{arg}}}}} +!! endarticle -### -### Testing parsing of templates where a template arg -### has the same name as the template itself. -### +!! test +Template passing argument to another template +!! input +{{paramtest2|arg='hmm'}} +!! result +

    including another template, This is a test template with parameter 'hmm' +

    +!! end !! article -Template:quote +Template:Linktest2 !! text -{{{quote|{{{1}}}}}} +Main Page !! endarticle -!!test -Templates: Template Name/Arg clash: 1. Use of positional param -!!input -{{quote|foo}} -!!result -

    foo -

    -!!end +!! test +Template as link source +!! input +[[{{linktest2}}]] -!!test -Templates: Template Name/Arg clash: 2. Use of named param -!!input -{{quote|quote=foo}} -!!result -

    foo -

    -!!end +[[{{linktest2}}|Main Page]] -!!test -Templates: Template Name/Arg clash: 3. Use of named param with empty input -!!input -{{quote|quote}} -!!result -

    quote +[[{{linktest2}}]]Page +!! result +

    Main Page +

    Main Page +

    Main PagePage

    -!!end +!! end -### -### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged -### -!!test -Templates: 1. Simple use -!!input -{{echo|Foo}} -!!result -

    Foo -

    -!!end - -!!test -Templates: 2. Inside a block tag -!!input -
    {{echo|Foo}}
    -!!result -
    Foo
    +!! article +Template:loop1 +!! text +{{loop2}} +!! endarticle -!!end +!! article +Template:loop2 +!! text +{{loop1}} +!! endarticle -!!test -Templates: P-wrapping: 1a. Templates on consecutive lines -!!input -{{echo|Foo}} -{{echo|bar}} -!!result -

    Foo -bar +!! test +Template infinite loop +!! input +{{loop1}} +!! result +

    Template loop detected: Template:Loop1

    -!!end - -!!test -Templates: P-wrapping: 1b. Templates on consecutive lines -!!input -Foo +!! end -{{echo|bar}} -{{echo|baz}} -!!result -

    Foo -

    bar -baz +!! test +Template from main namespace +!! input +{{:Main Page}} +!! result +

    blah blah

    -!!end +!! end -!!test -Templates: P-wrapping: 1c. Templates on consecutive lines -!!input -{{echo|Foo}} -{{echo|bar}}
    baz
    -!!result -

    Foo +!! article +Template:table +!! text +{| +| 1 || 2 +|- +| 3 || 4 +|} +!! endarticle + +!! test +BUG 529: Template with table, not included at beginning of line +!! input +foo {{table}} +!! result +

    foo

    -bar
    baz
    + + + + + + +
    1 2 +
    3 4 +
    -!!end +!! end -!!test -Templates: Inline Text: 1. Multiple tmeplate uses -!!input -{{echo|Foo}}bar{{echo|baz}} -!!result -

    Foobarbaz +!! test +BUG 523: Template shouldn't eat newline (or add an extra one before table) +!! input +foo +{{table}} +!! result +

    foo

    -!!end + + + + + + +
    1 2 +
    3 4 +
    -!!test -Templates: Inline Text: 2. Back-to-back template uses -!!input -{{echo|Foo}}{{echo|bar}} -!!result -

    Foobar +!! end + +!! test +BUG 41: Template parameters shown as broken links +!! input +{{{parameter}}} +!! result +

    {{{parameter}}}

    -!!end +!! end -!!test -Templates: Block Tags: 1. Multiple template uses -!!input -{{echo|
    Foo
    }}
    bar
    {{echo|
    baz
    }} -!!result -
    Foo
    bar
    baz
    +!! test +Template with targets containing wikilinks +!! input +{{[[foo]]}} -!!end +{{[[{{echo|foo}}]]}} -!!test -Templates: Block Tags: 2. Back-to-back template uses -!!input -{{echo|
    Foo
    }}{{echo|
    bar
    }} -!!result -
    Foo
    bar
    +{{{{echo|[[foo}}]]}} +!! result +

    {{foo}} +

    {{foo}} +

    {{[[foo}}]] +

    +!! end -!!end +!! article +Template:MSGNW test +!! text +''None'' of '''this''' should be +* interpreted + but rather passed unmodified +{{test}} +!! endarticle -!!test -Templates: Links: 1. Simple example -!!input -{{echo|[[Foo|bar]]}} -!!result -

    bar +# hmm, fix this or just deprecate msgnw and document its behavior? +!! test +msgnw keyword +!! options +disabled +!! input +{{msgnw:MSGNW test}} +!! result +

    ''None'' of '''this''' should be +* interpreted + but rather passed unmodified +{{test}}

    -!!end +!! end -!!test -Templates: Links: 2. Generation of link href -!!input -[[{{echo|Foo}}|bar]] -!!result -

    bar +!! test +int keyword +!! input +{{int:youhavenewmessages|lots of money|not!}} +!! result +

    You have lots of money (not!).

    -!!end - -!!test -Templates: Links: 3. Generation of part of a link href -!!input -[[Fo{{echo|o}}|bar]] - -[[Foo{{echo|bar}}]] +!! end -[[Foo{{echo|bar}}baz]] +!! article +Template:Includes +!! text +Foozarbar +!! endarticle -[[Foo{{echo|bar}}|bar]] +!! test + and being included +!! input +{{Includes}} +!! result +

    Foobar +

    +!! end -[[:Foo{{echo|bar}}]] +!! article +Template:Includes2 +!! text +Foobar +!! endarticle -[[:Foo{{echo|bar}}|bar]] -!!result -

    bar -

    Foobar -

    Foobarbaz -

    bar -

    Foobar -

    bar +!! test + being included +!! input +{{Includes2}} +!! result +

    Foo

    -!!end +!! end -!!test -Templates: Links: 4. Multiple templates generating link href -!!input -[[{{echo|F}}{{echo|o}}ob{{echo|ar}}]] -!!result -

    Foobar -

    -!!end -!!test -Templates: Links: 5. Generation of link text -!!input -[[Foo|{{echo|bar}}]] -!!result -

    bar +!! article +Template:Includes3 +!! text +Foobarzar +!! endarticle + +!! test + and being included +!! input +{{Includes3}} +!! result +

    Foo

    -!!end +!! end + +!! test + and on a page +!! input +Foozarbar +!! result +

    Foozar +

    +!! end + +!! test +Un-closed +!! input + +!! result +!! end + +!! test + on a page +!! input +Foobar +!! result +

    Foobar +

    +!! end + +!! test +Un-closed +!! input + +!! result +!! end !!test -Templates: Links: 5. Nested templates (only outermost template should be marked) +Self-closed noinclude, includeonly, onlyinclude tags !!input -{{echo|[[{{echo|Foo}}|bar]]}} + + + !!result -

    bar +


    !!end !!test -Templates: HTML Tag: 1. Generation of HTML attr. key +Unbalanced includeonly and noinclude tags !!input -
    foo
    +{| +|a
    +|b
    +|c
    +|d
    +|} !!result -
    foo
    + + + + + +
    a +b +c</includeonly> +d</includeonly></includeonly> +
    !!end -!!test -Templates: HTML Tag: 2. Generation of HTML attr. value -!!input -
    foo
    -!!result -
    foo
    +!! article +Template:Includeonly section +!! text + +==Includeonly section== + +==Section T-1== +!!endarticle + +!! test +Bug 6563: Edit link generation for section shown by +!! input +{{includeonly section}} +!! result +

    Includeonly section[edit]

    +

    Section T-1[edit]

    + +!! end + +# Uses same input as the contents of [[Template:Includeonly section]] +!! test +Bug 6563: Section extraction for section shown by +!! options +section=T-2 +!! input + +==Includeonly section== + +==Section T-2== +!! result +==Section T-2== +!! end + +!! test +Bug 6563: Edit link generation for section suppressed by +!! input + +==Includeonly section== + +==Section 1== +!! result +

    Section 1[edit]

    + +!! end + +!! test +Bug 6563: Section extraction for section suppressed by +!! options +section=1 +!! input + +==Includeonly section== + +==Section 1== +!! result +==Section 1== +!! end + +!! test +Un-closed +!! input + +!! result +!! end + +# TODO: test with DOM fragment reuse! +!! test +Parsoid: DOM fragment reuse +!! options +parsoid=wt2wt,wt2html +!! input +a{{echo|b
    c}}d + +a{{echo|b +
    +c}}d + +{{echo|a + +
    + +b}} +!! result +ab +
    cd + + +

    ab

    + +
    + +

    cd

    -!!end +

    a

    + + +
    + + +

    b

    +!! end + +!! test +Parsoid: Merge double tds (bug 50603) +!! options +parsoid +!! input +{| +|{{echo|{{!}} foo}} +|} +!! result + + +
    foo
    +!! end + +!! test +Parsoid: Merge double tds in nested transclusion content (bug 50603) +!! options +parsoid +!! input +{{echo|
    }} +{| +|{{echo|{{!}} foo}} +|} +{{echo|
    }} +!! result +
    + + +
    foo
    +
    +!! end + +### +### and in attributes +### !!test -Templates: HTML Tag: 3. Generation of HTML attr key and value +0. includeonly around the entire attribute !!input -
    foo
    +id="v1"
    id="v2">bar !!result -
    foo
    - +

    bar +

    !!end !!test -Templates: HTML Tag: 4. Generation of starting piece of HTML attr value +1. includeonly in html attr key !!input -
    foo
    +idabout="foo">bar !!result -
    foo
    - +

    bar +

    !!end !!test -Templates: HTML Tag: 5. Generation of middle piece of HTML attr value +2. includeonly in html attr value !!input -
    foo
    +bar +"v1""v2">bar !!result -
    foo
    - +

    bar +bar +

    !!end !!test -Templates: HTML Tag: 6. Generation of end piece of HTML attr value +3. includeonly in part of an attr value !!input -
    foo
    +bar !!result -
    foo
    - +

    bar +

    !!end +### +### Testing parsing of templates where a template arg +### has the same name as the template itself. +### + +!! article +Template:quote +!! text +{{{quote|{{{1}}}}}} +!! endarticle + !!test -Templates: HTML Tables: 1. Generating start of a HTML table +Templates: Template Name/Arg clash: 1. Use of positional param !!input -{{echo|}}
    foo
    +{{quote|foo}} !!result -
    foo
    - +

    foo +

    !!end !!test -Templates: HTML Tables: 2a. Generating middle of a HTML table +Templates: Template Name/Arg clash: 2. Use of named param !!input -{{echo|}}
    foo
    +{{quote|quote=foo}} !!result -
    foo
    - +

    foo +

    !!end !!test -Templates: HTML Tables: 2b. Generating middle of a HTML table +Templates: Template Name/Arg clash: 3. Use of named param with empty input !!input -{{echo|}}
    foo
    +{{quote|quote}} !!result -
    foo
    - +

    quote +

    !!end +### +### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged +### + !!test -Templates: HTML Tables: 3. Generating end of a HTML table +Templates: 1. Simple use !!input -{{echo|
    foo
    }} +{{echo|Foo}} !!result -
    foo
    - +

    Foo +

    !!end !!test -Templates: HTML Tables: 4a. Generating a single tag of a HTML table +Templates: 2. Inside a block tag !!input -{{echo|}}
    foo
    +
    {{echo|Foo}}
    +
    {{echo|Foo}}
    !!result -
    foo
    +
    Foo
    +
    Foo
    !!end !!test -Templates: HTML Tables: 4b. Generating a single tag of a HTML table +Templates: P-wrapping: 1a. Templates on consecutive lines !!input -{{echo|}}
    foo
    +{{echo|Foo}} +{{echo|bar}} !!result -
    foo
    +

    Foo +bar +

    +!!end + +!!test +Templates: P-wrapping: 1b. Templates on consecutive lines +!!input +Foo +{{echo|bar}} +{{echo|baz}} +!!result +

    Foo +

    bar +baz +

    !!end !!test -Templates: HTML Tables: 4c. Generating a single tag of a HTML table +Templates: P-wrapping: 1c. Templates on consecutive lines !!input -{{echo|
    }}foo
    +{{echo|Foo}} +{{echo|bar}}
    baz
    !!result -
    foo
    +

    Foo +

    +bar
    baz
    !!end !!test -Templates: HTML Tables: 4d. Generating a single tag of a HTML table +Templates: P-wrapping: 1d. Template preceded by comment-only line +!!options +parsoid !!input -}}
    foo{{echo|
    + +{{echo|Bar}} !!result -
    foo
    + +

    Bar

    !!end !!test -Templates: HTML Tables: 4e. Generating a single tag of a HTML table +Templates: Inline Text: 1. Multiple tmeplate uses !!input -{{echo|}}
    foo
    +{{echo|Foo}}bar{{echo|baz}} !!result -
    foo
    +

    Foobarbaz +

    +!!end +!!test +Templates: Inline Text: 2. Back-to-back template uses +!!input +{{echo|Foo}}{{echo|bar}} +!!result +

    Foobar +

    !!end !!test -Templates: HTML Tables: 4f. Generating a single tag of a HTML table +Templates: Block Tags: 1. Multiple template uses !!input -{{echo|
    foo
    }} +{{echo|
    Foo
    }}
    bar
    {{echo|
    baz
    }} !!result -
    foo
    +
    Foo
    bar
    baz
    !!end !!test -Templates: Wiki Tables: 1a. Fostering of entire template content +Templates: Block Tags: 2. Back-to-back template uses !!input -{| -{{echo|a}} -|} +{{echo|
    Foo
    }}{{echo|
    bar
    }} !!result - -a -
    +
    Foo
    bar
    !!end !!test -Templates: Wiki Tables: 1b. Fostering of entire template content +Templates: Links: 1. Simple example !!input -{| -{{echo|
    }} -foo -{{echo|
    }} -|} +{{echo|[[Foo|bar]]}} !!result - -
    -

    foo +

    bar

    -
    -
    +!!end +!!test +Templates: Links: 2. Generation of link href +!!input +[[{{echo|Foo}}|bar]] +!!result +

    bar +

    !!end !!test -Templates: Wiki Tables: 2. Fostering of partial template content +Templates: Links: 3. Generation of part of a link href !!input -{| -{{echo|a -
    b
    }} -|} +[[Fo{{echo|o}}|bar]] + +[[Foo{{echo|bar}}]] + +[[Foo{{echo|bar}}baz]] + +[[Foo{{echo|bar}}|bar]] + +[[:Foo{{echo|bar}}]] + +[[:Foo{{echo|bar}}|bar]] !!result - -a -
    b
    -
    +

    bar +

    Foobar +

    Foobarbaz +

    bar +

    Foobar +

    bar +

    +!!end +!!test +Templates: Links: 4. Multiple templates generating link href +!!input +[[{{echo|F}}{{echo|o}}ob{{echo|ar}}]] +!!result +

    Foobar +

    !!end !!test -Templates: Wiki Tables: 3. td-content via multiple templates +Templates: Links: 5. Generation of link text !!input -{| -{{echo|{{pipe}}a}}{{echo|b}} -|} +[[Foo|{{echo|bar}}]] !!result - - -
    ab -
    +

    bar +

    +!!end +!!test +Templates: Links: 5. Nested templates (only outermost template should be marked) +!!input +{{echo|[[{{echo|Foo}}|bar]]}} +!!result +

    bar +

    !!end !!test -Templates: Wiki Tables: 4. Templated tags, no content +Templates: HTML Tag: 1. Generation of HTML attr. key !!input -{{tbl-start}} -{{tbl-end}} +
    foo
    !!result - -
    +
    foo
    !!end !!test -Templates: Wiki Tables: 5. Templated tags, regular td-tags +Templates: HTML Tag: 2. Generation of HTML attr. value !!input -{{tbl-start}} -|foo -{{tbl-end}} +
    foo
    !!result - - -
    foo -
    +
    foo
    !!end !!test -Templates: Wiki Tables: 6. Templated tags, templated td-tags +Templates: HTML Tag: 3. Generation of HTML attr key and value !!input -{{tbl-start}} -{{!}}foo -{{tbl-end}} +
    foo
    !!result - - -
    foo -
    +
    foo
    !!end !!test -Templates: Lists: Multi-line list-items via templates +Templates: HTML Tag: 4. Generation of starting piece of HTML attr value !!input -*{{echo|a {{nonexistent| -unused}}}} -*{{echo|b {{nonexistent| -unused}}}} +
    foo
    !!result - +
    foo
    !!end !!test -Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) +Templates: HTML Tag: 5. Generation of middle piece of HTML attr value !!input -{{echo|''a}}{{echo|b''c''d}}{{echo|''e}} +
    foo
    !!result -

    abcde -

    +
    foo
    + !!end !!test -Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) -(PHP parser generates misnested html) -!! options -disabled +Templates: HTML Tag: 6. Generation of end piece of HTML attr value !!input -{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} +
    foo
    !!result -

    abcde

    +
    foo
    + !!end !!test -Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) -(PHP parser generates misnested html) -!! options -disabled +Templates: HTML Tag: 7. Generation of partial attribute key string !!input -{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} +
    foo
    !!result -
    a
    -
    bcd
    -
    e
    +
    foo
    + !!end !!test -Templates: Ugly nesting: 4. Divs opened/closed across templates +Templates: HTML Tables: 1. Generating start of a HTML table !!input -a
    b{{echo|c
    d}}e +{{echo|}}
    foo
    !!result -a
    bc
    de +
    foo
    !!end !!test -Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting -(Parsoid-centric) -!! options -parsoid +Templates: HTML Tables: 2a. Generating middle of a HTML table !!input -{| -|{{echo|foo}} -|bar -|} +{{echo|}}
    foo
    !!result - -
    foo
    -bar - +
    foo
    + !!end !!test -Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting -(Parsoid-centric) -!! options +Templates: HTML Tables: 2b. Generating middle of a HTML table +!!input +{{echo|}}
    foo
    +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 3. Generating end of a HTML table +!!input +{{echo|
    foo
    }} +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 4a. Generating a single tag of a HTML table +!!input +{{echo|}}
    foo
    +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 4b. Generating a single tag of a HTML table +!!input +{{echo|}}
    foo
    +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 4c. Generating a single tag of a HTML table +!!input +{{echo|
    }}foo
    +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 4d. Generating a single tag of a HTML table +!!input +}}
    foo{{echo|
    +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 4e. Generating a single tag of a HTML table +!!input +{{echo|}}
    foo
    +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 4f. Generating a single tag of a HTML table +!!input +{{echo|
    foo
    }} +!!result +
    foo
    + +!!end + +!!test +Templates: HTML Tables: 5. Proper fostering of categories from inside +!!options +parsoid=wt2html,wt2wt +!!input +[[Category:foo1]]
    foo
    + +[[Category:bar1]][[Category:bar2]]
    foo
    +!!result +
    foo
    + +
    foo
    +!!end + +!!test +Templates: Wiki Tables: 1a. Fostering of entire template content +!!input +{| +{{echo|a}} +|} +!!result + +a +
    + +!!end + +!!test +Templates: Wiki Tables: 1b. Fostering of entire template content +!!input +{| +{{echo|
    }} +foo +{{echo|
    }} +|} +!!result + +
    +

    foo +

    +
    +
    + +!!end + +!!test +Templates: Wiki Tables: 2. Fostering of partial template content +!!input +{| +{{echo|a +
    b
    }} +|} +!!result + +a +
    b
    +
    + +!!end + +!!test +Templates: Wiki Tables: 3. td-content via multiple templates +!!input +{| +{{echo|{{pipe}}a}}{{echo|b}} +|} +!!result + + +
    ab +
    + +!!end + +!!test +Templates: Wiki Tables: 4. Templated tags, no content +!!input +{{tbl-start}} +{{tbl-end}} +!!result + +
    + +!!end + +!!test +Templates: Wiki Tables: 5. Templated tags, regular td-tags +!!input +{{tbl-start}} +|foo +{{tbl-end}} +!!result + + +
    foo +
    + +!!end + +!!test +Templates: Wiki Tables: 6. Templated tags, templated td-tags +!!input +{{tbl-start}} +{{!}}foo +{{tbl-end}} +!!result + + +
    foo +
    + +!!end + +!!test +Templates: Lists: Multi-line list-items via templates +!!input +*{{echo|a {{nonexistent| +unused}}}} +*{{echo|b {{nonexistent| +unused}}}} +!!result + + +!!end + +!!test +Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) +!!input +{{echo|''a}}{{echo|b''c''d}}{{echo|''e}} +!!result +

    abcde +

    +!!end + +!!test +Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) +(PHP parser generates misnested html) +!! options +parsoid +!!input +{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} +!!result +

    abcde

    +!!end + +!!test +Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) +(PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s) +!! options +parsoid=wt2html,wt2wt +!!input +{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} +!!result +
    a
    +
    bcd
    +
    e
    +!!end + +!!test +Templates: Ugly nesting: 4. Divs opened/closed across templates +!!input +a
    b{{echo|c
    d}}e +!!result +a
    bc
    de + +!!end + +!!test +Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting +(Parsoid-centric) +!! options +parsoid +!!input +{| +|{{echo|foo}} +|bar +|} +!!result + + + + +
    foo
    +bar + +!!end + +!!test +Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting +(Parsoid-centric) +!! options parsoid !!input @@ -6058,24 +8487,24 @@ parsoid
    !!result - - - - -
    - - -
    1. foo
    bar 2. baz
    - - - abc - - - - - - xyz - + + + + +
    + + +
    1. foo
    bar 2. baz
    + + + abc + + + + + + xyz + !!end @@ -6237,10 +8666,13 @@ wikinowiki But just in case it doesn't... !! result -

    [edit] =

    +

    =[edit]

    The line above must have a trailing space!

    -

    [edit] =

    +

    =[edit]

    But just in case it doesn't...

    !! end @@ -7811,7 +10836,7 @@ section 5 !! result

    The tooltips shall not show entities to the user (ie. be double escaped)

    -

    Contents

    +

    Contents

    -
    -

    [edit] text > text

    +
  • + +

    text > text[edit]

    section 1

    -

    [edit] text < text

    +

    text < text[edit]

    section 2

    -

    [edit] text & text

    +

    text & text[edit]

    section 3

    -

    [edit] text ' text

    +

    text ' text[edit]

    section 4

    -

    [edit] text " text

    +

    text " text[edit]

    section 5

    !! end @@ -7846,18 +10872,59 @@ Headers with excess '=' characters =''italic'' heading== ==''italic'' heading= !! result -

    Contents

    +
    -

    [edit] foo=

    -

    [edit] =foo

    -

    [edit] italic heading=

    -

    [edit] =italic heading

    +
    + +

    foo=[edit]

    +

    =foo[edit]

    +

    italic heading=[edit]

    +

    =italic heading[edit]

    + +!! end + +!! test +HTML headers vs TOC (bug 23393) +(__NOEDITSECTION__ for clearer output, doesn't matter here) +!! input +

    Header 1

    +== Header 1.1 == +== Header 1.2 == + +

    Header 2 +

    +== Header 2.1 == +== Header 2.2 == +__NOEDITSECTION__ +!! result + + +

    Header 1

    +

    Header 1.1

    +

    Header 1.2

    +

    Header 2

    +

    Header 2.1

    +

    Header 2.2

    !! end @@ -7953,7 +11020,7 @@ div with illegal double attributes !! test div with empty attribute value, space before equals !! options -disabled +parsoid !! input
    HTML rocks
    !! result @@ -7966,7 +11033,7 @@ disabled !! test div with braces in attribute value !! options -disabled +parsoid !! input
    Foo
    !! result @@ -7983,7 +11050,7 @@ disabled !! test div with empty attribute value, no space before equals !! options -disabled +parsoid !! input
    HTML rocks
    !! result @@ -8078,6 +11145,81 @@ I always thought &xacute; was a cute letter. !! end +### +### Nesting tests (see bug 41545, 50604, 51081) +### + +# This test case is fixed in Parsoid by domino 1.0.12. (bug 50604) +# Note that html2wt is considerably more difficult if we use in +# the test case, instead of +!! test +Ensure that HTML adoption agency algorithm is properly implemented. +!! input +XYZ +!! result +

    XYZ +

    +!! end + +# This was bug 41545 in the PHP parser. +!! test +Nesting of +!! input +XYZ +!! result +

    XYZ +

    +!! end + +# The following cases were bug 51081 in the PHP parser. +# Note that there are some other nestable tags (b, i, etc) which are +# not covered; see bug 51081 for discussion. +!! test +Nesting of +!! input +XYZ +!! result +

    XYZ +

    +!! end + +!! test +Nesting of +!! input +XYZ +!! result +

    XYZ +

    +!! end + +!! test +Nesting of +!! input +XYZ +!! result +

    XYZ +

    +!! end + +!! test +Nesting of +!! input +XYZ +!! result +

    XYZ +

    +!! end + +!! test +Nesting of +!! input +XYZ +!! result +

    XYZ +

    +!! end + + ### ### Media links ### @@ -8470,70 +11612,6 @@ MSIE CSS safety test: comment in expression !! end -!! test -CSS safety test: vertical tab -!! input -

    A

    -!! result -

    A

    - -!! end - -!! test -MSIE CSS safety test: Fullwidth -!! input -

    A

    -
    B
    -!! result -

    A

    -
    B
    - -!! end - -!! test -MSIE CSS safety test: IPA extensions -!! input -
    A
    -

    B

    -!! result -
    A
    -

    B

    - -!! end - -!! test -MSIE CSS safety test: sup/sub script -!! input -
    A
    -
    B
    -

    C

    -!! result -
    A
    -
    B
    -

    C

    - -!! end - -!! test -MSIE CSS safety test: Repetition markers -!! input -

    A

    -

    B

    -

    C

    -

    D

    -

    E

    -

    F

    -

    G

    -!! result -

    A

    -

    B

    -

    C

    -

    D

    -

    E

    -

    F

    -

    G

    - -!! end !! test Table attribute legitimate extension @@ -8617,7 +11695,7 @@ Expansion of multi-line templates in attribute values (bug 6255 sanity check 2) !! end ### -### Parser hooks (see maintenance/parserTestsParserHook.php for the extension) +### Parser hooks (see tests/parser/parserTestsParserHook.php for the extension) ### !! test Parser hook: empty input @@ -8782,7 +11860,7 @@ array ( !! end ### -### (see maintenance/parserTestsStaticParserHook.php for the extension) +### (see tests/parser/parserTestsParserHook.php for the extension) ### !! test @@ -9014,11 +12092,13 @@ disabled !! result
    • One -
    • Two -
    - -!! end - + +
  • Two +
  • + + +!! end + !! test HTML ordered list, closed tags (bug 5497) !! input @@ -9046,8 +12126,10 @@ disabled !! result
    1. One -
    2. Two -
    + +
  • Two +
  • + !! end @@ -9092,12 +12174,16 @@ disabled !! result
    • One -
    • Two: +
    • +
    • Two:
      • Sub-one -
      • Sub-two -
      -
    + +
  • Sub-two +
  • + + + !! end @@ -9142,21 +12228,27 @@ disabled !! result
    1. One -
    2. Two: +
    3. +
    4. Two:
      1. Sub-one -
      2. Sub-two -
      -
    + +
  • Sub-two +
  • + + + !! end !! test HTML ordered list item with parameters oddity !! input -
    1. One
    +
    1. One
    2. +
    !! result -
    1. One
    +
    1. One
    2. +
    !! end @@ -9208,12 +12300,13 @@ Fuzz testing: Parser14 == onmouseover= == http://__TOC__ !! result -

    [edit] onmouseover=

    -http://

    Contents

    +

    onmouseover=[edit]

    +http://

    Contents

    -
    + + !! end @@ -9223,7 +12316,7 @@ Fuzz testing: Parser14-table ==a== {| STYLE=__TOC__ !! result -

    [edit] a

    +

    a[edit]

    @@ -9369,7 +12462,7 @@ Fuzz testing: image with bogus manual thumbnail !!input [[Image:foobar.jpg|thumbnail= ]] !!result -
    Error creating thumbnail:
    +
    Error creating thumbnail:
    !!end @@ -10380,17 +13473,33 @@ Handling of in URLs !! input **irc:// a !! result - + !!end !! test -5 quotes, code coverage +1 line +5 quotes, code coverage +1 line (php) +!! options +php +!! input +''''' +!! result +!! end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +5 quotes, code coverage +1 line (parsoid) +!! options +parsoid !! input ''''' !! result +

    !! end !! test @@ -10404,43 +13513,78 @@ Special:Search page linking. !! test Say the magic word +!! options +title=[[Parser test]] !! input * {{PAGENAME}} +* {{PAGENAMEE}} +* {{FULLPAGENAME}} +* {{FULLPAGENAMEE}} * {{BASEPAGENAME}} +* {{BASEPAGENAMEE}} * {{SUBPAGENAME}} * {{SUBPAGENAMEE}} -* {{BASEPAGENAME}} -* {{BASEPAGENAMEE}} +* {{ROOTPAGENAME}} +* {{ROOTPAGENAMEE}} * {{TALKPAGENAME}} * {{TALKPAGENAMEE}} * {{SUBJECTPAGENAME}} * {{SUBJECTPAGENAMEE}} * {{NAMESPACEE}} * {{NAMESPACE}} +* {{NAMESPACENUMBER}} * {{TALKSPACE}} * {{TALKSPACEE}} * {{SUBJECTSPACE}} * {{SUBJECTSPACEE}} * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}} !! result -
    • Parser test -
    • Parser test -
    • Parser test -
    • Parser_test -
    • Parser test -
    • Parser_test -
    • Talk:Parser test -
    • Talk:Parser_test -
    • Parser test -
    • Parser_test -
    • -
    • -
    • Talk -
    • Talk -
    • -
    • -
    • Template:Dynamic -
    +
      +
    • Parser test +
    • +
    • Parser_test +
    • +
    • Parser test +
    • +
    • Parser_test +
    • +
    • Parser test +
    • +
    • Parser_test +
    • +
    • Parser test +
    • +
    • Parser_test +
    • +
    • Parser test +
    • +
    • Parser_test +
    • +
    • Talk:Parser test +
    • +
    • Talk:Parser_test +
    • +
    • Parser test +
    • +
    • Parser_test +
    • +
    • +
    • +
    • +
    • +
    • 0 +
    • +
    • Talk +
    • +
    • Talk +
    • +
    • +
    • +
    • +
    • +
    • Template:Dynamic +
    • +
    !! end ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included. @@ -10459,40 +13603,40 @@ image4 |300px| centre * image6 !! result -