-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add test for boolean scalar key-value pairs
- Loading branch information
1 parent
52dc932
commit 05d2caf
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |