From 0a886e801f668863b6e9c01b3e8e4ec2e9bf4b66 Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Sat, 19 Aug 2017 14:45:33 +0900 Subject: [PATCH] Add 2 test cases to parse-test which handles '$'s in identifiers. --- test/expected/quotes.out | 12 ++++++++++++ test/src/quotes-test.c | 3 +++ 2 files changed, 15 insertions(+) diff --git a/test/expected/quotes.out b/test/expected/quotes.out index 6dc437b..f19aefe 100644 --- a/test/expected/quotes.out +++ b/test/expected/quotes.out @@ -25,6 +25,12 @@ complex $dollar quotes param Executing: SELECT $dollar$morecomplex $dollar quotes$dollar$, ?::text with param: param Result set: morecomplex $dollar quotes param +Executing: SELECT ?::text, '1' a$1 with param: $ in an identifier +Result set: +$ in an identifier 1 +Executing: SELECT '1'::text a$$S1,?::text,$$2 $'s in an identifier$$::text with param: param +Result set: +1 param 2 $'s in an identifier SET standard_conforming_strings=off Executing: SELECT 'foo', ?::text with param: param'quote @@ -54,4 +60,10 @@ morecomplex $dollar quotes param Executing: SELECT 'escaped quote\' here', ?::text with param: param Result set: escaped quote' here param +Executing: SELECT ?::text, '1' a$1 with param: $ in an identifier +Result set: +$ in an identifier 1 +Executing: SELECT '1'::text a$$S1,?::text,$$2 $'s in an identifier$$::text with param: param +Result set: +1 param 2 $'s in an identifier disconnecting diff --git a/test/src/quotes-test.c b/test/src/quotes-test.c index c7eb041..20e747b 100644 --- a/test/src/quotes-test.c +++ b/test/src/quotes-test.c @@ -79,6 +79,9 @@ runtest(HSTMT hstmt, int scs) */ if (!scs) execWithParam(hstmt, "SELECT 'escaped quote\\' here', ?::text", "param"); + /* Some tests with '$'s in identifiers. */ + execWithParam(hstmt, "SELECT ?::text, '1' a$1", "$ in an identifier"); + execWithParam(hstmt, "SELECT '1'::text a$$S1,?::text,$$2 $'s in an identifier$$::text", "param"); } int main(int argc, char **argv) -- 2.39.5