Skip to content

Commit 36a0880

Browse files
committed
Fix test edge case for SQLite < 3.33.0
1 parent 5b4032e commit 36a0880

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/WP_SQLite_Information_Schema_Reconstructor_Tests.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ public function testDefaultValues(): void {
266266
}
267267

268268
public function testDefaultValueEscaping(): void {
269-
//$this->assertSame("abc". chr( 8 ) . "xyz", "" );
270269
$this->engine->get_connection()->query(
271270
"
272271
CREATE TABLE t (
@@ -277,8 +276,12 @@ public function testDefaultValueEscaping(): void {
277276
col5 text DEFAULT 'abc\nxyz',
278277
col6 text DEFAULT 'abc\rxyz',
279278
col7 text DEFAULT 'abc\txyz',
280-
col8 text DEFAULT 'abc" . chr( 8 ) . "xyz', -- backspace
281-
col9 text DEFAULT 'abc" . chr( 26 ) . "xyz' -- control-Z
279+
col8 text DEFAULT 'abc" . chr( 8 ) . "xyz', -- backspace
280+
col9 text DEFAULT 'abc" . chr( 26 ) . "xyz', -- control-Z
281+
last text -- SQLite < 3.33.0 has a strange bug where a comment
282+
-- after the last table definition DEFAULT value is
283+
-- included in the value reported by PRAGMA table info.
284+
-- Let's add one more column to avoid this issue.
282285
)
283286
"
284287
);
@@ -296,9 +299,10 @@ public function testDefaultValueEscaping(): void {
296299
" `col4` varchar(65535) DEFAULT 'abc\\\\xyz',",
297300
" `col5` varchar(65535) DEFAULT 'abc\\nxyz',",
298301
" `col6` varchar(65535) DEFAULT 'abc\\rxyz',",
299-
" `col7` varchar(65535) DEFAULT 'abc xyz',", // tab is preserved
300-
" `col8` varchar(65535) DEFAULT 'abc" . chr( 8 ) . "xyz',", // backspace is preserved
301-
" `col9` varchar(65535) DEFAULT 'abc" . chr( 26 ) . "xyz'", // control-Z is preserved
302+
" `col7` varchar(65535) DEFAULT 'abc xyz',", // tab is preserved
303+
" `col8` varchar(65535) DEFAULT 'abc" . chr( 8 ) . "xyz',", // backspace is preserved
304+
" `col9` varchar(65535) DEFAULT 'abc" . chr( 26 ) . "xyz',", // control-Z is preserved
305+
' `last` text DEFAULT NULL',
302306
') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci',
303307
)
304308
),

0 commit comments

Comments
 (0)