[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 645a6aa: * automated/let-alist.el: New file.
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] master 645a6aa: * automated/let-alist.el: New file. |
Date: |
Thu, 18 Dec 2014 21:38:28 +0000 |
branch: master
commit 645a6aa4a5ee66659133f57ebeb5638bdc43beaa
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* automated/let-alist.el: New file.
---
test/ChangeLog | 4 +++
test/automated/let-alist.el | 52 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/test/ChangeLog b/test/ChangeLog
index 86703d5..8ddd80f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-18 Artur Malabarba <address@hidden>
+
+ * automated/let-alist.el: New file.
+
2014-12-16 Nicolas Petton <address@hidden>
* automated/seq-tests.el: New file.
diff --git a/test/automated/let-alist.el b/test/automated/let-alist.el
new file mode 100644
index 0000000..2054a96
--- /dev/null
+++ b/test/automated/let-alist.el
@@ -0,0 +1,52 @@
+;;; let-alist.el --- tests for file handling. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2014 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 <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+
+(ert-deftest let-alist-surface-test ()
+ "Tests basic macro expansion for `let-alist'."
+ (should
+ (equal '(let ((symbol data))
+ (let ((.test-one (cdr (assq 'test-one symbol)))
+ (.test-two (cdr (assq 'test-two symbol))))
+ (list .test-one .test-two
+ .test-two .test-two)))
+ (cl-letf (((symbol-function #'gensym) (lambda (x) 'symbol)))
+ (macroexpand
+ '(let-alist data (list .test-one .test-two
+ .test-two .test-two)))))))
+
+(defvar let-alist--test-counter 0
+ "Used to count number of times a function is called.")
+
+(ert-deftest let-alist-evaluate-once ()
+ "Check that the alist argument is only evaluated once."
+ (let ((let-alist--test-counter 0))
+ (should
+ (equal
+ (let-alist (list
+ (cons 'test-two (cl-incf let-alist--test-counter))
+ (cons 'test-three (cl-incf let-alist--test-counter)))
+ (list .test-one .test-two .test-two .test-three .cl-incf))
+ '(nil 1 1 2 nil)))))
+
+
+;;; let-alist.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 645a6aa: * automated/let-alist.el: New file.,
Artur Malabarba <=