Subject: bug#54470: 29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion

From: Eli Zaretskii <[email-masked]>
Date: Fri, 15 Apr 2022 15:56:32 +0300

> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> Date: Fri, 1 Apr 2022 22:10:07 -0700
> 
> > @kbd is right for things that are meant specifically and only as
> > keyboard input.
> 
> Thanks for the explanation.
> 
> Having thought this over further, I think Eli's suggestion to use @samp 
> makes sense for both the globs and the predicates/modifiers, so I've 
> updated my patches to do this.

Thanks.  I was about to install these, but then I saw that some of
the tests you added fail on my system:

  Test em-pred-test/combine-predicate-and-modifier backtrace:
    signal(ert-test-failed (((should (equal (eshell-eval-predicate files
    ert-fail(((should (equal (eshell-eval-predicate files ".:e:u") '("el
    (if (unwind-protect (setq value-724 (apply fn-722 args-723)) (setq f
    (let (form-description-726) (if (unwind-protect (setq value-724 (app
    (let ((value-724 'ert-form-evaluation-aborted-725)) (let (form-descr
    (let* ((fn-722 #'equal) (args-723 (condition-case err (let ((signal-
    (let ((files '("/fake/type=-.el" "/fake/type=-.txt" "/fake/type=s.el
    (progn (fset #'file-executable-p vnew) (fset #'file-symlink-p vnew)
    (unwind-protect (progn (fset #'file-executable-p vnew) (fset #'file-
    (let* ((vnew #'(lambda (file &rest rest) (apply (if (and ... ...) #'
    (closure (t) nil (let* ((vnew #'(lambda (file &rest rest) (apply (if
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name em-pred-test/combine-predicate-and-mo
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "-l" "lisp/eshell/em-pred-tests
    command-line()
    normal-top-level()
  Test em-pred-test/combine-predicate-and-modifier condition:
      (ert-test-failed
       ((should
	 (equal
	  (eshell-eval-predicate files ".:e:u")
	  '...))
	:form
	(equal nil
	       ("el" "txt"))
	:value nil :explanation
	(different-types nil
			 ("el" "txt"))))
     FAILED   1/34  em-pred-test/combine-predicate-and-modifier (0.484375 sec) at lisp/eshell/em-pred-tests.el:513

  Test em-pred-test/predicate-file-types backtrace:
    signal(ert-test-failed (((should (equal (eshell-eval-predicate files
    ert-fail(((should (equal (eshell-eval-predicate files "%") '("/fake/
    (if (unwind-protect (setq value-20 (apply fn-18 args-19)) (setq form
    (let (form-description-22) (if (unwind-protect (setq value-20 (apply
    (let ((value-20 'ert-form-evaluation-aborted-21)) (let (form-descrip
    (let* ((fn-18 #'equal) (args-19 (condition-case err (let ((signal-ho
    (let ((files (mapcar #'(lambda (i) (format "/fake/type=%s" i)) '("b"
    (progn (fset #'file-executable-p vnew) (fset #'file-symlink-p vnew)
    (unwind-protect (progn (fset #'file-executable-p vnew) (fset #'file-
    (let* ((vnew #'(lambda (file &rest rest) (apply (if (and ... ...) #'
    (closure (t) nil (let* ((vnew #'(lambda (file &rest rest) (apply (if
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name em-pred-test/predicate-file-types :do
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "-l" "lisp/eshell/em-pred-tests
    command-line()
    normal-top-level()
  Test em-pred-test/predicate-file-types condition:
      (ert-test-failed
       ((should
	 (equal
	  (eshell-eval-predicate files "%")
	  '...))
	:form
	(equal nil
	       ("/fake/type=b" "/fake/type=c"))
	:value nil :explanation
	(different-types nil
			 ("/fake/type=b" "/fake/type=c"))))
     FAILED  29/34  em-pred-test/predicate-file-types (0.140625 sec) at lisp/eshell/em-pred-tests.el:152

  Test em-pred-test/predicate-links backtrace:
    signal(ert-test-failed (((should (equal (eshell-eval-predicate files
    ert-fail(((should (equal (eshell-eval-predicate files "l1") '("/fake
    (if (unwind-protect (setq value-214 (apply fn-212 args-213)) (setq f
    (let (form-description-216) (if (unwind-protect (setq value-214 (app
    (let ((value-214 'ert-form-evaluation-aborted-215)) (let (form-descr
    (let* ((fn-212 #'equal) (args-213 (condition-case err (let ((signal-
    (let ((files '("/fake/links=1" "/fake/links=2" "/fake/links=3"))) (l
    (progn (fset #'file-executable-p vnew) (fset #'file-symlink-p vnew)
    (unwind-protect (progn (fset #'file-executable-p vnew) (fset #'file-
    (let* ((vnew #'(lambda (file &rest rest) (apply (if (and ... ...) #'
    (closure (t) nil (let* ((vnew #'(lambda (file &rest rest) (apply (if
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name em-pred-test/predicate-links :documen
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "-l" "lisp/eshell/em-pred-tests
    command-line()
    normal-top-level()
  Test em-pred-test/predicate-links condition:
      (ert-test-failed
       ((should
	 (equal
	  (eshell-eval-predicate files "l1")
	  '...))
	:form
	(equal nil
	       ("/fake/links=1"))
	:value nil :explanation
	(different-types nil
			 ("/fake/links=1"))))
     FAILED  31/34  em-pred-test/predicate-links (0.000000 sec) at lisp/eshell/em-pred-tests.el:228

  Test em-pred-test/predicate-size backtrace:
    signal(ert-test-failed (((should (equal (eshell-eval-predicate files
    ert-fail(((should (equal (eshell-eval-predicate files "L2048") '("/f
    (if (unwind-protect (setq value-379 (apply fn-377 args-378)) (setq f
    (let (form-description-381) (if (unwind-protect (setq value-379 (app
    (let ((value-379 'ert-form-evaluation-aborted-380)) (let (form-descr
    (let* ((fn-377 #'equal) (args-378 (condition-case err (let ((signal-
    (let ((files '("/fake/size=0" "/fake/size=1024" "/fake/size=2048" "/
    (progn (fset #'file-executable-p vnew) (fset #'file-symlink-p vnew)
    (unwind-protect (progn (fset #'file-executable-p vnew) (fset #'file-
    (let* ((vnew #'(lambda (file &rest rest) (apply (if (and ... ...) #'
    (closure (t) nil (let* ((vnew #'(lambda (file &rest rest) (apply (if
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name em-pred-test/predicate-size :document
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "-l" "lisp/eshell/em-pred-tests
    command-line()
    normal-top-level()
  Test em-pred-test/predicate-size condition:
      (ert-test-failed
       ((should
	 (equal
	  (eshell-eval-predicate files "L2048")
	  '...))
	:form
	(equal nil
	       ("/fake/size=2048"))
	:value nil :explanation
	(different-types nil
			 ("/fake/size=2048"))))
     FAILED  33/34  em-pred-test/predicate-size (0.156250 sec) at lisp/eshell/em-pred-tests.el:321

Can you fix these failures and resubmit?  If they are due to some
MS-Windows specific issues, please tell how can I help you with
diagnosing the problem.

Thanks.