branch: elpa/emacsql
commit 161e3a41b1e5611bd3808c6658cfff821de4d346
Author: Christopher Wellons <well...@nullprogram.com>
Commit: Christopher Wellons <well...@nullprogram.com>

    Add some tests.
---
 emacsql-tests.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/emacsql-tests.el b/emacsql-tests.el
new file mode 100644
index 0000000000..31a3921c5c
--- /dev/null
+++ b/emacsql-tests.el
@@ -0,0 +1,17 @@
+(require 'ert)
+
+(ert-deftest emacsql-escape ()
+  (should (string= (emacsql-escape "foo") "foo"))
+  (should (string= (emacsql-escape 'foo) "foo"))
+  (should (string= (emacsql-escape :foo) "':foo'"))
+  (should (string= (emacsql-escape "a b") "'a b'"))
+  (should (string= (emacsql-escape '$foo) "'$foo'"))
+  (should (string= (emacsql-escape "foo$") "foo$"))
+  (should (string= (emacsql-escape "they're") "'they''re'")))
+
+(ert-deftest emacsql-escape-value ()
+  (should (string= (emacsql-escape-value 'foo) "foo"))
+  (should (string= (emacsql-escape-value "foo") "'\"foo\"'"))
+  (should (string= (emacsql-escape-value :foo) "':foo'"))
+  (should (string= (emacsql-escape-value [1 2 3]) "'[1 2 3]'"))
+  (should (string= (emacsql-escape-value '(a b c)) "'(a b c)'")))

Reply via email to