aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTino Calancha2019-09-16 22:57:25 +0200
committerLars Ingebrigtsen2019-09-16 22:57:35 +0200
commit57ac6523af76efe6f6767c5480b2832cdd3adc4d (patch)
treea9ead9e8e97ec9474eaa450a8b980af88a567ebc /test
parent2335704fccc2a5088c864bea1f10b4f0ef788e6b (diff)
downloademacs-57ac6523af76efe6f6767c5480b2832cdd3adc4d.tar.gz
emacs-57ac6523af76efe6f6767c5480b2832cdd3adc4d.zip
Add backquote tests
* test/lisp/emacs-lisp/backquote-tests.el: New file (bug#37432).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/backquote-tests.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/backquote-tests.el b/test/lisp/emacs-lisp/backquote-tests.el
new file mode 100644
index 00000000000..01f2c4a897e
--- /dev/null
+++ b/test/lisp/emacs-lisp/backquote-tests.el
@@ -0,0 +1,47 @@
1;;; backquote-tests.el --- Tests for backquote.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25
26(ert-deftest backquote-test-basic ()
27 (let ((lst '(ba bb bc))
28 (vec [ba bb bc]))
29 (should (equal 3 `,(eval '(+ x y) '((x . 1) (y . 2)))))
30 (should (equal vec `[,@lst]))
31 (should (equal `(a lst c) '(a lst c)))
32 (should (equal `(a ,lst c) '(a (ba bb bc) c)))
33 (should (equal `(a ,@lst c) '(a ba bb bc c)))
34 ;; Vectors work just like lists.
35 (should (equal `(a vec c) '(a vec c)))
36 (should (equal `(a ,vec c) '(a [ba bb bc] c)))
37 (should (equal `(a ,@vec c) '(a ba bb bc c)))))
38
39(ert-deftest backquote-test-nested ()
40 "Test nested backquotes."
41 (let ((lst '(ba bb bc))
42 (vec [ba bb bc]))
43 (should (equal `(a ,`(,@lst) c) `(a ,lst c)))
44 (should (equal `(a ,`[,@lst] c) `(a ,vec c)))
45 (should (equal `(a ,@`[,@lst] c) `(a ,@lst c)))))
46
47;;; backquote-tests.el ends here