is($re->matched, 'foolish-\\d+', 're pattern-1 foolish-\\d+ matched'); is($re->source, 'foolish-\\d+', 're pattern-1 foolish source'); // } ok(!$re->match('foolish-'), 're pattern-1 foolish-\\d+ 4'); ok(!$re->source, 're pattern-1 foolish-\\d+ source'); // SKIP: { // skip( "matched() is not implemented in this version of perl ($])", 1 ) if $PERL_VERSION_TOO_LOW; ok(!$re->matched, 're pattern-1 foolish-\\d+ 5'); // } // if ($] < 5.009005) { // ok( do {use re 'eval'; 'cat' !~ /$re/}, 're pattern-1 cat <5.10' ); // ok( do {use re 'eval'; 'foolish-808' =~ /$re/}, 're pattern-1 foolish-808 <5.10' ); // } // else { unlike('cat', '/' . $re . '/', 're pattern-1 cat 5.10'); unlike('foolish-808', '/' . $re . '/', 're pattern-1 foolish-808 5.10'); // } $re = new Regexp_Assemble(['track' => 1]); $re->add('^a-\\d+$')->add('^a-\\d+-\\d+$'); $str = $re->as_string(); // SKIP: { // skip( "/?{...}/ and \\d+ cause a panic in this version of perl ($])", 2 ) if $PERL_VERSION_5_005; ok(!$re->match('foo'), 'match pattern-2 foo'); ok($re->match('a-22-44'), 'match pattern-2 a-22-44'); // } // SKIP: { // skip( "/?{...}/ and \\d+ cause a panic in this version of perl ($])", 1 ) if $PERL_VERSION_5_005; is($re->match('a-22-55555'), '^a-\\d+-\\d+$', 're pattern-2 a-22-55555'); // } // SKIP: { // skip( "/?{...}/ and \\d+ cause a panic in this version of perl ($])", 1 ) if $PERL_VERSION_5_005;
<?php $lib = isset($_SERVER['TESTLIB']) ? $_SERVER['TESTLIB'] : 'Test-More.php'; require_once $lib; #plan(3); diag('Test of various functions not otherwise broken out.'); pass("pass() is ok"); fail("fail() is not ok"); is('Ab3', 'Ab3', 'is() is ok'); isnt('Ab3', 123, 'isnt() is ok'); like('yackowackodot', '/wacko/', "like() is ok"); unlike('yackowackodot', '/boing/', "unlike() is ok"); cmp_ok(12, '>', 10, 'cmp_ok() is ok'); can_ok($__Test, 'plan'); isa_ok($__Test, 'TestMore', 'Default Testing object'); include_ok('t/goodlib.php'); require_ok('t/goodpage.php'); $foo = array(1, 'B', 'third'); $oof = array('third', 'B', 1); $bar = array('q' => 23, 'Y' => 42); $rab = array('Y' => 42, 'q' => 23); is_deeply($foo, $foo, 'is_deeply() is ok'); isnt_deeply($foo, $bar, 'isnt_deeply() is ok'); /* function skip($SkipReason, $num) { function todo ($why, $howmany) { function todo_skip ($why, $howmany) { function todo_start ($why) { function todo_end () { */ diag("Should fail 1 test, testing fail()");
<?php require './post.php'; $id = $loginUser; if (!$id) { returnError('гКох╣гб╪'); return; } $wall = $_POST['wall_id']; unlike($wall, $id);
} } $r = new Regexp_Assemble(['flags' => 'i']); $re = $r->add('^fg')->re(); like('fgx', '/' . $re . '/', 'fgx/i'); like('Fgx', '/' . $re . '/', 'Fgx/i'); like('FGx', '/' . $re . '/', 'FGx/i'); like('fGx', '/' . $re . '/', 'fGx/i'); unlike('F', '/' . $re . '/', 'F/i'); $r = new Regexp_Assemble(['flags' => 'x']); $re = $r->add('^fish')->add('^flash')->add('^fetish')->add('^foolish')->re(['indent' => 2]); like('fish', '/' . $re . '/', 'fish/x'); like('flash', '/' . $re . '/', 'flash/x'); like('fetish', '/' . $re . '/', 'fetish/x'); like('foolish', '/' . $re . '/', 'foolish/x'); unlike('fetch', '/' . $re . '/', 'fetch/x'); match_list('lookahead car.*', ['caret', 'caress', 'careful', 'careless', 'caring', 'carion', 'carry', 'carried'], ['caret', 'caress', 'careful', 'careless', 'caring', 'carion', 'carry', 'carried']); match_list('a.x', ['abx', 'adx', 'a.x'], ['aax', 'abx', 'acx', 'azx', 'a4x', 'a%x', 'a+x', 'a?x']); /* //�ۗ� match_list( 'POSIX', ['X[0[:alpha:]%]','Y[1-4[:punct:]a-c]'] , ['X0','X%','Xa','Xf','Y1','Y;','Y!','yc'] ); match_list( 'c.z', ['c^z','c-z','c5z','cmz'] , ['c^z','c-z','c5z','cmz'] ); */ match_list('\\d, \\D', ['b\\d', 'b\\D'], ['b4', 'bX', 'b%', 'b.', 'b?']); match_list('abcd', ['abc', 'abcd', 'ac', 'acd', 'b', 'bc', 'bcd', 'bd'], ['abc', 'abcd', 'ac', 'acd', 'b', 'bc', 'bcd', 'bd']); match('foo', 'foo', 'bar', 'rat', 'quux'); match('.[ar]it 1', 'bait', 'brit', 'frit', 'gait', 'grit', 'tait', 'wait', 'writ'); match('.[ar]it 2', 'bait', 'brit', 'gait', 'grit'); match('.[ar]it 3', 'bit', 'bait', 'brit', 'gait', 'grit'); match('.[ar]it 4', 'barit', 'bait', 'brit', 'gait', 'grit');
is($slide->add('nonschoolkids', 'nonacidoids')->as_string(), 'non(?:schoolk|acido)ids', 'nonschoolkids nonacidoids'); $r = new Regexp_Assemble(); is($r->add('sing', 'singing')->as_string(), 'sing(?:ing)?', 'super slide sing singing'); $r = new Regexp_Assemble(); is($r->add('sing', 'singing', 'sling')->as_string(), 's(?:(?:ing)?|l)ing', 'super slide sing singing sling'); $r = new Regexp_Assemble(); is($r->add('sing', 'singing', 'sling', 'slinging')->as_string(), 'sl?(?:ing)?ing', 'super slide sing singing sling slinging'); $r = new Regexp_Assemble(); is($r->add('sing', 'singing', 'sling', 'slinging', 'sting', 'stinging')->as_string(), 's[lt]?(?:ing)?ing', 'super slide sing singing sling slinging sting stinging'); $r = new Regexp_Assemble(); is($r->add('sing', 'singing', 'sling', 'slinging', 'sting', 'stinging', 'string', 'stringing', 'swing', 'swinging')->as_string(), 's(?:[lw]|tr?)?(?:ing)?ing', 'super slide sing singing sling slinging sting stinging string stringing swing swinging'); $re = new Regexp_Assemble(['flags' => 'i']); $re->add('^ab', '^are', 'de'); like('able', "/{$re}/", '{^ab ^are de} /i matches able'); like('About', "/{$re}/", '{^ab ^are de} /i matches About'); unlike('bare', "/{$re}/", '{^ab ^are de} /i fails bare'); like('death', "/{$re}/", '{^ab ^are de} /i matches death'); like('DEEP', "/{$re}/", '{^ab ^are de} /i matches DEEP'); $re = new Regexp_Assemble(); $re->add('abc', 'def', 'ghi'); is($re->stats_add(), 3, "stats add 3x3"); is($re->stats_raw(), 9, "stats raw 3x3"); is($re->stats_cooked(), 9, "stats cooked 3x3"); ok(!$re->stats_dup(), "stats dup 3x3"); $re->add('de'); is($re->stats_add(), 4, "stats add 3x3 +1"); is($re->stats_raw(), 11, "stats raw 3x3 +1"); is($re->stats_cooked(), 11, "stats cooked 3x3 +1"); $re = new Regexp_Assemble(); $re->add('\\Qabc.def.ghi\\E'); is($re->stats_add(), 1, "stats add qm");
is(2, 3, 'is()'); check_capture(false); is("2", 3, 'is()'); check_capture(false); isnt(2, 2, 'isnt()'); check_capture(false); isnt(2, "2", 'isnt()'); check_capture(false); like("foo", '!oof!', 'like()'); check_capture(false); unlike("foo", '!oo!', 'unlike()'); check_capture(false); cmp_ok(1, '==', 2, 'cmp_ok()'); check_capture(false); cmp_ok(1, '>', 2, 'cmp_ok()'); check_capture(false); cmp_ok(2, '<', 1, 'cmp_ok()'); check_capture(false); can_ok($test_obj, array('foo', 'bar', 'baz')); check_capture(false); isa_ok($test_obj, 'TestClass2');