[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/triples cca16121d9 13/19: Fix bugs in `triples-remove-t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/triples cca16121d9 13/19: Fix bugs in `triples-remove-type'. |
Date: |
Sat, 5 Nov 2022 11:58:17 -0400 (EDT) |
branch: externals/triples
commit cca16121d967fd8741a26be64bc43de8751365a5
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>
Fix bugs in `triples-remove-type'.
Previously, it removed all type markers, and didn't remove the actual type
data.
Fix tests so that it caught the previous issue.
---
triples-test.el | 14 +++++++++++---
triples.el | 4 ++--
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/triples-test.el b/triples-test.el
index d94c1e54ec..9277d4a3fa 100644
--- a/triples-test.el
+++ b/triples-test.el
@@ -93,6 +93,10 @@ easily debug into it.")
(should-error (triples-verify-schema-compliant db '(("foo" named/name
"bar" (:index 0)))))
(should (triples-verify-schema-compliant db '(("foo" named/alternate-names
"bar" (:index 0)))))))
+(defun triples-test-list-sort (list)
+ "Sort LIST in a standard way, for comparison."
+ (sort list (lambda (a b) (string< (format "%s" a) (format "%s" b)))))
+
(defun triples-test-plist-sort (plist)
"Sort PLIST in a standard way, for comparison."
(kvalist->plist
@@ -104,15 +108,19 @@ easily debug into it.")
(triples-add-schema db 'named
'(name :base/unique t)
'alias)
+ (triples-add-schema db 'callable
+ '(phone-number :base/unique t))
(triples-set-type db "foo" 'named :name "Name" :alias '("alias1" "alias2"))
+ (triples-set-type db "foo" 'callable :phone-number "867-5309")
(should (equal (triples-test-plist-sort '(:name "Name" :alias ("alias1"
"alias2")))
(triples-test-plist-sort (triples-get-type db "foo"
'named))))
- (should (equal (triples-get-types db "foo") '(named)))
+ (should (equal (triples-test-list-sort (triples-get-types db "foo"))
+ (triples-test-list-sort '(callable named))))
(should-not (triples-get-type db "bar" 'named))
(should-not (triples-get-types db "bar"))
- (should (equal '(named) (triples-get-types db "foo")))
(triples-remove-type db "foo" 'named)
- (should-not (triples-get-types db "foo"))))
+ (should-not (triples-get-type db "foo" 'named))
+ (should (triples-get-type db "foo" 'callable))))
(ert-deftest triples-crud-all ()
(triples-test-with-temp-db
diff --git a/triples.el b/triples.el
index 1e52471490..9189c9f805 100644
--- a/triples.el
+++ b/triples.el
@@ -238,9 +238,9 @@ PROPERTIES is a plist of properties, without TYPE prefixes."
"Remove TYPE for SUBJECT in DB, and all associated data."
(emacsql-with-transaction db
(emacsql db [:delete :from triples :where (= subject $s1)
- :and (= predicate 'base/type)] subject)
+ :and (= predicate 'base/type) :and (= object $s2)] subject
type)
(emacsql db [:delete :from triples :where (= subject $s1)
- :and (like $r2)] subject (format "%s/%%" type))))
+ :and (like predicate $r2)] subject (format "%s/%%" type))))
(defun triples-get-types (db subject)
"From DB, get all types for SUBJECT."
- [elpa] externals/triples 0252dad7d1 17/19: Fixes from code review from Stefan Monnier., (continued)
- [elpa] externals/triples 0252dad7d1 17/19: Fixes from code review from Stefan Monnier., ELPA Syncer, 2022/11/05
- [elpa] externals/triples d17b3d6e17 19/19: Merge branch 'combined'., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 2dae3d49b9 18/19: Various fixes for emacsql code, which wasn't being tested correctly., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 6afcb290ca 15/19: Support both emacs 29 sqlite and emacsql., ELPA Syncer, 2022/11/05
- [elpa] externals/triples aca95ba7f3 03/19: Ensure that we don't duplicate triples., ELPA Syncer, 2022/11/05
- [elpa] externals/triples d82cc1d6b8 14/19: Finish basic sqlite layer, and fix everything so tests work., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 8d7d3c13f4 05/19: Make the combined to and from functions public., ELPA Syncer, 2022/11/05
- [elpa] externals/triples ad6e329540 04/19: Fix for ert tests broken by the last commit., ELPA Syncer, 2022/11/05
- [elpa] externals/triples fdbbd5f61d 09/19: Added package-requires., ELPA Syncer, 2022/11/05
- [elpa] externals/triples cef7ad3a81 11/19: Remove emacs requirement for now., ELPA Syncer, 2022/11/05
- [elpa] externals/triples cca16121d9 13/19: Fix bugs in `triples-remove-type'.,
ELPA Syncer <=
- [elpa] externals/triples 3593f55dfb 16/19: Support numbers stored via emacsql., ELPA Syncer, 2022/11/05