emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/tomelr 05d2cafcd9 09/84: test: Add test for boolean sca


From: ELPA Syncer
Subject: [elpa] externals/tomelr 05d2cafcd9 09/84: test: Add test for boolean scalar key-value pairs
Date: Tue, 3 May 2022 09:58:07 -0400 (EDT)

branch: externals/tomelr
commit 05d2cafcd989b977fa3e9d05e293e9f8bae22fc4
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>

    test: Add test for boolean scalar key-value pairs
---
 Makefile          | 13 +++++++++++++
 test/all-tests.el | 24 ++++++++++++++++++++++++
 test/tscalar.el   | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..550b82562d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,13 @@
+# Makefile for tomelr.el
+
+EMACS ?= emacs
+
+TEST_DIR=$(shell pwd)/test
+
+# Run all tests by default.
+MATCH ?=
+
+.PHONY: test
+
+test:
+       $(EMACS) --batch -L . -L $(TEST_DIR) -l all-tests.el -eval 
'(ert-run-tests-batch-and-exit "$(MATCH)")'
diff --git a/test/all-tests.el b/test/all-tests.el
new file mode 100644
index 0000000000..209d39f3be
--- /dev/null
+++ b/test/all-tests.el
@@ -0,0 +1,24 @@
+;;; all-tests.el --- Tests for tomelr.el                   -*- 
lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi <kaushal.modi@gmail.com>
+
+;; This file is not part of GNU Emacs.
+
+;; This program 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.
+
+;; This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(setq load-prefer-newer t)
+
+(require 'tscalar)
diff --git a/test/tscalar.el b/test/tscalar.el
new file mode 100644
index 0000000000..695dfcc4f0
--- /dev/null
+++ b/test/tscalar.el
@@ -0,0 +1,42 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi <kaushal.modi@gmail.com>
+
+;; This file is not part of GNU Emacs.
+
+;; This program 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.
+
+;; This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Test conversion to scalar TOML objects.
+;; https://toml.io/en/v1.0.0#keys
+
+;;; Code:
+(require 'tomelr)
+
+;;;; Scalar - Boolean
+(ert-deftest test-scalar-bool ()
+  (let ((inp '(((bool1 . t))
+               ((bool2 . :false))
+               ((bool3 . "false"))))
+        (ref '("bool1 = true"
+               "bool2 = false"
+               "bool3 = false"))
+        out)
+    (dolist (el inp)
+      (push (tomelr-encode el) out))
+    (should (equal ref (nreverse out)))))
+
+
+(provide 'tscalar)



reply via email to

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