should be it
This commit is contained in:
69
external/duckdb/test/sql/parser/invisible_spaces.test
vendored
Normal file
69
external/duckdb/test/sql/parser/invisible_spaces.test
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# name: test/sql/parser/invisible_spaces.test
|
||||
# description: Test invisible spaces
|
||||
# group: [parser]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
# non-breaking space
|
||||
query I
|
||||
SELECT 42;
|
||||
----
|
||||
42
|
||||
|
||||
# test all special unicode spaces
|
||||
# see https://jkorpela.fi/chars/spaces.html for a list
|
||||
foreach unicode_space
|
||||
|
||||
query I
|
||||
SELECT${unicode_space}42;
|
||||
----
|
||||
42
|
||||
|
||||
# unicode space in strings are not modified
|
||||
query I
|
||||
SELECT${unicode_space}strlen('${unicode_space}')>=2;
|
||||
----
|
||||
true
|
||||
|
||||
# unicode spaces in strings with escaped quotes
|
||||
query I
|
||||
SELECT${unicode_space}strlen(' ''${unicode_space}')>=4;
|
||||
----
|
||||
true
|
||||
|
||||
# unicode space in comment
|
||||
query I
|
||||
SELECT${unicode_space} -- ${unicode_space};
|
||||
42
|
||||
----
|
||||
42
|
||||
|
||||
# multiple unicode spaces
|
||||
query I
|
||||
SELECT${unicode_space}42${unicode_space}${unicode_space}${unicode_space}${unicode_space}${unicode_space}
|
||||
----
|
||||
42
|
||||
|
||||
# invisible space in identifiers
|
||||
query I
|
||||
SELECT a${unicode_space} FROM (SELECT 42) t(a);
|
||||
----
|
||||
42
|
||||
|
||||
endloop
|
||||
|
||||
# the query can still fail even after replacing unicode spaces
|
||||
statement error
|
||||
SELEC
|
||||
----
|
||||
<REGEX>:.*Parser Error.*syntax error.*
|
||||
|
||||
# only a unicode space
|
||||
statement ok
|
||||
|
||||
|
||||
statement error
|
||||
S
|
||||
----
|
||||
<REGEX>:.*Parser Error.*syntax error.*
|
||||
Reference in New Issue
Block a user