Skip to content
Permalink
Browse files
Get tests working
  • Loading branch information
davidsklar committed May 7, 2015
1 parent a8ef226 commit 6696c54867c04f23104485551721532d68d3f452
Show file tree
Hide file tree
Showing 48 changed files with 2,255 additions and 217 deletions.
2,113 run-test

Large diffs are not rendered by default.

@@ -1,8 +1,3 @@
--TEST--
Check for boxwood presence
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
echo "boxwood extension is available";
/*
@@ -17,5 +12,3 @@
writing regression tests
*/
?>
--EXPECT--
boxwood extension is available
@@ -0,0 +1 @@
boxwood extension is available
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -0,0 +1,4 @@
<?php
$r = boxwood_new();
var_dump($r);
?>
@@ -0,0 +1 @@
resource(%d) of type (Boxwood)
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>

This file was deleted.

@@ -1,13 +1,6 @@
--TEST--
Add a word
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new();
$a = boxwood_add_text($r, "monkey");
$b = boxwood_add_text($r, "salad");
print "$a,$b";
?>
--EXPECT--
6,5
@@ -0,0 +1 @@
6,5
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,14 +1,7 @@
--TEST--
Do replacement
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new();
$a = boxwood_add_text($r, "monkey");
$b = boxwood_add_text($r, "salad");
$c = boxwood_replace_text($r, "My monkey ate some salad today.","*");
print $c;
?>
--EXPECT--
My m***** ate some s**** today.
@@ -0,0 +1 @@
My m***** ate some s**** today.
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,14 +1,7 @@
--TEST--
Do case-insensitive replacement
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new(false);
$a = boxwood_add_text($r, "Monkey");
$b = boxwood_add_text($r, "salad");
$c = boxwood_replace_text($r, "My monkey ate some Salad today.","!");
print $c;
?>
--EXPECT--
My m!!!!! ate some S!!!! today.
@@ -0,0 +1 @@
My m!!!!! ate some S!!!! today.
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,14 +1,7 @@
--TEST--
Do replacement with explicit no-case-insensitivity argument
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new(false);
$a = boxwood_add_text($r, "monkey");
$b = boxwood_add_text($r, "salad");
$c = boxwood_replace_text($r, "My monkey ate some salad today.","~");
print $c;
?>
--EXPECT--
My m~~~~~ ate some s~~~~ today.
@@ -0,0 +1 @@
My m~~~~~ ate some s~~~~ today.
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,8 +1,3 @@
--TEST--
Replacement, UTF-8, case-sensitive
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new(true);
boxwood_add_text($r, "monkey");
@@ -11,5 +6,3 @@
$c = boxwood_replace_text($r, "My monkey ate some salad today and also some ŚÄłäđ and śäłäđ.","^");
print $c;
?>
--EXPECT--
My m^^^^^ ate some s^^^^ today and also some Ś^^^^ and śäłäđ.
@@ -0,0 +1 @@
My m^^^^^ ate some s^^^^ today and also some Ś^^^^ and śäłäđ.
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,8 +1,3 @@
--TEST--
Replacement, UTF-8, case-insensitive
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new(false);
boxwood_add_text($r, "monkey");
@@ -11,5 +6,3 @@
$c = boxwood_replace_text($r, "My monkey ate some salad today and also some ŚÄłäđ and śäłäđ.","*");
print $c;
?>
--EXPECT--
My m***** ate some s**** today and also some Ś**** and ś****.
@@ -0,0 +1 @@
My m***** ate some s**** today and also some Ś**** and ś****.
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,8 +1,3 @@
--TEST--
Prefix on word list
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new();
boxwood_add_text($r, "mon");
@@ -19,6 +14,3 @@
$c = boxwood_replace_text($r, "a mont monkeys mono eat monotremes",'*');
print $c;
?>
--EXPECT--
a m**t m*****s m**o eat m********s
a m**t m*****s m**o eat m********s
@@ -0,0 +1,2 @@
a m**t m*****s m**o eat m********s
a m**t m*****s m**o eat m********s
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,8 +1,3 @@
--TEST--
Array of words to replace
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
$r = boxwood_new();
boxwood_add_text($r, "mon");
@@ -12,6 +7,3 @@
$c = boxwood_replace_text($r, $a,'*');
print implode('-', $a) . "\n";
print implode('-', $c) . "\n";
--EXPECT--
a-mont-monkeys-mono-eat-monotremes
a-m**t-m*****s-m**o-eat-m********s
@@ -0,0 +1,2 @@
a-mont-monkeys-mono-eat-monotremes
a-m**t-m*****s-m**o-eat-m********s
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
@@ -1,8 +1,3 @@
--TEST--
Word boundary tests
--SKIPIF--
<?php if (!extension_loaded("boxwood")) echo "skip"; ?>
--FILE--
<?php
$r = boxwood_new();
boxwood_add_text($r, "xxx");
@@ -31,48 +26,3 @@
echo "\n";
}
?>
--EXPECTF--
aaa x** bbb
aaa x** bbb

aaax**
aaaxxx

x**bbb
xxxbbb

aaax**bbb
aaaxxxbbb

aaa(x**)bbb
aaa(x**)bbb

x** bbb
x** bbb

aaa x**
aaa x**

aaa?x**!bbb
aaa?x**!bbb

ax**
axxx

x**b
xxxb

x**
x**

(x**
(x**

x**)
x**)

aaa%ax**
aaa%ax**

aaa%ax**
aaa%axxx
@@ -0,0 +1,44 @@
aaa x** bbb
aaa x** bbb

aaax**
aaaxxx

x**bbb
xxxbbb

aaax**bbb
aaaxxxbbb

aaa(x**)bbb
aaa(x**)bbb

x** bbb
x** bbb

aaa x**
aaa x**

aaa?x**!bbb
aaa?x**!bbb

ax**
axxx

x**b
xxxb

x**
x**

(x**
(x**

x**)
x**)

aaa%ax**
aaa%ax**

aaa%ax**
aaa%axxx
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) echo "skip"; ?>
@@ -1,8 +1,3 @@
--TEST--
Word boundary tests with alternate boundary set
--SKIPIF--
<?php if (!extension_loaded("boxwood")) echo "skip"; ?>
--FILE--
<?php
$def = boxwood_new();
$alt = boxwood_new();
@@ -26,28 +21,3 @@
echo "\n";
}
?>
--EXPECT--
aaax**
aaaxxx
aaax**
aaaxxx

aaa x** bbb
aaa x** bbb
aaa x** bbb
aaa xxx bbb

aaa(x**)bbb
aaa(x**)bbb
aaa(x**)bbb
aaa(x**)bbb

x**
x**
x**
x**

aaa-x**-bbb
aaa-x**-bbb
aaa-x**-bbb
aaa-xxx-bbb
@@ -0,0 +1,24 @@
aaax**
aaaxxx
aaax**
aaaxxx

aaa x** bbb
aaa x** bbb
aaa x** bbb
aaa xxx bbb

aaa(x**)bbb
aaa(x**)bbb
aaa(x**)bbb
aaa(x**)bbb

x**
x**
x**
x**

aaa-x**-bbb
aaa-x**-bbb
aaa-x**-bbb
aaa-xxx-bbb
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) echo "skip"; ?>
@@ -0,0 +1,20 @@
<?php
$r = boxwood_new();
boxwood_add_text($r, "ɹǝqɯǝɯ");

$tests = array(
'ǝɔuǝıɹǝdxǝ ɹǝqɯǝɯ ɐƃǝɯo',
'ǝɔuǝıɹǝdxǝɹǝqɯǝɯ ɐƃǝɯo',
'ǝɔuǝıɹǝdxǝ ɹǝqɯǝɯɐƃǝɯo',
'ǝɔuǝıɹǝdxǝɹǝqɯǝɯɐƃǝɯo',
'ǝɔuǝıɹǝdxǝ(ɹǝqɯǝɯ)ɐƃǝɯo',
'ɹǝqɯǝɯ ɐƃǝɯo',
'ǝɔuǝıɹǝdxǝ ɹǝqɯǝɯ',
);

foreach ($tests as $test) {
echo boxwood_replace_text($r, $test, '*', false), "\n";
echo boxwood_replace_text($r, $test, '*', true), "\n";
echo "\n";
}
?>

0 comments on commit 6696c54

Please sign in to comment.