Add test cases for strings containing quotes.

Show that both double and single quoted strings are
handled correctly by ExtractTask.

Closes #3155
This commit is contained in:
mark_story 2012-08-30 23:48:32 +01:00
parent 1239d39b16
commit 894fc1256a
2 changed files with 8 additions and 1 deletions

View file

@ -152,7 +152,7 @@ class ExtractTaskTest extends CakeTestCase {
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
$this->assertRegExp($pattern, $result);
$pattern = '/\#: (\\\\|\/)extract\.ctp:18\nmsgid "';
$pattern = '/\#: (\\\\|\/)extract\.ctp:22\nmsgid "';
$pattern .= 'Hot features!';
$pattern .= '\\\n - No Configuration: Set-up the database and let the magic begin';
$pattern .= '\\\n - Extremely Simple: Just look at the name...It\'s Cake';
@ -160,6 +160,9 @@ class ExtractTaskTest extends CakeTestCase {
$pattern .= '"\nmsgstr ""/';
$this->assertRegExp($pattern, $result);
$this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
$this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
// extract.ctp - reading the domain.pot
$result = file_get_contents($this->path . DS . 'domain.pot');

View file

@ -14,6 +14,10 @@ echo __dn('domain', 'You deleted %d message (domain).', 'You deleted %d messages
echo __('Editing this Page');
echo __('You have %d new message.');
// Contains quotes
echo __('double "quoted"');
echo __("single 'quoted'");
// Multiline
__('Hot features!'
. "\n - No Configuration:"