Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Unified Diff: third_party/sqlite/sqlite-src-3100200/test/parser1.test

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3100200/test/parser1.test
diff --git a/third_party/sqlite/sqlite-src-3100200/test/parser1.test b/third_party/sqlite/sqlite-src-3100200/test/parser1.test
new file mode 100644
index 0000000000000000000000000000000000000000..78c1a40c630e41ac29858536a4c8cfddfa0316a0
--- /dev/null
+++ b/third_party/sqlite/sqlite-src-3100200/test/parser1.test
@@ -0,0 +1,79 @@
+# 2014-08-24
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+# The focus of this script is testing details of the SQL language parser.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+do_catchsql_test parser1-1.1 {
+ CREATE TABLE t1(
+ a TEXT PRIMARY KEY,
+ b TEXT,
+ FOREIGN KEY(b COLLATE nocase DESC) REFERENCES t1(a COLLATE binary ASC)
+ );
+} {1 {syntax error after column name "b"}}
+
+
+# Verify that a legacy schema in the sqlite_master file is allowed to have
+# COLLATE, ASC, and DESC keywords on the id list of a FK constraint, and that
+# those keywords are silently ignored.
+#
+do_execsql_test parser1-1.2 {
+ CREATE TABLE t1(
+ a TEXT PRIMARY KEY,
+ b TEXT,
+ FOREIGN KEY(b) REFERENCES t1(a)
+ );
+ INSERT INTO t1 VALUES('abc',NULL),('xyz','abc');
+ PRAGMA writable_schema=on;
+ UPDATE sqlite_master SET sql='CREATE TABLE t1(
+ a TEXT PRIMARY KEY,
+ b TEXT,
+ FOREIGN KEY(b COLLATE nocase) REFERENCES t1(a)
+ )' WHERE name='t1';
+ SELECT name FROM sqlite_master WHERE sql LIKE '%collate%';
+} {t1}
+sqlite3 db2 test.db
+do_test parser1-1.3 {
+ sqlite3 db2 test.db
+ db2 eval {SELECT * FROM t1 ORDER BY 1}
+} {abc {} xyz abc}
+db2 close
+
+do_execsql_test parser1-1.4 {
+ UPDATE sqlite_master SET sql='CREATE TABLE t1(
+ a TEXT PRIMARY KEY,
+ b TEXT,
+ FOREIGN KEY(b ASC) REFERENCES t1(a)
+ )' WHERE name='t1';
+ SELECT name FROM sqlite_master WHERE sql LIKE '%ASC%';
+} {t1}
+sqlite3 db2 test.db
+do_test parser1-1.5 {
+ sqlite3 db2 test.db
+ db2 eval {SELECT * FROM t1 ORDER BY 1}
+} {abc {} xyz abc}
+db2 close
+
+do_catchsql_test parser1-2.1 {
+ WITH RECURSIVE
+ c(x COLLATE binary) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<5)
+ SELECT x FROM c;
+} {1 {syntax error after column name "x"}}
+do_catchsql_test parser1-2.2 {
+ WITH RECURSIVE
+ c(x ASC) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<5)
+ SELECT x FROM c;
+} {1 {syntax error after column name "x"}}
+
+finish_test
« no previous file with comments | « third_party/sqlite/sqlite-src-3100200/test/pagesize.test ('k') | third_party/sqlite/sqlite-src-3100200/test/pcache.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698