From 8045afd81b7c80f6ef5b327c115a5bbb43e4b65c Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 29 Aug 2013 18:39:34 +0000 Subject: Move PHPUnit tests into a tests/phpunit directory. wp-tests-config.php can/should reside in the root of a develop checkout. `phpunit` should be run from the root. see #25088. git-svn-id: https://develop.svn.wordpress.org/trunk@25165 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/data/formatting/utf-8/entitize.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/phpunit/data/formatting/utf-8/entitize.py (limited to 'tests/phpunit/data/formatting/utf-8/entitize.py') diff --git a/tests/phpunit/data/formatting/utf-8/entitize.py b/tests/phpunit/data/formatting/utf-8/entitize.py new file mode 100644 index 0000000000..efa7cb18d5 --- /dev/null +++ b/tests/phpunit/data/formatting/utf-8/entitize.py @@ -0,0 +1,24 @@ +# Generates entitized.txt from utf-8.txt +# +# entitized.txt is used by Tests_Formatting_UrlEncodedToEntities + +import codecs +import sys + +def entitize(line): + """Convert text to &#[dec]; entities.""" + line = line.strip(); + line = ["&#%d;" % ord(s) for s in line] + return "".join(line) + +if __name__ == "__main__": + args = sys.argv[1:] + if args and args[0] in ("-h", "--help"): + print "Usage: python entitize.py < utf-8.txt > entitized.txt" + sys.exit(2) + + sys.stdin = codecs.getreader("utf-8")(sys.stdin) + sys.stdout = codecs.getwriter("ascii")(sys.stdout) + + lines = sys.stdin.readlines() + sys.stdout.write( "\n".join(map(entitize, lines)) ) -- cgit v1.2.3