(should (eq (string-to-char (symbol-name (gensym))) ?g))
(should (eq (string-to-char (symbol-name (gensym "X"))) ?X)))
+(ert-deftest subr-tests--assq-delete-all ()
+ "Test `assq-delete-all' behavior."
+ (cl-flet ((new-list-fn
+ ()
+ (list (cons 'a 1) (cons 'b 2) (cons 'c 3) 'd (cons "foo" "bar"))))
+ (should (equal (cdr (new-list-fn)) (assq-delete-all 'a (new-list-fn))))
+ (should (equal (new-list-fn) (assq-delete-all 'd (new-list-fn))))
+ (should (equal (new-list-fn) (assq-delete-all "foo" (new-list-fn))))))
+
+(ert-deftest subr-tests--assoc-delete-all ()
+ "Test `assoc-delete-all' behavior."
+ (cl-flet ((new-list-fn
+ ()
+ (list (cons 'a 1) (cons 'b 2) (cons 'c 3) 'd (cons "foo" "bar"))))
+ (should (equal (cdr (new-list-fn)) (assoc-delete-all 'a (new-list-fn))))
+ (should (equal (new-list-fn) (assoc-delete-all 'd (new-list-fn))))
+ (should (equal (butlast (new-list-fn))
+ (assoc-delete-all "foo" (new-list-fn))))))
+
+ (ert-deftest shell-quote-argument-%-on-w32 ()
+ "Quoting of `%' in w32 shells isn't perfect.
+ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350."
+ :expected-result :failed
+ (skip-unless (and (fboundp 'w32-shell-dos-semantics)
+ (w32-shell-dos-semantics)))
+ (let ((process-environment (append '("ca^=with-caret"
+ "ca=without-caret")
+ process-environment)))
+ ;; It actually results in
+ ;; without-caret with-caret
+ (should (equal (shell-command-to-string
+ (format "echo %s %s"
+ "%ca%"
+ (shell-quote-argument "%ca%")))
+ "without-caret %ca%"))))
+
(provide 'subr-tests)
;;; subr-tests.el ends here