Skip to content

Commit

Permalink
Fix tests on Emacs master (30.0) where "\x" is an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiase committed Mar 24, 2023
1 parent 011f4f1 commit d00da3f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
22 changes: 22 additions & 0 deletions relint-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,26 @@ and a path."
'(("Ineffective string escape `\\?'" 16 nil nil nil warning)
("Ineffective string escape `\\!'" 1288960 nil nil nil warning)))))

(ert-deftest relint-bad-hex-escape ()
;; Test the bad \x character escape warning. We do this separately because
;; it signals an error in newer Emacs.
(let ((buf (get-buffer-create " *relint-test*"))
(text-quoting-style 'grave))
(unwind-protect
(progn
(with-current-buffer buf
(emacs-lisp-mode)
(insert "(print \"c \\xf \\xg \\x d\")\n"))
(let* ((diags (relint-buffer buf))
(err (assoc "(error \"Invalid escape character syntax\")"
diags)))
(should (equal
(remove err diags)
'(("Character escape `\\x' not followed by hex digit"
15 nil nil nil warning)
("Character escape `\\x' not followed by hex digit"
19 nil nil nil warning)
)))))
(kill-buffer buf))))

(provide 'relint-test)
3 changes: 1 addition & 2 deletions test/13.elisp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ and \a \b \f \n \r \t \v \d \e \s \^P"))
'("bracketed \q string"))

(defun f3 ()
(print "a \7 \8 \9 b")
(print "c \xf \xg \x d"))
(print "a \7 \8 \9 b"))
2 changes: 0 additions & 2 deletions test/13.expected
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@
13.elisp:19:16: Ineffective string escape `\q'
13.elisp:22:16: Ineffective string escape `\8'
13.elisp:22:19: Ineffective string escape `\9'
13.elisp:23:17: Character escape `\x' not followed by hex digit
13.elisp:23:21: Character escape `\x' not followed by hex digit

0 comments on commit d00da3f

Please sign in to comment.