[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr 2820bf1af3 1/2: fix: Make plist parsing work on
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr 2820bf1af3 1/2: fix: Make plist parsing work on emacs 26.3 |
Date: |
Thu, 5 May 2022 12:57:50 -0400 (EDT) |
branch: externals/tomelr
commit 2820bf1af3e5482df8aa1c9c35bd0d7333ce6a68
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
fix: Make plist parsing work on emacs 26.3
The fix was to make tomelr depend on the newer map v3.2.1 and seq
v2.23 versions from GNU ELPA.
---
Makefile | 2 +-
test/all-tests.el | 36 ++++++++++++++++++++++++++++++++++++
test/tplist.el | 47 ++++++++++++++++++++++-------------------------
tomelr.el | 2 +-
4 files changed, 60 insertions(+), 27 deletions(-)
diff --git a/Makefile b/Makefile
index 2a2d9afeb6..bc81c114c5 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ MATCH ?=
.PHONY: test changelog
test:
- $(EMACS) --batch -L . -L $(TEST_DIR) -l all-tests.el -eval
'(ert-run-tests-batch-and-exit "$(MATCH)")'
+ @env HOME=$(shell pwd)/test $(EMACS) --batch -L $(TEST_DIR) -l
all-tests.el -eval '(ert-run-tests-batch-and-exit "$(MATCH)")'
# Requires https://github.com/orhun/git-cliff to be installed.
changelog:
diff --git a/test/all-tests.el b/test/all-tests.el
index 0c12a83826..537db89ead 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -21,8 +21,44 @@
;;; Code:
+(defun tomelr-install ()
+ "Test installation of `tomelr' including all its dependencies."
+ (let ((tomelr-site-git-root (progn
+ (require 'vc-git)
+ (file-truename (vc-git-root
default-directory)))))
+
+ (setq package-user-dir (let ((elpa-dir-name (format "elpa_%s"
emacs-major-version))) ;default = "elpa"
+ (file-name-as-directory (expand-file-name
elpa-dir-name user-emacs-directory))))
+
+ ;; Below require will auto-create `package-user-dir' it doesn't exist.
+ (require 'package)
+
+ ;; Load emacs packages and activate them.
+ ;; Don't delete this line.
+ (package-initialize) ;
+ ;; `package-initialize' call is required before any of the below
+ ;; can happen.
+
+ (message "Emacs is now refreshing its package database...")
+ (package-refresh-contents)
+
+ (package-install-file (expand-file-name "tomelr.el" tomelr-site-git-root))
+ ;; (message "package-user-dir: %S" package-user-dir)
+ ;; (message "load-path: %S" load-path)
+ ))
+
+;; Load newer version of .el and .elc if both are available
(setq load-prefer-newer t)
+;; Install map and seq from GNU ELPA only for Emacsen older than 27.x.
+(when (version< emacs-version "27.0")
+ ;; Workaround for this error on GHA when using Emacs 26.3:
+ ;; signal(file-error ("https://elpa.gnu.org/packages/tomelr-0.2.2.tar"
"Bad Request"))
+ ;; https://lists.gnu.org/archive/html/help-gnu-emacs/2020-01/msg00162.html
+ (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
+
+(tomelr-install)
+
(require 'tjson-utils)
(require 'tpredicates)
diff --git a/test/tplist.el b/test/tplist.el
index 652ea5bb0d..9431ba12d2 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -26,28 +26,25 @@
;;; Code:
(require 'tomelr)
-;; The plist conversion to TOML fails on emacs 26.3 and older
-;; versions.
-(unless (version< emacs-version "27")
;;;; S-exp objects as plists
- (ert-deftest test-plist ()
- (let ((inp '((:int 123
- :remove_this_key nil
- :str "abc"
- :bool_false :false
- :bool_true t
- :int_list (1 2 3)
- :str_list ("a" "b" "c")
- :bool_list (t :false t :false)
- :list_of_lists [(1 2) (3 4 5)]
- :map (:key1 123
- :key2 "xyz")
- :list_of_maps [(:key1 123
- :key2 "xyz")
- (:key1 567
- :key2 "klm")]
- )))
- (ref '("int = 123
+(ert-deftest test-plist ()
+ (let ((inp '((:int 123
+ :remove_this_key nil
+ :str "abc"
+ :bool_false :false
+ :bool_true t
+ :int_list (1 2 3)
+ :str_list ("a" "b" "c")
+ :bool_list (t :false t :false)
+ :list_of_lists [(1 2) (3 4 5)]
+ :map (:key1 123
+ :key2 "xyz")
+ :list_of_maps [(:key1 123
+ :key2 "xyz")
+ (:key1 567
+ :key2 "klm")]
+ )))
+ (ref '("int = 123
str = \"abc\"
bool_false = false
bool_true = true
@@ -64,10 +61,10 @@ list_of_lists = [[1, 2], [3, 4, 5]]
[[list_of_maps]]
key1 = 567
key2 = \"klm\""))
- out)
- (dolist (el inp)
- (push (tomelr-encode el) out))
- (should (equal ref (nreverse out))))))
+ out)
+ (dolist (el inp)
+ (push (tomelr-encode el) out))
+ (should (equal ref (nreverse out)))))
(provide 'tplist)
diff --git a/tomelr.el b/tomelr.el
index 7a81a82971..669db14ffc 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -4,7 +4,7 @@
;; Author: Kaushal Modi <kaushal.modi@gmail.com>
;; Version: 0.2.5
-;; Package-Requires: ((emacs "26.3"))
+;; Package-Requires: ((emacs "26.3") (map "3.2.1") (seq "2.23"))
;; Keywords: data, tools, toml, serialization, config
;; URL: https://github.com/kaushalmodi/tomelr/