emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp e6fb440 2/2: Merge remote-tracking branch 'savannah/


From: Andrea Corallo
Subject: feature/native-comp e6fb440 2/2: Merge remote-tracking branch 'savannah/master' into HEAD
Date: Sun, 26 Apr 2020 05:40:21 -0400 (EDT)

branch: feature/native-comp
commit e6fb440ed7e48c2e8c4bba4666db2f0ff9950a25
Merge: bb4cf13 453ada0
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    Merge remote-tracking branch 'savannah/master' into HEAD
---
 lisp/mail/rfc2045.el            |  2 +-
 lisp/misc.el                    |  8 +++--
 lisp/net/dig.el                 | 11 +++---
 lisp/play/spook.el              |  8 ++---
 src/casefiddle.c                |  2 +-
 src/ccl.c                       |  2 +-
 test/lisp/mail/rfc2045-tests.el | 36 +++++++++++++++++++
 test/lisp/misc-tests.el         | 77 +++++++++++++++++++++++++++++++++++++++++
 test/lisp/net/dig-tests.el      | 56 ++++++++++++++++++++++++++++++
 9 files changed, 184 insertions(+), 18 deletions(-)

diff --git a/lisp/mail/rfc2045.el b/lisp/mail/rfc2045.el
index 7d962ea..dba9c04 100644
--- a/lisp/mail/rfc2045.el
+++ b/lisp/mail/rfc2045.el
@@ -1,4 +1,4 @@
-;;; rfc2045.el --- Functions for decoding rfc2045 headers
+;;; rfc2045.el --- Functions for decoding rfc2045 headers  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1998-2020 Free Software Foundation, Inc.
 
diff --git a/lisp/misc.el b/lisp/misc.el
index 05244a6..8c39492 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -1,4 +1,4 @@
-;;; misc.el --- some nonstandard editing and utility commands for Emacs
+;;; misc.el --- some nonstandard editing and utility commands for Emacs  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1989, 2001-2020 Free Software Foundation, Inc.
 
@@ -162,7 +162,7 @@ Internal use only."
   "Recompute the list of dynamic libraries.
 Internal use only."
   (setq tabulated-list-format  ; recomputed because column widths can change
-        (let ((max-id-len 0) (max-name-len 0))
+        (let ((max-id-len 7) (max-name-len 11))
           (dolist (lib dynamic-library-alist)
             (let ((id-len (length (symbol-name (car lib))))
                   (name-len (apply 'max (mapcar 'length (cdr lib)))))
@@ -181,7 +181,9 @@ Internal use only."
         (push (list id (vector (symbol-name id)
                                (list-dynamic-libraries--loaded from)
                                (mapconcat 'identity (cdr lib) ", ")))
-              tabulated-list-entries)))))
+              tabulated-list-entries))))
+  (when (not dynamic-library-alist)
+    (message "No dynamic libraries found")))
 
 ;;;###autoload
 (defun list-dynamic-libraries (&optional loaded-only-p buffer)
diff --git a/lisp/net/dig.el b/lisp/net/dig.el
index 852d8ae..f369991 100644
--- a/lisp/net/dig.el
+++ b/lisp/net/dig.el
@@ -1,4 +1,4 @@
-;;; dig.el --- Domain Name System dig interface
+;;; dig.el --- Domain Name System dig interface  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2000-2020 Free Software Foundation, Inc.
 
@@ -42,15 +42,13 @@
 
 (defcustom dig-program "dig"
   "Name of dig (domain information groper) binary."
-  :type 'file
-  :group 'dig)
+  :type 'file)
 
 (defcustom dig-dns-server nil
   "DNS server to query.
 If nil, use system defaults."
   :type '(choice (const :tag "System defaults")
-                string)
-  :group 'dig)
+                string))
 
 (defcustom dig-font-lock-keywords
   '(("^;; [A-Z]+ SECTION:" 0 font-lock-keyword-face)
@@ -58,8 +56,7 @@ If nil, use system defaults."
     ("^; <<>>.*" 0 font-lock-type-face)
     ("^;.*" 0 font-lock-function-name-face))
   "Default expressions to highlight in dig mode."
-  :type 'sexp
-  :group 'dig)
+  :type 'sexp)
 
 (defun dig-invoke (domain &optional
                          query-type query-class query-option
diff --git a/lisp/play/spook.el b/lisp/play/spook.el
index 8e69cd9..ed91dad 100644
--- a/lisp/play/spook.el
+++ b/lisp/play/spook.el
@@ -1,4 +1,4 @@
-;;; spook.el --- spook phrase utility for overloading the NSA line eater
+;;; spook.el --- spook phrase utility for overloading the NSA line eater  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1988, 1993, 2001-2020 Free Software Foundation, Inc.
 
@@ -45,13 +45,11 @@
 
 (defcustom spook-phrases-file (expand-file-name "spook.lines" data-directory)
   "Keep your favorite phrases here."
-  :type 'file
-  :group 'spook)
+  :type 'file)
 
 (defcustom spook-phrase-default-count 15
   "Default number of phrases to insert."
-  :type 'integer
-  :group 'spook)
+  :type 'integer)
 
 ;;;###autoload
 (defun spook ()
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 9a711a8..debd241 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -221,7 +221,7 @@ case_character (struct casing_str_buf *buf, struct 
casing_context *ctx,
 }
 
 /* If C is not ASCII, make it unibyte. */
-static int
+static inline int
 make_char_unibyte (int c)
 {
   return ASCII_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c);
diff --git a/src/ccl.c b/src/ccl.c
index 0f82b97..ef059ff 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -856,7 +856,7 @@ struct ccl_prog_stack
 static struct ccl_prog_stack ccl_prog_stack_struct[256];
 
 /* Return a translation table of id number ID.  */
-static Lisp_Object
+static inline Lisp_Object
 GET_TRANSLATION_TABLE (int id)
 {
   return XCDR (XVECTOR (Vtranslation_table_vector)->contents[id]);
diff --git a/test/lisp/mail/rfc2045-tests.el b/test/lisp/mail/rfc2045-tests.el
new file mode 100644
index 0000000..844b16a
--- /dev/null
+++ b/test/lisp/mail/rfc2045-tests.el
@@ -0,0 +1,36 @@
+;;; rfc2045-tests.el --- Tests for rfc2045.el  -*- lexical-binding:t -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <address@hidden>
+
+;; 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 rfc2045-test-encode-string ()
+  (should (equal (rfc2045-encode-string "foo" "bar") "foo=bar"))
+  (should (equal (rfc2045-encode-string "foo" "bar-baz") "foo=bar-baz"))
+  (should (equal (rfc2045-encode-string "foo" "bar baz") "foo=\"bar baz\""))
+  (should (equal (rfc2045-encode-string "foo" "bar\tbaz") "foo=\"bar\tbaz\""))
+  (should (equal (rfc2045-encode-string "foo" "bar\nbaz") "foo=\"bar\nbaz\"")))
+
+(provide 'rfc2045-tests)
+;;; rfc2045-tests.el ends here
diff --git a/test/lisp/misc-tests.el b/test/lisp/misc-tests.el
new file mode 100644
index 0000000..fbcbfb7
--- /dev/null
+++ b/test/lisp/misc-tests.el
@@ -0,0 +1,77 @@
+;;; misc-tests.el --- Tests for misc.el  -*- lexical-binding:t -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <address@hidden>
+
+;; 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)
+
+(defmacro with-misc-test (original result &rest body)
+  (declare (indent 2))
+  `(with-temp-buffer
+     (insert ,original)
+     ,@body
+     (should (equal (buffer-string) ,result))))
+
+(ert-deftest misc-test-copy-from-above-command ()
+  (with-misc-test "abc\n" "abc\nabc"
+    (copy-from-above-command))
+  (with-misc-test "abc\n" "abc\nab"
+    (copy-from-above-command 2)))
+
+(ert-deftest misc-test-zap-up-to-char ()
+  (with-misc-test "abcde" "cde"
+    (goto-char (point-min))
+    (zap-up-to-char 1 ?c))
+  (with-misc-test "abcde abc123" "c123"
+    (goto-char (point-min))
+    (zap-up-to-char 2 ?c)))
+
+(ert-deftest misc-test-upcase-char ()
+  (with-misc-test "abcde" "aBCDe"
+    (goto-char (1+ (point-min)))
+    (upcase-char 3)))
+
+(ert-deftest misc-test-forward-to-word ()
+  (with-temp-buffer
+    (insert "    -   abc")
+    (goto-char (point-min))
+    (forward-to-word 1)
+    (should (equal (point) 9)))
+  (with-temp-buffer
+    (insert "a b c")
+    (goto-char (point-min))
+    (forward-to-word 3)
+    (should (equal (point) 6))))
+
+(ert-deftest misc-test-backward-to-word ()
+  (with-temp-buffer
+    (insert "abc    -   ")
+    (backward-to-word 1)
+    (should (equal (point) 4)))
+  (with-temp-buffer
+    (insert "a b c")
+    (backward-to-word 3)
+    (should (equal (point) 1))))
+
+(provide 'misc-tests)
+;;; misc-tests.el ends here
diff --git a/test/lisp/net/dig-tests.el b/test/lisp/net/dig-tests.el
new file mode 100644
index 0000000..1b14384
--- /dev/null
+++ b/test/lisp/net/dig-tests.el
@@ -0,0 +1,56 @@
+;;; dig-tests.el --- Tests for dig.el  -*- lexical-binding:t -*-
+
+;; Copyright (C) 2020 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)
+(require 'dig)
+
+(defvar dig-test-result-data "
+; <<>> DiG 9.11.16-2-Debian <<>> gnu.org
+;; global options: +cmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7777
+;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
+
+;; OPT PSEUDOSECTION:
+; EDNS: version: 0, flags:; udp: 4096
+;; QUESTION SECTION:
+;gnu.org.                      IN      A
+
+;; ANSWER SECTION:
+gnu.org.               300     IN      A       111.11.111.111
+
+;; Query time: 127 msec
+;; SERVER: 192.168.0.1#53(192.168.0.1)
+;; WHEN: Sun Apr 26 00:47:55 CEST 2020
+;; MSG SIZE  rcvd: 52
+
+" "Data used to test dig.el.")
+
+(ert-deftest dig-test-dig-extract-rr ()
+  (with-temp-buffer
+    (insert dig-test-result-data)
+    (should (equal (dig-extract-rr "gnu.org")
+                   "gnu.org.           300     IN      A       
111.11.111.111"))))
+
+(provide 'dig-tests)
+;;; dig-tests.el ends here



reply via email to

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