Skip to content

Commit 47edc41

Browse files
ngmyiamcal
authored andcommitted
Add tests for quote doubling decoding
1 parent 02f623f commit 47edc41

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

tests/FieldTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,46 @@ function testSets(){
327327
'values' => array('hel"lo'),
328328
)
329329
));
330+
331+
# a `''` inside a string quoted with `'`
332+
$tbl = $this->get_first_table("CREATE TABLE foo (bar ENUM('hel''lo'))");
333+
$this->assertEquals($tbl['fields'], array(
334+
array(
335+
'name' => "bar",
336+
'type' => "ENUM",
337+
'values' => array("hel'lo"),
338+
)
339+
));
340+
341+
# a `""` inside a string quoted with `"`
342+
$tbl = $this->get_first_table('CREATE TABLE foo (bar ENUM("hel""lo"))');
343+
$this->assertEquals($tbl['fields'], array(
344+
array(
345+
'name' => "bar",
346+
'type' => "ENUM",
347+
'values' => array('hel"lo'),
348+
)
349+
));
350+
351+
# a `''` inside a string quoted with `"`
352+
$tbl = $this->get_first_table("CREATE TABLE foo (bar ENUM(\"hel''lo\"))");
353+
$this->assertEquals($tbl['fields'], array(
354+
array(
355+
'name' => "bar",
356+
'type' => "ENUM",
357+
'values' => array("hel''lo"),
358+
)
359+
));
360+
361+
# a `""` inside a string quoted with `'`
362+
$tbl = $this->get_first_table('CREATE TABLE foo (bar ENUM(\'hel""lo\'))');
363+
$this->assertEquals($tbl['fields'], array(
364+
array(
365+
'name' => "bar",
366+
'type' => "ENUM",
367+
'values' => array('hel""lo'),
368+
)
369+
));
330370
}
331371

332372

0 commit comments

Comments
 (0)