emacs-diffs
[Top][All Lists]
Advanced

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

master b068725d40d: Use slot names rather than their :initargs


From: Stefan Monnier
Subject: master b068725d40d: Use slot names rather than their :initargs
Date: Wed, 7 Feb 2024 11:11:44 -0500 (EST)

branch: master
commit b068725d40dd1ab918178b3cbca7b5672037210f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Use slot names rather than their :initargs
    
    * test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
    (eieio-test-39-clone-instance-inheritor-with-args):
    
    * test/lisp/auth-source-tests.el (auth-source-ensure-ignored-backend)
    (auth-source-backend-parse-macos-keychain)
    (auth-source-backend-parse-macos-keychain-generic-string)
    (auth-source-backend-parse-macos-keychain-internet-string)
    (auth-source-backend-parse-macos-keychain-internet-symbol)
    (auth-source-backend-parse-macos-keychain-generic-symbol)
    (auth-source-backend-parse-macos-keychain-internet-default-string)
    (auth-source-backend-parse-plstore, auth-source-backend-parse-netrc)
    (auth-source-backend-parse-netrc-string)
    (auth-source-backend-parse-secrets)
    (auth-source-backend-parse-secrets-strings)
    (auth-source-backend-parse-secrets-alias)
    (auth-source-backend-parse-secrets-symbol)
    (auth-source-backend-parse-secrets-no-alias):
    Use slot names rather than their :initargs.
---
 test/lisp/auth-source-tests.el                  | 139 ++++++++++++++----------
 test/lisp/emacs-lisp/eieio-tests/eieio-tests.el |  28 ++---
 2 files changed, 95 insertions(+), 72 deletions(-)

diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el
index 0a3c1cce590..c091a7dd060 100644
--- a/test/lisp/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
@@ -33,8 +33,8 @@
 (require 'secrets)
 
 (defun auth-source-ensure-ignored-backend (source)
-    (auth-source-validate-backend source '((:source . "")
-                                           (:type . ignore))))
+    (auth-source-validate-backend source '((source . "")
+                                           (type . ignore))))
 
 (defun auth-source-validate-backend (source validation-alist)
   (let ((backend (auth-source-backend-parse source)))
@@ -44,84 +44,101 @@
 
 (ert-deftest auth-source-backend-parse-macos-keychain ()
   (auth-source-validate-backend '(:source (:macos-keychain-generic foobar))
-                                '((:source . "foobar")
-                                  (:type . macos-keychain-generic)
-                                  (:search-function . 
auth-source-macos-keychain-search)
-                                  (:create-function . 
auth-source-macos-keychain-create))))
+                                '((source . "foobar")
+                                  (type . macos-keychain-generic)
+                                  (search-function . 
auth-source-macos-keychain-search)
+                                  (create-function . 
auth-source-macos-keychain-create))))
 
 (ert-deftest auth-source-backend-parse-macos-keychain-generic-string ()
   (auth-source-validate-backend "macos-keychain-generic:foobar"
-                                '((:source . "foobar")
-                                  (:type . macos-keychain-generic)
-                                  (:search-function . 
auth-source-macos-keychain-search)
-                                  (:create-function . 
auth-source-macos-keychain-create))))
+                                '((source . "foobar")
+                                  (type . macos-keychain-generic)
+                                  (search-function
+                                   . auth-source-macos-keychain-search)
+                                  (create-function
+                                   . auth-source-macos-keychain-create))))
 
 (ert-deftest auth-source-backend-parse-macos-keychain-internet-string ()
   (auth-source-validate-backend "macos-keychain-internet:foobar"
-                                '((:source . "foobar")
-                                  (:type . macos-keychain-internet)
-                                  (:search-function . 
auth-source-macos-keychain-search)
-                                  (:create-function . 
auth-source-macos-keychain-create))))
+                                '((source . "foobar")
+                                  (type . macos-keychain-internet)
+                                  (search-function
+                                   . auth-source-macos-keychain-search)
+                                  (create-function
+                                   . auth-source-macos-keychain-create))))
 
 (ert-deftest auth-source-backend-parse-macos-keychain-internet-symbol ()
   (auth-source-validate-backend 'macos-keychain-internet
-                                '((:source . "default")
-                                  (:type . macos-keychain-internet)
-                                  (:search-function . 
auth-source-macos-keychain-search)
-                                  (:create-function . 
auth-source-macos-keychain-create))))
+                                '((source . "default")
+                                  (type . macos-keychain-internet)
+                                  (search-function
+                                   . auth-source-macos-keychain-search)
+                                  (create-function
+                                   . auth-source-macos-keychain-create))))
 
 (ert-deftest auth-source-backend-parse-macos-keychain-generic-symbol ()
   (auth-source-validate-backend 'macos-keychain-generic
-                                '((:source . "default")
-                                  (:type . macos-keychain-generic)
-                                  (:search-function . 
auth-source-macos-keychain-search)
-                                  (:create-function . 
auth-source-macos-keychain-create))))
+                                '((source . "default")
+                                  (type . macos-keychain-generic)
+                                  (search-function
+                                   . auth-source-macos-keychain-search)
+                                  (create-function
+                                   . auth-source-macos-keychain-create))))
 
 (ert-deftest auth-source-backend-parse-macos-keychain-internet-default-string 
()
   (auth-source-validate-backend 'macos-keychain-internet
-                                '((:source . "default")
-                                  (:type . macos-keychain-internet)
-                                  (:search-function . 
auth-source-macos-keychain-search)
-                                  (:create-function . 
auth-source-macos-keychain-create))))
+                                '((source . "default")
+                                  (type . macos-keychain-internet)
+                                  (search-function
+                                   . auth-source-macos-keychain-search)
+                                  (create-function
+                                   . auth-source-macos-keychain-create))))
 
 (ert-deftest auth-source-backend-parse-plstore ()
   (auth-source-validate-backend '(:source "foo.plist")
-                                '((:source . "foo.plist")
-                                  (:type . plstore)
-                                  (:search-function . 
auth-source-plstore-search)
-                                  (:create-function . 
auth-source-plstore-create))))
+                                '((source . "foo.plist")
+                                  (type . plstore)
+                                  (search-function . 
auth-source-plstore-search)
+                                  (create-function
+                                   . auth-source-plstore-create))))
 
 (ert-deftest auth-source-backend-parse-netrc ()
   (auth-source-validate-backend '(:source "foo")
-                                '((:source . "foo")
-                                  (:type . netrc)
-                                  (:search-function . auth-source-netrc-search)
-                                  (:create-function . 
auth-source-netrc-create))))
+                                '((source . "foo")
+                                  (type . netrc)
+                                  (search-function . auth-source-netrc-search)
+                                  (create-function
+                                   . auth-source-netrc-create))))
 
 (ert-deftest auth-source-backend-parse-netrc-string ()
   (auth-source-validate-backend "foo"
-                                '((:source . "foo")
-                                  (:type . netrc)
-                                  (:search-function . auth-source-netrc-search)
-                                  (:create-function . 
auth-source-netrc-create))))
+                                '((source . "foo")
+                                  (type . netrc)
+                                  (search-function . auth-source-netrc-search)
+                                  (create-function
+                                   . auth-source-netrc-create))))
 
 (ert-deftest auth-source-backend-parse-secrets ()
   (provide 'secrets) ; simulates the presence of the `secrets' package
   (let ((secrets-enabled t))
     (auth-source-validate-backend '(:source (:secrets "foo"))
-                                  '((:source . "foo")
-                                    (:type . secrets)
-                                    (:search-function . 
auth-source-secrets-search)
-                                    (:create-function . 
auth-source-secrets-create)))))
+                                  '((source . "foo")
+                                    (type . secrets)
+                                    (search-function
+                                     . auth-source-secrets-search)
+                                    (create-function
+                                     . auth-source-secrets-create)))))
 
 (ert-deftest auth-source-backend-parse-secrets-strings ()
   (provide 'secrets) ; simulates the presence of the `secrets' package
   (let ((secrets-enabled t))
     (auth-source-validate-backend "secrets:foo"
-                                  '((:source . "foo")
-                                    (:type . secrets)
-                                    (:search-function . 
auth-source-secrets-search)
-                                    (:create-function . 
auth-source-secrets-create)))))
+                                  '((source . "foo")
+                                    (type . secrets)
+                                    (search-function
+                                     . auth-source-secrets-search)
+                                    (create-function
+                                     . auth-source-secrets-create)))))
 
 (ert-deftest auth-source-backend-parse-secrets-alias ()
   (provide 'secrets) ; simulates the presence of the `secrets' package
@@ -129,10 +146,12 @@
     ;; Redefine `secrets-get-alias' to map 'foo to "foo"
     (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) "foo")))
       (auth-source-validate-backend '(:source (:secrets foo))
-                                    '((:source . "foo")
-                                      (:type . secrets)
-                                      (:search-function . 
auth-source-secrets-search)
-                                      (:create-function . 
auth-source-secrets-create))))))
+                                    '((source . "foo")
+                                      (type . secrets)
+                                      (search-function
+                                       . auth-source-secrets-search)
+                                      (create-function
+                                       . auth-source-secrets-create))))))
 
 (ert-deftest auth-source-backend-parse-secrets-symbol ()
   (provide 'secrets) ; simulates the presence of the `secrets' package
@@ -140,10 +159,12 @@
     ;; Redefine `secrets-get-alias' to map 'default to "foo"
     (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) "foo")))
       (auth-source-validate-backend 'default
-                                    '((:source . "foo")
-                                      (:type . secrets)
-                                      (:search-function . 
auth-source-secrets-search)
-                                      (:create-function . 
auth-source-secrets-create))))))
+                                    '((source . "foo")
+                                      (type . secrets)
+                                      (search-function
+                                       . auth-source-secrets-search)
+                                      (create-function
+                                       . auth-source-secrets-create))))))
 
 (ert-deftest auth-source-backend-parse-secrets-no-alias ()
   (provide 'secrets) ; simulates the presence of the `secrets' package
@@ -152,10 +173,12 @@
     ;; "Login" is used by default
     (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) nil)))
       (auth-source-validate-backend '(:source (:secrets foo))
-                                    '((:source . "Login")
-                                      (:type . secrets)
-                                      (:search-function . 
auth-source-secrets-search)
-                                      (:create-function . 
auth-source-secrets-create))))))
+                                    '((source . "Login")
+                                      (type . secrets)
+                                      (search-function
+                                       . auth-source-secrets-search)
+                                      (create-function
+                                       . auth-source-secrets-create))))))
 
 (ert-deftest auth-source-backend-parse-invalid-or-nil-source ()
   (provide 'secrets) ; simulates the presence of the `secrets' package
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index 83fc476c911..bc226757ff2 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -1011,24 +1011,24 @@ Subclasses to override slot attributes."))
          (B (clone A :b "bb"))
          (C (clone B :a "aa")))
 
-    (should (string= "aa" (oref C :a)))
-    (should (string= "bb" (oref C :b)))
+    (should (string= "aa" (oref C a)))
+    (should (string= "bb" (oref C b)))
 
-    (should (slot-boundp A :a))
-    (should-not (slot-boundp A :b))
-    (should-not (slot-boundp A :c))
+    (should (slot-boundp A 'a))
+    (should-not (slot-boundp A 'b))
+    (should-not (slot-boundp A 'c))
 
-    (should-not (slot-boundp B :a))
-    (should (slot-boundp B :b))
-    (should-not (slot-boundp A :c))
+    (should-not (slot-boundp B 'a))
+    (should (slot-boundp B 'b))
+    (should-not (slot-boundp A 'c))
 
-    (should (slot-boundp C :a))
-    (should-not (slot-boundp C :b))
-    (should-not (slot-boundp C :c))
+    (should (slot-boundp C 'a))
+    (should-not (slot-boundp C 'b))
+    (should-not (slot-boundp C 'c))
 
-    (should (eieio-instance-inheritor-slot-boundp C :a))
-    (should (eieio-instance-inheritor-slot-boundp C :b))
-    (should-not (eieio-instance-inheritor-slot-boundp C :c))))
+    (should (eieio-instance-inheritor-slot-boundp C 'a))
+    (should (eieio-instance-inheritor-slot-boundp C 'b))
+    (should-not (eieio-instance-inheritor-slot-boundp C 'c))))
 
 ;;;; Interaction with defstruct
 



reply via email to

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