Browse Source

Add test cases for strings containing quotes.

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

Closes #3155
mark_story 13 years ago
parent
commit
894fc1256a

+ 4 - 1
lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php

@@ -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');
 

+ 4 - 0
lib/Cake/Test/test_app/View/Pages/extract.ctp

@@ -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:"