summaryrefslogtreecommitdiff
path: root/_test/cases
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2011-04-02 03:32:13 +0100
committerChristopher Smith <chris@jalakai.co.uk>2011-04-02 03:32:13 +0100
commit344763ad4e90e41c8a94b0a69a527ff2d6319ab5 (patch)
treede34196c9cc3de0bee4a4074eed37139f12c3feb /_test/cases
parentd0b3f06b8b1835b2c332d9b5ac06fe68d890bf5e (diff)
downloadrpg-344763ad4e90e41c8a94b0a69a527ff2d6319ab5.tar.gz
rpg-344763ad4e90e41c8a94b0a69a527ff2d6319ab5.tar.bz2
FS#2122 alter SafeFN safe and post indicator characters.
Note, any filenames encoded with the previous SafeFN scheme will need to be converted to the new scheme. Users of the old SafeFN scheme should not use this new scheme until after converting their filenames.
Diffstat (limited to '_test/cases')
-rw-r--r--_test/cases/inc/safefn.test.php35
1 files changed, 24 insertions, 11 deletions
diff --git a/_test/cases/inc/safefn.test.php b/_test/cases/inc/safefn.test.php
index c789875ba..1227e5578 100644
--- a/_test/cases/inc/safefn.test.php
+++ b/_test/cases/inc/safefn.test.php
@@ -10,19 +10,23 @@ class safeFN_test extends UnitTestCase {
function test1(){
// we test multiple cases here - format: string, repl, additional, test
$tests = array();
- $tests[] = array('äa.txt', '%5g.a.txt');
- $tests[] = array('ä.', '%5g..');
+ $tests[] = array('äa.txt', '%5g]a.txt');
+ $tests[] = array('ä.', '%5g].');
$tests[] = array('asciistring','asciistring');
$tests[] = array('ascii-_/.string','ascii-_/.string');
- $tests[] = array('AName','%x%1a.ame');
- $tests[] = array('A Name','%x%0%1a.ame');
- $tests[] = array('Another...Name','%x.nother...%1a.ame');
- $tests[] = array('Aß∂ƒName','%x%5b%6oy%aa%1a.ame');
- $tests[] = array('A%ß-∂_.ƒName','%x%%5b.-%6oy._.%aa%1a.ame');
- $tests[] = array('A%%ß-∂_.ƒName','%x%%%5b.-%6oy._.%aa%1a.ame');
- $tests[] = array('데이터도 함께 복원됩니다. 강력한','%zf4%13dg%15ao%zhg%0%164o%yig%0%11at%138w%zk9%zag%zb8..%0%xyt%10cl%164c.');
- $tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr.');
- $tests[] = array('нехватка_файлового_пространства_на_сервере_p0-squid.some.domain.1270211897.txt.gz','%t9%t1%th%sy%sw%te%t6%sw._%tg%sw%t5%t7%ta%sy%ta%sz%ta._%tb%tc%ta%td%te%tc%sw%t9%td%te%sy%sw._%t9%sw._%td%t1%tc%sy%t1%tc%t1._p0-squid.some.domain.1270211897.txt.gz');
+ $tests[] = array('AName','%x%1a]ame');
+ $tests[] = array('A Name','%x%0%1a]ame');
+ $tests[] = array('Another...Name','%x]nother...%1a]ame');
+ $tests[] = array('Aß∂ƒName','%x%5b%6oy%aa%1a]ame');
+ $tests[] = array('A%ß-∂_.ƒName','%x%%5b]-%6oy]_.%aa%1a]ame');
+ $tests[] = array('A%%ß-∂_.ƒName','%x%%%5b]-%6oy]_.%aa%1a]ame');
+ $tests[] = array('데이터도 함께 복원됩니다. 강력한','%zf4%13dg%15ao%zhg%0%164o%yig%0%11at%138w%zk9%zag%zb8].%0%xyt%10cl%164c]');
+ $tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr]');
+ $tests[] = array('нехватка_файлового_пространства_на_сервере_p0-squid.some.domain.1270211897.txt.gz','%t9%t1%th%sy%sw%te%t6%sw]_%tg%sw%t5%t7%ta%sy%ta%sz%ta]_%tb%tc%ta%td%te%tc%sw%t9%td%te%sy%sw]_%t9%sw]_%td%t1%tc%sy%t1%tc%t1]_p0-squid.some.domain.1270211897.txt.gz');
+
+ $tests[] = array('name[1]','name[1]');
+ $tests[] = array('Name[1]','%1a]ame[1]');
+ $tests[] = array('Name[A]','%1a]ame[%x]]');
foreach($tests as $test){
list($utf8,$safe) = $test;
@@ -30,6 +34,15 @@ class safeFN_test extends UnitTestCase {
$this->assertEqual(SafeFN::decode($safe),$utf8);
}
}
+
+ function test2(){
+ $tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr');
+
+ foreach($tests as $test){
+ list($utf8,$safe) = $test;
+ $this->assertEqual(SafeFN::decode($safe),$utf8);
+ }
+ }
}
//Setup VIM: ex: et ts=4 :