summaryrefslogtreecommitdiff
path: root/tests/Framework/Shared.php
diff options
context:
space:
mode:
authorPaweł Słowik <pawel.slowik@iq.pl>2012-09-13 14:24:01 +0200
committerPaweł Słowik <pawel.slowik@iq.pl>2012-09-13 14:24:01 +0200
commit2cdaa79dce689b2dc9ef5c7bf3dcbd9446d86c21 (patch)
tree7482d3bd9a71a9913f4e28392b09e11c519987de /tests/Framework/Shared.php
parent92a030d928246cfc5f3c0b1f2538dc1bfb4777e3 (diff)
parentd7439260770eb1f70cdc5abf5df13e6c62ff3991 (diff)
Merge branch 'master' of https://github.com/roundcube/roundcubemail
Diffstat (limited to 'tests/Framework/Shared.php')
-rw-r--r--tests/Framework/Shared.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Framework/Shared.php b/tests/Framework/Shared.php
index 99ef829da..0394cd025 100644
--- a/tests/Framework/Shared.php
+++ b/tests/Framework/Shared.php
@@ -201,4 +201,32 @@ class Framework_Shared extends PHPUnit_Framework_TestCase
}
+ /**
+ * rcube_shared.inc: is_ascii()
+ */
+ function test_is_ascii()
+ {
+ $result = is_ascii("0123456789");
+ $this->assertTrue($result, "Valid ASCII (numbers)");
+
+ $result = is_ascii("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+ $this->assertTrue($result, "Valid ASCII (letters)");
+
+ $result = is_ascii(" !\"#\$%&'()*+,-./:;<=>?@[\\^_`{|}~");
+ $this->assertTrue($result, "Valid ASCII (special characters)");
+
+ $result = is_ascii("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+ ."\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F");
+ $this->assertTrue($result, "Valid ASCII (control characters)");
+
+ $result = is_ascii("\n", false);
+ $this->assertFalse($result, "Valid ASCII (control characters)");
+
+ $result = is_ascii("ż");
+ $this->assertFalse($result, "Invalid ASCII (UTF-8 character)");
+
+ $result = is_ascii("ż", false);
+ $this->assertFalse($result, "Invalid ASCII (UTF-8 character [2])");
+ }
+
}