emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/sqlite 5586796: Add a multisession test


From: Lars Ingebrigtsen
Subject: scratch/sqlite 5586796: Add a multisession test
Date: Sun, 12 Dec 2021 10:34:52 -0500 (EST)

branch: scratch/sqlite
commit 5586796ed0da21100d50c781b423f293da412746
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add a multisession test
---
 test/lisp/emacs-lisp/multisession-tests.el | 56 ++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/test/lisp/emacs-lisp/multisession-tests.el 
b/test/lisp/emacs-lisp/multisession-tests.el
new file mode 100644
index 0000000..7f89f7d
--- /dev/null
+++ b/test/lisp/emacs-lisp/multisession-tests.el
@@ -0,0 +1,56 @@
+;;; multisession-tests.el --- Tests for multisession.el  -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'multisession)
+(require 'ert)
+(require 'ert-x)
+(require 'cl-lib)
+
+(ert-deftest multi-test ()
+  (skip-unless (sqlite-available-p))
+  (let ((multisession-database-file (make-temp-name "/tmp/multi"))
+        (user-init-file "/tmp/foo.el"))
+    (unwind-protect
+        (progn
+          (define-multisession-variable foo 0)
+          (should (= (multisession-value foo) 0))
+          (cl-incf (multisession-value foo))
+          (should (= (multisession-value foo) 1))
+          (call-process
+           (concat invocation-directory invocation-name)
+           nil t nil
+           "-Q" "-batch"
+           "--eval" (prin1-to-string
+                     `(progn
+                        (require 'multisession)
+                        (let ((multisession-database-file
+                               ,multisession-database-file)
+                              (user-init-file "/tmp/foo.el"))
+                          (define-multisession-variable foo 0)
+                          (cl-incf (multisession-value foo))))))
+          (should (= (multisession-value foo) 2)))
+      (when (file-exists-p multisession-database-file)
+        ;;(delete-file multisession-database-file)
+        ))))
+
+;;; multisession-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]