Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 from translate.storage import php 5 from translate.storage import test_monolingual 6 from translate.misc import wStringIO 79 """Test the helper escaping funtions""" 10 # Encoding 11 assert php.phpencode("'") == "\\'" 12 assert php.phpencode('"', quotechar='"') == '\\"' 13 assert php.phpencode("\n") == "\\n" 14 # Decoding 15 assert php.phpdecode("\\'") == "'" 16 assert php.phpdecode('\\"') == '"' 17 assert php.phpdecode("\\n") == "\n"18 2426 StoreClass = php.phpfile 276129 """helper that parses php source without requiring files""" 30 dummyfile = wStringIO.StringIO(phpsource) 31 phpfile = php.phpfile(dummyfile) 32 return phpfile3335 """helper that converts php source to phpfile object and back""" 36 return str(self.phpparse(phpsource))3739 """checks that a simple php definition is parsed correctly""" 40 phpsource = """$lang['mediaselect'] = 'Bestand selectie';""" 41 phpfile = self.phpparse(phpsource) 42 assert len(phpfile.units) == 1 43 phpunit = phpfile.units[0] 44 assert phpunit.name == "$lang['mediaselect']" 45 assert phpunit.source == "Bestand selectie"4648 """checks that a simple php definition can be regenerated as source""" 49 phpsource = """$lang['mediaselect']='Bestand selectie';""" 50 phpregen = self.phpregen(phpsource) 51 assert phpsource + '\n' == phpregen5254 """check that spaces in the array name doesn't throw us off""" 55 phpsource = """$lang[ 'mediaselect' ] = 'Bestand selectie';""" 56 phpfile = self.phpparse(phpsource) 57 assert len(phpfile.units) == 1 58 phpunit = phpfile.units[0] 59 assert phpunit.name == "$lang['mediaselect']" 60 assert phpunit.source == "Bestand selectie"
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Sep 23 13:51:26 2008 | http://epydoc.sourceforge.net |