Hugo,
I am sorry if I am wrong, but I do not see you among known Org
contributors. You patch is likely greater than it is allowed for
TINYCHANGE, so before you patch can be committed, copyright assignment
should be signed, see
https://orgmode.org/worg/org-contribute.html#copyright for details.
On 18/07/2022 03:59, Hugo Heagren wrote:
From fbe030ad3a2aafd09d491aefb9c56242b7ec669b Mon Sep 17 00:00:00 2001
From: Hugo Heagren<h...@heagren.com>
Date: Sat, 16 Jul 2022 19:50:15 +0100
Subject: [PATCH] test-ol: tests for insert-description param when inserting
links
Emacs-26.3:
make test-dirty BTEST_RE=test-ol/insert-link-insert-description
selected tests: test-ol/insert-link-insert-description
Running 1 tests (2022-07-18 12:21:46+0200)
Test test-ol/insert-link-insert-description backtrace:
signal(wrong-type-argument (listp :insert-description))
apply(signal (wrong-type-argument (listp :insert-description)))
(setq value-7565 (apply fn-7563 args-7564))
(unwind-protect (setq value-7565 (apply fn-7563 args-7564)) (setq fo
(if (unwind-protect (setq value-7565 (apply fn-7563 args-7564)) (set
(let (form-description-7567) (if (unwind-protect (setq value-7565 (a
(let ((value-7565 (quote ert-form-evaluation-aborted-7566))) (let (f
(let* ((fn-7563 (function signal)) (args-7564 (condition-case err (l
(closure (t) nil (let* ((fn-7563 (function signal)) (args-7564 (cond
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name test-ol/insert-link-insert-descriptio
ert-run-or-rerun-test(#s(ert--stats :selector "test-ol/insert-link-i
ert-run-tests("test-ol/insert-link-insert-description" #f(compiled-f
ert-run-tests-batch("test-ol/insert-link-insert-description")
ert-run-tests-batch-and-exit("test-ol/insert-link-insert-description
(let ((org-id-track-globally t) (org-test-selector (if org-test-sele
org-test-run-batch-tests("test-ol/insert-link-insert-description")
eval((org-test-run-batch-tests org-test-select-re))
command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-
command-line()
normal-top-level()
Test test-ol/insert-link-insert-description condition:
(wrong-type-argument listp :insert-description)
FAILED 1/1 test-ol/insert-link-insert-description
+(ert-deftest test-ol/insert-link-insert-description ()
+ "Test `:insert-description' parameter handling."
+ ;; String case.
The cases might be improved by using different values, so when
particular `should' form fail it is easier to find it in the code
+ (should
+ (string=
+ "foobar"
+ (test-ol-with-link-parameters-as
+ "id" (:insert-description "foobar")
E.g. "foobar-string"
+ (test-ol-insert-link-get-desc "id:foo-bar"))))
+ ;; Lambda case.
+ (should
+ (string=
+ "foobar"
+ (test-ol-with-link-parameters-as
+ "id" (:insert-description (lambda (_link-test _desc) "foobar"))
+ (test-ol-insert-link-get-desc "id:foo-bar"))))
"foobar-lambda"
Further "foobar-desc-arg", etc.
+`:insert-description'
+
+ String or function used as a default when prompting users for a
+ link's description. A string is used as-is, a function is
+ called with two arguments: the full link text, and the
"link text" might be a bit ambiguous here. I would consider "link
location", "string containing link type and target", or something else.
+ description generated by `org-insert-link'. It should return
+ the description to use (this reflects the behaviour of
+ `org-link-make-description-function'). If it returns nil, no
+ default description is used, but no error is thrown (from the
+ user's perspective, this is equivalent to a default description
+ of \"\").