Skip to content

Commit

Permalink
Use condition-case instead of should-error to avoid something.
Browse files Browse the repository at this point in the history
  • Loading branch information
okamsn committed Feb 13, 2024
1 parent c678dbc commit 6d0befc
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/misc-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,23 @@ INPUT is the destructuring usage. OUTPUT-PATTERN is what to match."
l))))))

(ert-deftest generalized-array-should-error ()
(should-error (loopy--destructure-generalized-array [a b &optional c] 'val)
:type 'loopy-&optional-generalized-variable)

(should-error (loopy--destructure-generalized-array [a b &map ('c c 27)] 'val)
:type 'loopy-generalized-default)

(should-error (loopy--destructure-generalized-array [a b &map ('c c nil c-supp)] 'val)
:type 'loopy-generalized-supplied))
;; TODO: Having trouble with `should-error' here?
;; (should-error (loopy--destructure-generalized-array [a b &optional c] 'val)
;; :type '(loopy-&optional-generalized-variable))
(should (condition-case err
(loopy--destructure-generalized-array [a b &optional c] 'val)
(loopy-&optional-generalized-variable
t)))

(should (condition-case err
(loopy--destructure-generalized-array [a b &map ('c c 27)] 'val)
(loopy-generalized-default
t)))

(should (condition-case err
(loopy--destructure-generalized-array [a b &map ('c c nil c-supp)] 'val)
(loopy-generalized-supplied
t))))

(ert-deftest destructure-array-refs ()
(should (equal [1 2 3]
Expand Down

0 comments on commit 6d0befc

Please sign in to comment.