emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/compat 5abd876d93 03/12: Add gensym test


From: ELPA Syncer
Subject: [elpa] externals/compat 5abd876d93 03/12: Add gensym test
Date: Wed, 4 Jan 2023 12:57:35 -0500 (EST)

branch: externals/compat
commit 5abd876d93311c2b00e534c285f4e55432653ef7
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add gensym test
---
 compat-25.el    | 18 +++++++-----------
 compat-26.el    | 24 ++++++++++++------------
 compat-28.el    | 22 +++++++++++-----------
 compat-tests.el |  5 +++++
 4 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/compat-25.el b/compat-25.el
index 18d1da0f9e..f24bd93541 100644
--- a/compat-25.el
+++ b/compat-25.el
@@ -28,7 +28,7 @@
 
 ;;;; Defined in alloc.c
 
-(compat-defun bool-vector (&rest objects) ;; <UNTESTED>
+(compat-defun bool-vector (&rest objects) ;; <OK>
   "Return a new bool-vector with specified arguments as elements.
 Allows any number of arguments, including zero.
 usage: (bool-vector &rest OBJECTS)"
@@ -43,7 +43,7 @@ usage: (bool-vector &rest OBJECTS)"
 
 ;;;; Defined in fns.c
 
-(compat-defun sort (seq predicate) ;; <UNTESTED>
+(compat-defun sort (seq predicate) ;; <OK>
   "Extend `sort' to sort SEQ as a vector."
   :explicit t
   (cond
@@ -66,13 +66,9 @@ The other arguments are substituted into it to make the 
result, a string.
 This implementation is equivalent to `format'."
   (apply #'format string objects))
 
-;;;; Defined in minibuf.c
-
-;; TODO advise read-buffer to handle 4th argument
-
 ;;;; Defined in fileio.c
 
-(compat-defun directory-name-p (name) ;; <UNTESTED>
+(compat-defun directory-name-p (name) ;; <OK>
   "Return non-nil if NAME ends with a directory separator character."
   (eq (eval-when-compile
         (if (memq system-type '(cygwin windows-nt ms-dos))
@@ -99,7 +95,7 @@ MODES is as for `set-default-file-modes'."
              ,@body)
          (set-default-file-modes ,umask)))))
 
-(compat-defun alist-get (key alist &optional default remove testfn) ;; 
<UNTESTED>
+(compat-defun alist-get (key alist &optional default remove testfn) ;; <OK>
   "Find the first element of ALIST whose `car' equals KEY and return its `cdr'.
 If KEY is not found in ALIST, return DEFAULT.
 Equality with KEY is tested by TESTFN, defaulting to `eq'."
@@ -118,7 +114,7 @@ Equality with KEY is tested by TESTFN, defaulting to `eq'."
         default)))
     (if entry (cdr entry) default)))
 
-(compat-defmacro if-let (spec then &rest else) ;; <UNTESTED>
+(compat-defmacro if-let (spec then &rest else) ;; <OK>
   "Bind variables according to SPEC and evaluate THEN or ELSE.
 Evaluate each binding in turn, as in `let*', stopping if a
 binding value is nil.  If all are non-nil return the value of
@@ -153,7 +149,7 @@ with an old syntax that accepted only one binding."
     `(let* ,(nreverse list)
        (if ,(caar list) ,then ,@else))))
 
-(compat-defmacro when-let (spec &rest body) ;; <UNTESTED>
+(compat-defmacro when-let (spec &rest body) ;; <OK>
   "Bind variables according to SPEC and conditionally evaluate BODY.
 Evaluate each binding in turn, stopping if a binding value is nil.
 If all are non-nil, return the value of the last form in BODY.
@@ -228,7 +224,7 @@ threading."
 ;;;; Defined in macroexp.el
 
 (declare-function macrop nil (object))
-(compat-defun macroexpand-1 (form &optional environment) ;; <UNTESTED>
+(compat-defun macroexpand-1 (form &optional environment) ;; <OK>
   "Perform (at most) one step of macro expansion."
   :feature macroexp
   (cond
diff --git a/compat-26.el b/compat-26.el
index ee4e3f4036..bd058457a1 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -100,7 +100,7 @@ function with `&rest' args, or `unevalled' for a special 
form."
 
 ;;;; Defined in fns.c
 
-(compat-defun assoc (key alist &optional testfn) ;; <UNTESTED>
+(compat-defun assoc (key alist &optional testfn) ;; <OK>
   "Handle the optional argument TESTFN.
 Equality is defined by the function TESTFN, defaulting to
 `equal'.  TESTFN is called with 2 arguments: a car of an alist
@@ -138,7 +138,7 @@ from the absolute start of the buffer, disregarding the 
narrowing."
 ;;;; Defined in subr.el
 
 (declare-function alist-get nil (key alist &optional default remove))
-(compat-defun alist-get (key alist &optional default remove testfn) ;; 
<UNTESTED>
+(compat-defun alist-get (key alist &optional default remove testfn) ;; <OK>
   "Handle TESTFN manually."
   :explicit t
   (if testfn
@@ -174,7 +174,7 @@ from the absolute start of the buffer, disregarding the 
narrowing."
                                                `(delq ,p ,getter))))))
                             ,v))))))))))
 
-(compat-defun string-trim-left (string &optional regexp) ;; <UNTESTED>
+(compat-defun string-trim-left (string &optional regexp) ;; <OK>
   "Trim STRING of leading string matching REGEXP.
 
 REGEXP defaults to \"[ \\t\\n\\r]+\"."
@@ -184,7 +184,7 @@ REGEXP defaults to \"[ \\t\\n\\r]+\"."
       (substring string (match-end 0))
     string))
 
-(compat-defun string-trim-right (string &optional regexp) ;; <UNTESTED>
+(compat-defun string-trim-right (string &optional regexp) ;; <OK>
   "Trim STRING of trailing string matching REGEXP.
 
 REGEXP defaults to  \"[ \\t\\n\\r]+\"."
@@ -195,7 +195,7 @@ REGEXP defaults to  \"[ \\t\\n\\r]+\"."
             string)))
     (if i (substring string 0 i) string)))
 
-(compat-defun string-trim (string &optional trim-left trim-right) ;; <UNTESTED>
+(compat-defun string-trim (string &optional trim-left trim-right) ;; <OK>
   "Trim STRING of leading with and trailing matching TRIM-LEFT and TRIM-RIGHT.
 
 TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
@@ -332,7 +332,7 @@ TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
 (compat-defvar gensym-counter 0
   "Number used to construct the name of the next symbol created by `gensym'.")
 
-(compat-defun gensym (&optional prefix) ;; <UNTESTED>
+(compat-defun gensym (&optional prefix) ;; <OK>
   "Return a new uninterned symbol.
 The name is made by appending `gensym-counter' to PREFIX.
 PREFIX is a string, and defaults to \"g\"."
@@ -341,7 +341,7 @@ PREFIX is a string, and defaults to \"g\"."
                      (1+ gensym-counter)))))
     (make-symbol (format "%s%d" (or prefix "g") num))))
 
-(compat-defmacro if-let* (varlist then &rest else) ;; <UNTESTED>
+(compat-defmacro if-let* (varlist then &rest else) ;; <OK>
   "Bind variables according to VARLIST and evaluate THEN or ELSE.
 This is like `if-let' but doesn't handle a VARLIST of the form
 \(SYMBOL SOMETHING) specially."
@@ -359,7 +359,7 @@ This is like `if-let' but doesn't handle a VARLIST of the 
form
     `(let* ,(nreverse list)
        (if ,(caar list) ,then ,@else))))
 
-(compat-defmacro when-let* (varlist &rest body) ;; <UNTESTED>
+(compat-defmacro when-let* (varlist &rest body) ;; <OK>
   "Bind variables according to VARLIST and conditionally evaluate BODY.
 This is like `when-let' but doesn't handle a VARLIST of the form
 \(SYMBOL SOMETHING) specially."
@@ -377,7 +377,7 @@ This is like `when-let' but doesn't handle a VARLIST of the 
form
     `(let* ,(nreverse list)
        (when ,(caar list) ,@body))))
 
-(compat-defmacro and-let* (varlist &rest body) ;; <UNTESTED>
+(compat-defmacro and-let* (varlist &rest body) ;; <OK>
   "Bind variables according to VARLIST and conditionally evaluate BODY.
 Like `when-let*', except if BODY is empty and all the bindings
 are non-nil, then the result is non-nil."
@@ -422,7 +422,7 @@ same meaning as in `make-temp-file'."
          "^" (regexp-opt '("/afs/" "/media/" "/mnt" "/net/" "/tmp_mnt/")))))
   "File systems that ought to be mounted.")
 
-(compat-defun file-local-name (file) ;; <UNTESTED>
+(compat-defun file-local-name (file) ;; <OK>
   "Return the local name component of FILE.
 This function removes from FILE the specification of the remote host
 and the method of accessing the host, leaving only the part that
@@ -431,14 +431,14 @@ The returned file name can be used directly as argument of
 `process-file', `start-file-process', or `shell-command'."
   (or (file-remote-p file 'localname) file))
 
-(compat-defun file-name-quoted-p (name &optional top) ;; <UNTESTED>
+(compat-defun file-name-quoted-p (name &optional top) ;; <OK>
   "Whether NAME is quoted with prefix \"/:\".
 If NAME is a remote file name and TOP is nil, check the local part of NAME."
   :explicit t
   (let ((file-name-handler-alist (unless top file-name-handler-alist)))
     (string-prefix-p "/:" (file-local-name name))))
 
-(compat-defun file-name-quote (name &optional top) ;; <UNTESTED>
+(compat-defun file-name-quote (name &optional top) ;; <OK>
   "Add the quotation prefix \"/:\" to file NAME.
 If NAME is a remote file name and TOP is nil, the local part of
 NAME is quoted.  If NAME is already a quoted file name, NAME is
diff --git a/compat-28.el b/compat-28.el
index 6947ad65ee..a333143b5f 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -29,7 +29,7 @@
 ;;;; Defined in fns.c
 
 ;;* INCOMPLETE FEATURE: Should handle multibyte regular expressions
-(compat-defun string-search (needle haystack &optional start-pos) ;; <UNTESTED>
+(compat-defun string-search (needle haystack &optional start-pos) ;; <OK>
   "Search for the string NEEDLE in the strign HAYSTACK.
 
 The return value is the position of the first occurrence of
@@ -135,7 +135,7 @@ continuing as if the error did not occur."
 
 ;;;; Defined in characters.c
 
-(compat-defun string-width (string &optional from to) ;; <UNTESTED>
+(compat-defun string-width (string &optional from to) ;; <OK>
   "Handle optional arguments FROM and TO:
 
 Optional arguments FROM and TO specify the substring of STRING to
@@ -299,7 +299,7 @@ and BLUE, is normalized to have its value in [0,65535]."
 ;;;; Defined in subr.el
 
 ;;* INCOMPLETE FEATURE: Should handle multibyte regular expressions
-(compat-defun string-replace (fromstring tostring instring) ;; <UNTESTED>
+(compat-defun string-replace (fromstring tostring instring) ;; <OK>
   "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs."
   (when (equal fromstring "")
     (signal 'wrong-length-argument '(0)))
@@ -309,13 +309,13 @@ and BLUE, is normalized to have its value in [0,65535]."
      tostring instring
      t t)))
 
-(compat-defun always (&rest _arguments) ;; <UNTESTED>
+(compat-defun always (&rest _arguments) ;; <OK>
   "Do nothing and return t.
 This function accepts any number of ARGUMENTS, but ignores them.
 Also see `ignore'."
   t)
 
-(compat-defun insert-into-buffer (buffer &optional start end) ;; <UNTESTED>
+(compat-defun insert-into-buffer (buffer &optional start end) ;; <OK>
   "Insert the contents of the current buffer into BUFFER.
 If START/END, only insert that region from the current buffer.
 Point in BUFFER will be placed after the inserted text."
@@ -433,7 +433,7 @@ not a list, return a one-element list containing OBJECT."
 
 ;;;; Defined in subr-x.el
 
-(compat-defun string-clean-whitespace (string) ;; <UNTESTED>
+(compat-defun string-clean-whitespace (string) ;; <OK>
   "Clean up whitespace in STRING.
 All sequences of whitespaces in STRING are collapsed into a
 single space character, and leading/trailing whitespace is
@@ -445,7 +445,7 @@ removed."
      (replace-regexp-in-string
       blank " " string))))
 
-(compat-defun string-fill (string length) ;; <UNTESTED>
+(compat-defun string-fill (string length) ;; <OK>
   "Clean up whitespace in STRING.
 All sequences of whitespaces in STRING are collapsed into a
 single space character, and leading/trailing whitespace is
@@ -458,12 +458,12 @@ removed."
       (fill-region (point-min) (point-max)))
     (buffer-string)))
 
-(compat-defun string-lines (string &optional omit-nulls) ;; <UNTESTED>
+(compat-defun string-lines (string &optional omit-nulls) ;; <OK>
   "Split STRING into a list of lines.
 If OMIT-NULLS, empty lines will be removed from the results."
   (split-string string "\n" omit-nulls))
 
-(compat-defun string-pad (string length &optional padding start) ;; <UNTESTED>
+(compat-defun string-pad (string length &optional padding start) ;; <OK>
   "Pad STRING to LENGTH using PADDING.
 If PADDING is nil, the space character is used.  If not nil, it
 should be a character.
@@ -485,13 +485,13 @@ the string."
               (and (not start)
                    (make-string pad-length (or padding ?\s)))))))
 
-(compat-defun string-chop-newline (string) ;; <UNTESTED>
+(compat-defun string-chop-newline (string) ;; <OK>
   "Remove the final newline (if any) from STRING."
   (if (and (>= (length string) 1) (= (aref string (1- (length string))) ?\n))
       (substring string 0 -1)
     string))
 
-(compat-defmacro named-let (name bindings &rest body) ;; <UNTESTED>
+(compat-defmacro named-let (name bindings &rest body) ;; <OK>
   "Looping construct taken from Scheme.
 Like `let', bind variables in BINDINGS and then evaluate BODY,
 but with the twist that BODY can evaluate itself recursively by
diff --git a/compat-tests.el b/compat-tests.el
index 2812838c3f..c0bf618154 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -46,6 +46,11 @@
 (defmacro should-equal (a b)
   `(should (equal ,a ,b)))
 
+(ert-deftest gensym ()
+  (should (symbolp (gensym "compat")))
+  (should (string-prefix-p "compat" (symbol-name (gensym 'compat))))
+  (should (string-prefix-p "compat" (symbol-name (gensym "compat")))))
+
 (ert-deftest plist-get ()
   (let (list)
     (setq list (compat-call plist-put list 'first 1))



reply via email to

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