Skip to content

Some brittleness in tests #246

@phst

Description

@phst

For example on Ubuntu 12.04:

$ LC_ALL=C make test SELECTOR='(rx bos "test-markdown-font-lock/hidden-urls-")'
emacs -Q --batch  \
	    --eval '(setq byte-compile-warnings (quote (not cl-functions)))' \
	    --eval '(setq byte-compile-error-on-warn t)' \
	    -l ../markdown-mode.el \
	    -f batch-byte-compile ../markdown-mode.el markdown-test.el
emacs -Q --batch  -l checkdoc-batch.el 2>&1 | \
	    grep -E "markdown-mode.el:[1-9]+" && exit 1 || exit 0
emacs -Q --batch  \
	    --eval '(setq byte-compile-warnings (quote (not cl-functions)))' \
	    -l ert -l ../markdown-mode.elc -l markdown-test.elc \
	    --eval '(ert-run-tests-batch-and-exit (rx bos "test-markdown-font-lock/hidden-urls-"))'
Running 2 tests (2017-08-31 21:21:06+0200)
Test test-markdown-font-lock/hidden-urls-inline backtrace:
  #[nil "\306�	\307P�\310 311\216\312\313!�r\fq\210\314\216\315\n!\2
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test test-markdown-font-lock/hidden-urls
  ert-run-or-rerun-test([cl-struct-ert--stats "\\`test-markdown-font-l
  ert-run-tests("\\`test-markdown-font-lock/hidden-urls-" #[385 "\306�
  ert-run-tests-batch("\\`test-markdown-font-lock/hidden-urls-")
  ert-run-tests-batch-and-exit("\\`test-markdown-font-lock/hidden-urls
  eval((ert-run-tests-batch-and-exit (rx bos "test-markdown-font-lock/
  command-line-1(("--eval" "(setq byte-compile-warnings (quote (not cl
  command-line()
  normal-top-level()
Test test-markdown-font-lock/hidden-urls-inline condition:
    (ert-test-failed
     ((should
       (equal '...
	(get-text-property 932 ...)))
      :form
      (equal
       ((26 . 8734))
       ((26 . 35)))
      :value nil :explanation
      (list-elt 0
		(cdr
		 (different-atoms ... ...)))))
   FAILED  1/2  test-markdown-font-lock/hidden-urls-inline
Test test-markdown-font-lock/hidden-urls-reference backtrace:
  #[nil "\306�\307 �\310\216\311\312!�r\nq\210\313\216\314	p\306#\210\
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test test-markdown-font-lock/hidden-urls
  ert-run-or-rerun-test([cl-struct-ert--stats "\\`test-markdown-font-l
  ert-run-tests("\\`test-markdown-font-lock/hidden-urls-" #[385 "\306�
  ert-run-tests-batch("\\`test-markdown-font-lock/hidden-urls-")
  ert-run-tests-batch-and-exit("\\`test-markdown-font-lock/hidden-urls
  eval((ert-run-tests-batch-and-exit (rx bos "test-markdown-font-lock/
  command-line-1(("--eval" "(setq byte-compile-warnings (quote (not cl
  command-line()
  normal-top-level()
Test test-markdown-font-lock/hidden-urls-reference condition:
    (ert-test-failed
     ((should
       (equal '...
        (get-text-property 8 ...)))
      :form
      (equal
       ((20 . 8734))
       ((20 . 35)))
      :value nil :explanation
      (list-elt 0
                (cdr
                 (different-atoms ... ...)))))
   FAILED  2/2  test-markdown-font-lock/hidden-urls-reference

Ran 2 tests, 0 results as expected, 2 unexpected (2017-08-31 21:21:06+0200)

2 unexpected results:
   FAILED  test-markdown-font-lock/hidden-urls-inline
   FAILED  test-markdown-font-lock/hidden-urls-reference

make: *** [test] Error 1

This is because with LC_ALL=C Emacs falls back to # for the URL compose character. Given

But the value of the property itself is completely internal to Emacs and should not be manipulated directly by, for instance, put-text-property.

(https://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html for the composition property), maybe the tests should only check whether the property is nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions