[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 5e2ab842f7 139/427: Add foreign key test.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 5e2ab842f7 139/427: Add foreign key test. |
Date: |
Tue, 13 Dec 2022 02:59:36 -0500 (EST) |
branch: elpa/emacsql
commit 5e2ab842f7be6fdee017004a686d8ac93e964adf
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add foreign key test.
---
emacsql-tests.el | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/emacsql-tests.el b/emacsql-tests.el
index 8eb8113805..c1f4542725 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -151,6 +151,7 @@
"LIMIT 4, 30;")))
(ert-deftest emacsql-system ()
+ "A short test that fully interacts with SQLite."
(should-not (emacsql-sqlite3-unavailable-p))
(emacsql-with-connection (db nil)
(emacsql db [:create-table foo [x]])
@@ -159,6 +160,25 @@
(should (equal (emacsql db [:select * :from foo])
'((1) (2) (3))))))
+(ert-deftest emacsql-foreign-system ()
+ "Tests that foreign keys work properly through Emacsql."
+ (emacsql-with-connection (db nil)
+ (emacsql-thread db
+ [:pragma (= foreign_keys on)]
+ [:create-table person [(id integer :primary) name]]
+ [:create-table likes ([(personid integer) color]
+ :foreign (personid person id :on-delete :cascade))]
+ [:replace :into person :values ([0 "Chris"] [1 "Jeff"])])
+ (should (equal (emacsql db [:select * :from person :order-by id])
+ '((0 "Chris") (1 "Jeff"))))
+ (emacsql db [:insert :into likes :values ([0 red] [0 yellow] [1 yellow])])
+ (should (equal (emacsql db [:select * :from likes
+ :order-by [personid color]])
+ '((0 red) (0 yellow) (1 yellow))))
+ (emacsql db [:delete :from person :where (= id 0)])
+ (should (equal (emacsql db [:select * :from likes])
+ '((1 yellow))))))
+
(provide 'emacsql-tests)
;;; emacsql-tests.el ends here
- [nongnu] elpa/emacsql 1e9857ccc4 103/427: Allow variables inside vectors., (continued)
- [nongnu] elpa/emacsql 1e9857ccc4 103/427: Allow variables inside vectors., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8a66563af6 105/427: Combine :insert and :into., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d04ef64ce0 109/427: Add IF NOT EXISTS and TEMPORARY to CREATE TABLE., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 58641b9827 115/427: Fill out keywords in README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fc941d7c75 118/427: Capture a common identifier vector pattern., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a09911a205 125/427: Add LIMIT and OFFSET expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8945af0dd8 129/427: Add :check and allow schemas to have variables., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4206b17f39 134/427: Add support for AS with CREATE TABLE., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6c32f02139 137/427: Add emacsql-thread macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 54c180017e 138/427: Add :pragma and note in README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5e2ab842f7 139/427: Add foreign key test.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 42c2fd7569 145/427: Tweak limitation wording., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fe0c7004fc 146/427: Add :begin, :commit, and :rollback., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2550196816 162/427: Drop SQLite version requirements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9a1b4209ba 164/427: Add PostgreSQL front-end., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5f4c2ed5a7 166/427: Add emacsql-psql-unavailable-p., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1d0ef4011c 167/427: Make emacsql-connection abstract., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 64c3a03d62 169/427: Flesh out some more README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9f6c10eca0 172/427: Move error checking out to helper mix-in., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4f76b94f7c 168/427: Set psql to print nil for NULL., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7434263d82 174/427: Oops, drop leftover function call., ELPA Syncer, 2022/12/13