From 3f8de2d17517d63a61726039a8b1d61b627ca625 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 31 May 2011 02:09:22 +0000 Subject: [PATCH] Tests for r88883, including two failing tests. --- .../phpunit/includes/FindIE6ExtensionTest.php | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 tests/phpunit/includes/FindIE6ExtensionTest.php diff --git a/tests/phpunit/includes/FindIE6ExtensionTest.php b/tests/phpunit/includes/FindIE6ExtensionTest.php new file mode 100644 index 0000000000..d1d534144a --- /dev/null +++ b/tests/phpunit/includes/FindIE6ExtensionTest.php @@ -0,0 +1,102 @@ +assertEquals( + WebRequest::findIE6Extension( 'x.y' ), + 'y', + 'Simple extension' + ); + } + + function testSimpleNoExt() { + $this->assertEquals( + WebRequest::findIE6Extension( 'x' ), + '', + 'No extension' + ); + } + + function testEmpty() { + $this->assertEquals( + WebRequest::findIE6Extension( '' ), + '', + 'Empty string' + ); + } + + function testQuestionMark() { + $this->assertEquals( + WebRequest::findIE6Extension( '?' ), + '', + 'Question mark only' + ); + } + + function testExtQuestionMark() { + $this->assertEquals( + WebRequest::findIE6Extension( '.x?' ), + 'x', + 'Extension then question mark' + ); + } + + function testQuestionMarkExt() { + $this->assertEquals( + WebRequest::findIE6Extension( '?.x' ), + 'x', + 'Question mark then extension' + ); + } + + function testInvalidChar() { + $this->assertEquals( + WebRequest::findIE6Extension( '.x*' ), + '', + 'Extension with invalid character' + ); + } + + function testMultipleQuestionMarks() { + $this->assertEquals( + WebRequest::findIE6Extension( 'a?b?.c?.d?e?f' ), + 'c', + 'Multiple question marks' + ); + } + + function testExeException() { + $this->assertEquals( + WebRequest::findIE6Extension( 'a?b?.exe?.d?.e' ), + 'd', + '.exe exception' + ); + } + + function testExeException2() { + $this->assertEquals( + WebRequest::findIE6Extension( 'a?b?.exe' ), + 'exe', + '.exe exception 2' + ); + } + + function testHash() { + $this->assertEquals( + WebRequest::findIE6Extension( 'a#b.c' ), + '', + 'Hash character preceding extension' + ); + } + + function testHash2() { + $this->assertEquals( + WebRequest::findIE6Extension( 'a?#b.c' ), + '', + 'Hash character preceding extension 2' + ); + } +} -- 2.20.1