[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 47ab6c2 02/12: Add some testing for dynamic scope
From: |
Andrea Corallo |
Subject: |
feature/native-comp 47ab6c2 02/12: Add some testing for dynamic scope |
Date: |
Sun, 21 Jun 2020 18:37:15 -0400 (EDT) |
branch: feature/native-comp
commit 47ab6c237e703cf4b5bbcd3c301e324e0deb1173
Author: Andrea Corallo <andcor03@e112547.nice.arm.com>
Commit: Andrea Corallo <akrl@sdf.org>
Add some testing for dynamic scope
* test/src/comp-test-funcs-dyn.el: New file.
* test/src/comp-tests.el (comp-tests-dynamic-ffuncall): Add
new tests.
---
test/src/comp-test-funcs-dyn.el | 40 +++++++++++++++++++++++++++++++++++
test/src/comp-tests.el | 46 +++++++++++++++++++++++++++++++++++++----
2 files changed, 82 insertions(+), 4 deletions(-)
diff --git a/test/src/comp-test-funcs-dyn.el b/test/src/comp-test-funcs-dyn.el
new file mode 100644
index 0000000..0e342a3
--- /dev/null
+++ b/test/src/comp-test-funcs-dyn.el
@@ -0,0 +1,40 @@
+;;; comp-test-funcs.el --- compilation unit tested by comp-tests.el -*-
lexical-binding: nil; -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Andrea Corallo <akrl@sdf.org>
+
+;; 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:
+
+(defun comp-tests-ffuncall-callee-dyn-f (a b)
+ (list a b))
+
+(defun comp-tests-ffuncall-callee-opt-dyn-f (a b &optional c d)
+ (list a b c d))
+
+(defun comp-tests-ffuncall-callee-rest-dyn-f (a b &rest c)
+ (list a b c))
+
+(defun comp-tests-ffuncall-callee-opt-rest-dyn-f (a b &optional c &rest d)
+ (list a b c d))
+
+(provide 'comp-test-dyn-funcs)
+
+;;; comp-test-funcs-dyn.el ends here
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 3e40dba..ee96d56 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -34,8 +34,14 @@
(defconst comp-test-src
(concat comp-test-directory "comp-test-funcs.el"))
-(message "Compiling %s" comp-test-src)
+(defconst comp-test-dyn-src
+ (concat comp-test-directory "comp-test-funcs-dyn.el"))
+
+(message "Compiling tests...")
(load (native-compile comp-test-src))
+(load (native-compile comp-test-dyn-src))
+
+
(ert-deftest comp-tests-bootstrap ()
"Compile the compiler and load it to compile it-self.
@@ -353,9 +359,9 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
(should (eq (comp-test-40187-2-f) 'bar)))
-;;;;;;;;;;;;;;;;;;;;
-;; Tromey's tests ;;
-;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;
+;; Tromey's tests. ;;
+;;;;;;;;;;;;;;;;;;;;;
(ert-deftest comp-consp ()
(should-not (comp-test-consp 23))
@@ -520,4 +526,36 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
nil))
(should (eq comp-test-up-val 999)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Tests for dynamic scope. ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(ert-deftest comp-tests-dynamic-ffuncall ()
+ "Test calling convention for dynamic binding."
+
+ (should (equal (comp-tests-ffuncall-callee-dyn-f 1 2)
+ '(1 2)))
+
+ (should (equal (comp-tests-ffuncall-callee-opt-dyn-f 1 2 3 4)
+ '(1 2 3 4)))
+ (should (equal (comp-tests-ffuncall-callee-opt-dyn-f 1 2 3)
+ '(1 2 3 nil)))
+ (should (equal (comp-tests-ffuncall-callee-opt-dyn-f 1 2)
+ '(1 2 nil nil)))
+
+ (should (equal (comp-tests-ffuncall-callee-rest-dyn-f 1 2)
+ '(1 2 nil)))
+ (should (equal (comp-tests-ffuncall-callee-rest-dyn-f 1 2 3)
+ '(1 2 (3))))
+ (should (equal (comp-tests-ffuncall-callee-rest-dyn-f 1 2 3 4)
+ '(1 2 (3 4))))
+
+ (should (equal (comp-tests-ffuncall-callee-opt-rest-dyn-f 1 2)
+ '(1 2 nil nil)))
+ (should (equal (comp-tests-ffuncall-callee-opt-rest-dyn-f 1 2 3)
+ '(1 2 3 nil)))
+ (should (equal (comp-tests-ffuncall-callee-opt-rest-dyn-f 1 2 3 4)
+ '(1 2 3 (4)))))
+
;;; comp-tests.el ends here
- feature/native-comp updated (5a55a84 -> c324e02), Andrea Corallo, 2020/06/21
- feature/native-comp c37b544 01/12: Add native compiler dynamic scope support, Andrea Corallo, 2020/06/21
- feature/native-comp 47ab6c2 02/12: Add some testing for dynamic scope,
Andrea Corallo <=
- feature/native-comp 29b2a08 03/12: Execute top level forms in the right lex/dyn scope., Andrea Corallo, 2020/06/21
- feature/native-comp decced8 04/12: Allow per function speed declaration, Andrea Corallo, 2020/06/21
- feature/native-comp 34117de 05/12: Add a test for speed -1, Andrea Corallo, 2020/06/21
- feature/native-comp 51df0ab 06/12: Do not native compile two functions to allow cc-mode hack, Andrea Corallo, 2020/06/21
- feature/native-comp 1179a1c 07/12: * Add a func-arity test for dynamic functions, Andrea Corallo, 2020/06/21
- feature/native-comp 89b6f56 09/12: * src/comp.c (Fcomp__compile_ctxt_to_file): Confine gcc optim level in [0, 3]., Andrea Corallo, 2020/06/21
- feature/native-comp cfb871a 08/12: * Handle correctly pure delaration specifier., Andrea Corallo, 2020/06/21
- feature/native-comp 0a70ed9 10/12: ; * src/comp.c (define_maybe_gc_or_quit): Fix a comment., Andrea Corallo, 2020/06/21
- feature/native-comp c324e02 12/12: Merge remote-tracking branch 'savahnna/master' into dev, Andrea Corallo, 2020/06/21
- feature/native-comp f0e9fdd 11/12: Two `load-history' eln related fixes., Andrea Corallo, 2020/06/21