bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#37432: 27.0.50; Add test suite for backquote.el


From: Tino Calancha
Subject: bug#37432: 27.0.50; Add test suite for backquote.el
Date: Mon, 16 Sep 2019 22:50:06 +0200

Tags: patch

--8<-----------------------------cut here---------------start------------->8---
commit d9c55842bf145e219e881080c87a42fc3ea82099
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Mon Sep 16 22:40:20 2019 +0200

    Add test suite for backquote.el
    
    * test/lisp/emacs-lisp/backquote-tests.el: New file.

diff --git a/test/lisp/emacs-lisp/backquote-tests.el 
b/test/lisp/emacs-lisp/backquote-tests.el
new file mode 100644
index 0000000000..8e35cc201b
--- /dev/null
+++ b/test/lisp/emacs-lisp/backquote-tests.el
@@ -0,0 +1,48 @@
+;;; backquote-tests.el --- Tests for backquote.el -*- lexical-binding: t -*-
+
+;; Copyright (C) 2019 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 'ert)
+
+(ert-deftest backquote-test-basic ()
+  (let ((lst '(ba bb bc))
+        (vec [ba bb bc]))
+    (should (equal 3 `,(eval '(+ x y) '((x . 1) (y . 2)))))
+    (should (equal vec `[,@lst]))
+    (should (equal `(a lst c) '(a lst c)))
+    (should (equal `(a ,lst c) '(a (ba bb bc) c)))
+    (should (equal `(a ,@lst c) '(a ba bb bc c)))
+    ;; Vectors work just like lists.
+    (should (equal `(a vec c) '(a vec c)))
+    (should (equal `(a ,vec c) '(a [ba bb bc] c)))
+    (should (equal `(a ,@vec c) '(a ba bb bc c)))))
+
+(ert-deftest backquote-test-nested ()
+  "Test nested backquotes."
+  (let ((lst '(ba bb bc))
+        (vec [ba bb bc]))
+    (should (equal `(a ,`(,@lst) c) `(a ,lst c)))
+    (should (equal `(a ,`[,@lst] c) `(a ,vec c)))
+    (should (equal `(a ,@`[,@lst] c) `(a ,@lst c)))))
+
+
+;;; backquote-tests.el ends here

--8<-----------------------------cut here---------------end--------------->8---

In GNU Emacs 27.0.50 (build 23, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-16 built
Repository revision: 1a84d8fba4b526f7c8f240b8163e66714a41cca6
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)





reply via email to

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