Skip to content

Commit

Permalink
Get tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsklar committed May 7, 2015
1 parent a8ef226 commit 6696c54
Show file tree
Hide file tree
Showing 48 changed files with 2,255 additions and 217 deletions.
2,113 changes: 2,113 additions & 0 deletions run-test

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions tests/001.phpt → tests/001.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
--TEST--
Check for boxwood presence
--SKIPIF--
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
--FILE--
<?php
echo "boxwood extension is available";
/*
Expand All @@ -17,5 +12,3 @@
writing regression tests
*/
?>
--EXPECT--
boxwood extension is available
1 change: 1 addition & 0 deletions tests/001.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
boxwood extension is available
1 change: 1 addition & 0 deletions tests/001.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
4 changes: 4 additions & 0 deletions tests/002.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
$r = boxwood_new();
var_dump($r);
?>
1 change: 1 addition & 0 deletions tests/002.php.expectf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resource(%d) of type (Boxwood)
1 change: 1 addition & 0 deletions tests/002.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
11 changes: 0 additions & 11 deletions tests/002.phpt

This file was deleted.

7 changes: 0 additions & 7 deletions tests/003.phpt → tests/003.php
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/003.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6,5
1 change: 1 addition & 0 deletions tests/003.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
7 changes: 0 additions & 7 deletions tests/004.phpt → tests/004.php
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions tests/004.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My m***** ate some s**** today.
1 change: 1 addition & 0 deletions tests/004.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
7 changes: 0 additions & 7 deletions tests/005.phpt → tests/005.php
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions tests/005.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My m!!!!! ate some S!!!! today.
1 change: 1 addition & 0 deletions tests/005.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
7 changes: 0 additions & 7 deletions tests/006.phpt → tests/006.php
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions tests/006.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My m~~~~~ ate some s~~~~ today.
1 change: 1 addition & 0 deletions tests/006.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
7 changes: 0 additions & 7 deletions tests/007.phpt → tests/007.php
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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 śäłäđ.
1 change: 1 addition & 0 deletions tests/007.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My m^^^^^ ate some s^^^^ today and also some Ś^^^^ and śäłäđ.
1 change: 1 addition & 0 deletions tests/007.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
7 changes: 0 additions & 7 deletions tests/008.phpt → tests/008.php
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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 ś****.
1 change: 1 addition & 0 deletions tests/008.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My m***** ate some s**** today and also some Ś**** and ś****.
1 change: 1 addition & 0 deletions tests/008.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
8 changes: 0 additions & 8 deletions tests/009.phpt → tests/009.php
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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
2 changes: 2 additions & 0 deletions tests/009.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a m**t m*****s m**o eat m********s
a m**t m*****s m**o eat m********s
1 change: 1 addition & 0 deletions tests/009.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
8 changes: 0 additions & 8 deletions tests/010.phpt → tests/010.php
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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
2 changes: 2 additions & 0 deletions tests/010.php.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a-mont-monkeys-mono-eat-monotremes
a-m**t-m*****s-m**o-eat-m********s
1 change: 1 addition & 0 deletions tests/010.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) print "skip"; ?>
50 changes: 0 additions & 50 deletions tests/011.phpt → tests/011.php
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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
44 changes: 44 additions & 0 deletions tests/011.php.expectf
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/011.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) echo "skip"; ?>
30 changes: 0 additions & 30 deletions tests/012.phpt → tests/012.php
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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
24 changes: 24 additions & 0 deletions tests/012.php.expect
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/012.php.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php if (!extension_loaded("boxwood")) echo "skip"; ?>
20 changes: 20 additions & 0 deletions tests/013.php
Original file line number Diff line number Diff line change
@@ -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";
}
?>
Loading

0 comments on commit 6696c54

Please sign in to comment.