Changeset 25395 for trunk/tests/phpunit/tests/pomo/po.php
- Timestamp:
- 09/12/2013 06:46:35 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/pomo/po.php
r25002 r25395 38 38 39 39 function test_prepend_each_line() { 40 $this->assertEquals('baba_', PO::prepend_each_line('', 'baba_'));41 $this->assertEquals('baba_dyado', PO::prepend_each_line('dyado', 'baba_'));42 $this->assertEquals("# baba\n# dyado\n# \n", PO::prepend_each_line("baba\ndyado\n\n", '# '));40 $this->assertEquals('baba_', @PO::prepend_each_line('', 'baba_')); 41 $this->assertEquals('baba_dyado', @PO::prepend_each_line('dyado', 'baba_')); 42 $this->assertEquals("# baba\n# dyado\n# \n", @PO::prepend_each_line("baba\ndyado\n\n", '# ')); 43 43 } 44 44 45 45 function test_poify() { 46 46 //simple 47 $this->assertEquals('"baba"', PO::poify('baba'));47 $this->assertEquals('"baba"', @PO::poify('baba')); 48 48 //long word 49 $this->assertEquals($this->po_a90, PO::poify($this->a90));49 $this->assertEquals($this->po_a90, @PO::poify($this->a90)); 50 50 // tab 51 $this->assertEquals('"ba\tba"', PO::poify("ba\tba"));51 $this->assertEquals('"ba\tba"', @PO::poify("ba\tba")); 52 52 // do not add leading empty string of one-line string ending on a newline 53 $this->assertEquals('"\\\\a\\\\n\\n"', PO::poify("\a\\n\n"));53 $this->assertEquals('"\\\\a\\\\n\\n"', @PO::poify("\a\\n\n")); 54 54 // backslash 55 $this->assertEquals('"ba\\\\ba"', PO::poify('ba\\ba'));55 $this->assertEquals('"ba\\\\ba"', @PO::poify('ba\\ba')); 56 56 // random wordpress.pot string 57 57 $src = 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'; 58 $this->assertEquals("\"Categories can be selectively converted to tags using the <a href=\\\"%s\\\">category to tag converter</a>.\"", PO::poify($src));59 60 $this->assertEquals($this->po_mail, PO::poify($this->mail));58 $this->assertEquals("\"Categories can be selectively converted to tags using the <a href=\\\"%s\\\">category to tag converter</a>.\"", @PO::poify($src)); 59 60 $this->assertEquals($this->po_mail, @PO::poify($this->mail)); 61 61 } 62 62 63 63 function test_unpoify() { 64 $this->assertEquals('baba', PO::unpoify('"baba"'));65 $this->assertEquals("baba\ngugu", PO::unpoify('"baba\n"'."\t\t\t\n".'"gugu"'));66 $this->assertEquals($this->a90, PO::unpoify($this->po_a90));67 $this->assertEquals('\\t\\n', PO::unpoify('"\\\\t\\\\n"'));64 $this->assertEquals('baba', @PO::unpoify('"baba"')); 65 $this->assertEquals("baba\ngugu", @PO::unpoify('"baba\n"'."\t\t\t\n".'"gugu"')); 66 $this->assertEquals($this->a90, @PO::unpoify($this->po_a90)); 67 $this->assertEquals('\\t\\n', @PO::unpoify('"\\\\t\\\\n"')); 68 68 // wordwrapped 69 $this->assertEquals('babadyado', PO::unpoify("\"\"\n\"baba\"\n\"dyado\""));70 $this->assertEquals($this->mail, PO::unpoify($this->po_mail));69 $this->assertEquals('babadyado', @PO::unpoify("\"\"\n\"baba\"\n\"dyado\"")); 70 $this->assertEquals($this->mail, @PO::unpoify($this->po_mail)); 71 71 } 72 72 73 73 function test_export_entry() { 74 74 $entry = new Translation_Entry(array('singular' => 'baba')); 75 $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", PO::export_entry($entry));75 $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", @PO::export_entry($entry)); 76 76 // plural 77 77 $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas')); … … 79 79 msgid_plural "babas" 80 80 msgstr[0] "" 81 msgstr[1] ""', PO::export_entry($entry));81 msgstr[1] ""', @PO::export_entry($entry)); 82 82 $entry = new Translation_Entry(array('singular' => 'baba', 'translator_comments' => "baba\ndyado")); 83 83 $this->assertEquals('# baba 84 84 # dyado 85 85 msgid "baba" 86 msgstr ""', PO::export_entry($entry));86 msgstr ""', @PO::export_entry($entry)); 87 87 $entry = new Translation_Entry(array('singular' => 'baba', 'extracted_comments' => "baba")); 88 88 $this->assertEquals('#. baba 89 89 msgid "baba" 90 msgstr ""', PO::export_entry($entry));90 msgstr ""', @PO::export_entry($entry)); 91 91 $entry = new Translation_Entry(array( 92 92 'singular' => 'baba', … … 97 97 #: 29 98 98 msgid "baba" 99 msgstr ""', PO::export_entry($entry));99 msgstr ""', @PO::export_entry($entry)); 100 100 $entry = new Translation_Entry(array('singular' => 'baba', 'translations' => array())); 101 $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", PO::export_entry($entry));101 $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", @PO::export_entry($entry)); 102 102 103 103 $entry = new Translation_Entry(array('singular' => 'baba', 'translations' => array('куку', 'буку'))); 104 $this->assertEquals("msgid \"baba\"\nmsgstr \"куку\"", PO::export_entry($entry));104 $this->assertEquals("msgid \"baba\"\nmsgstr \"куку\"", @PO::export_entry($entry)); 105 105 106 106 $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку'))); 107 107 $this->assertEquals('msgid "baba" 108 108 msgid_plural "babas" 109 msgstr[0] "кукубуку"', PO::export_entry($entry));109 msgstr[0] "кукубуку"', @PO::export_entry($entry)); 110 110 111 111 $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга'))); … … 114 114 msgstr[0] "кукубуку" 115 115 msgstr[1] "кукуруку" 116 msgstr[2] "бабаяга"', PO::export_entry($entry));116 msgstr[2] "бабаяга"', @PO::export_entry($entry)); 117 117 // context 118 118 $entry = new Translation_Entry(array('context' => 'ctxt', 'singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга'), 'flags' => array('fuzzy', 'php-format'))); … … 123 123 msgstr[0] "кукубуку" 124 124 msgstr[1] "кукуруку" 125 msgstr[2] "бабаяга"', PO::export_entry($entry));125 msgstr[2] "бабаяга"', @PO::export_entry($entry)); 126 126 } 127 127
Note: See TracChangeset
for help on using the changeset viewer.