From 6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 8 Feb 2007 14:51:25 +0000 Subject: Moved ITools tests from searchlib to itools/live --- tests/it.t | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100755 tests/it.t (limited to 'tests/it.t') diff --git a/tests/it.t b/tests/it.t new file mode 100755 index 0000000..65ac0b9 --- /dev/null +++ b/tests/it.t @@ -0,0 +1,206 @@ +#!/www/server/bin/php -qC + 'repl1', + 'regex2' => 'repl2', + 'regex3' => 'repl3' ), + 'regex2 regex1 regex3' ), + 'repl2 repl1 repl3', + 'test tr regex function' + ); +is( + it::match( '\w+', 'word1 wörd2 word_3', 'all' => true ), + array( 'word1', 'wörd2', 'word_3' ), + "test match_all function" + ); +match( + 'aBcD', ' aBcD ', + 'aBcD', + "caseinsensitive is default" + ); +match( + 'ö', 'Ö', + 'Ö', + 'match umlaute in latin1 case insensitive' + ); +is( + it::match( 'abc', "aBc", 'casesensitive' => 1 ), + false, + "set case sensitivity by parameter" + ); + +is( + it::match( '\w+', 'word1 wörd2 word_3', 'all' => 1 ), + array( 'word1', 'wörd2', 'word_3' ), + "test all=>1 without captures" + ); +is( + it::match( '\w+\s+(\d+)', 'word1 12 wörd2 3 word_3 4', 'all' => 1 ), + array( '12', '3', '4' ), + "test all=>1 with one capture" + ); +is( + it::match( '(\w+)\s+(\d+)', 'word1 12 wörd2 3 word_3 4', 'all' => 1 ), + array( array( 'word1', '12' ), array( 'wörd2', '3' ), array( 'word_3', '4' ) ), + "test all=>1 with captures" + ); +is( + it::match( '(\w+)\s+(\d+)', 'word1 12 wörd2 3 word_3 4', 'all' => 1, 'pattern_order' => 1 ), + array( array( 'word1', 'wörd2', 'word_3' ), array( '12', '3', '4' ) ), + "test all=>1,pattern_order=>1", + ); +?> -- cgit v1.2.3