[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/f90-interface-browser 17a5751 2/5: * packages/f90-inter
From: |
Stefan Monnier |
Subject: |
[elpa] externals/f90-interface-browser 17a5751 2/5: * packages/f90-interface-browser/f90-interface-browser.el: Don't require CL |
Date: |
Fri, 27 Nov 2020 18:56:51 -0500 (EST) |
branch: externals/f90-interface-browser
commit 17a5751999521e5b009e84ccf844c87dd9b66073
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* packages/f90-interface-browser/f90-interface-browser.el: Don't require CL
at runtime since it's not needed.
(f90-approx-arglist-match): Remove unused var `match'.
(f90-parse-single-type-declaration): Don't use `add-to-list' on a local var.
* packages/f90-interface-browser/f90-tests.el: Require `cl-lib'.
(test-check, test-combine-results, parse-declaration): Fix up
names accordingly.
---
f90-interface-browser.el | 12 +++++-------
f90-tests.el | 44 ++++++++++++++++++++++++++++++++++----------
2 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/f90-interface-browser.el b/f90-interface-browser.el
index 7946697..1dc7b6e 100644
--- a/f90-interface-browser.el
+++ b/f90-interface-browser.el
@@ -583,7 +583,6 @@ first (length ARGLIST) args of SPECIALISER."
(<= n-passed-args n-spec-args)))
(loop for arg in arglist
for spec-arg in spec-arglist
- with match = nil
unless (or (null arg)
(string= (f90-get-parsed-type-typename arg)
(f90-get-parsed-type-typename spec-arg)))
@@ -1000,13 +999,12 @@ dealt with correctly."
(setcdr (assoc "dimension" dec)
(1+ (f90-count-commas
(match-string 2 name))))
- (add-to-list 'dec
- (cons "dimension"
- (1+ (f90-count-commas
- (match-string 2 name))))
- t))
+ (push (cons "dimension"
+ (1+ (f90-count-commas
+ (match-string 2 name))))
+ dec))
(setq name (match-string 1 name)))
- collect (cons name dec)))))
+ collect (cons name (nreverse dec))))))
(defun f90-split-declaration (dec)
"Split and parse a type declaration DEC.
diff --git a/f90-tests.el b/f90-tests.el
index d653882..74c0dee 100644
--- a/f90-tests.el
+++ b/f90-tests.el
@@ -1,3 +1,26 @@
+;;; f90-tests.el --- Tests for f90-interface-browser
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; 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 <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+
+;; FIXME: Convert to use ERT.
+
(defvar *test-name* nil)
(defvar *test-tests* (make-hash-table :test 'eq))
@@ -16,17 +39,18 @@
(defmacro test-check (&rest forms)
"Run each expression in 'forms' as a test case."
`(test-combine-results
- ,@(loop for (expr res) in forms
- collect `(test-report-result (equal (condition-case err
- ,expr
- (error (gensym))) ',res)
- ',expr ',res))))
+ ,@(cl-loop for (expr res) in forms
+ collect `(test-report-result (equal (condition-case _
+ ,expr
+ (error (cl-gensym)))
+ ',res)
+ ',expr ',res))))
(defmacro test-combine-results (&rest forms)
"Combine the results (as booleans) of evaluating 'forms' in order."
(let ((result (make-symbol "result")))
`(let ((,result t))
- ,@(loop for f in forms collect `(unless ,f (setf ,result nil)))
+ ,@(cl-loop for f in forms collect `(unless ,f (setf ,result nil)))
,result)))
(defun test-report-result (result res req)
@@ -61,10 +85,10 @@
("integer" ("dimension" . 1)))))
(deftest parse-declaration ()
- (flet ((fun (str) (with-temp-buffer
- (insert str)
- (goto-char (point-min))
- (f90-parse-single-type-declaration))))
+ (cl-flet ((fun (str) (with-temp-buffer
+ (insert str)
+ (goto-char (point-min))
+ (f90-parse-single-type-declaration))))
(test-check
((fun "integer :: name") (("name" "integer")))
((fun "integer :: name1, name2") (("name1" "integer")