diff options
| author | Andrea Corallo | 2021-01-24 21:05:33 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2021-01-24 21:05:33 +0100 |
| commit | b8d3ae78c54db7c7bb65d367a80f9be3d8744c48 (patch) | |
| tree | 982f190d1dd79685c43a9829dd66e6a7cbbd0c67 /test | |
| parent | 0ffb3dfaa483b0c5cf1f7f367efcb5e9c041ab53 (diff) | |
| parent | e5aaa1251cfb9d6d18682a5eda137a2e12ca4213 (diff) | |
| download | emacs-b8d3ae78c54db7c7bb65d367a80f9be3d8744c48.tar.gz emacs-b8d3ae78c54db7c7bb65d367a80f9be3d8744c48.zip | |
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile.in | 20 | ||||
| -rw-r--r-- | test/README | 13 | ||||
| -rw-r--r-- | test/file-organization.org | 16 | ||||
| -rw-r--r-- | test/infra/Dockerfile.emba | 2 | ||||
| -rw-r--r-- | test/infra/gitlab-ci.yml | 245 | ||||
| -rw-r--r-- | test/lisp/autorevert-tests.el | 25 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el | 6 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el | 17 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 8 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cl-lib-tests.el | 9 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/pcase-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/seq-tests.el | 23 | ||||
| -rw-r--r-- | test/lisp/faces-tests.el | 8 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 70 | ||||
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 65 | ||||
| -rw-r--r-- | test/lisp/replace-tests.el | 13 | ||||
| -rw-r--r-- | test/lisp/thingatpt-tests.el | 44 | ||||
| -rw-r--r-- | test/lisp/time-stamp-tests.el | 127 | ||||
| -rw-r--r-- | test/lisp/wid-edit-tests.el | 11 | ||||
| -rw-r--r-- | test/src/process-tests.el | 150 | ||||
| -rw-r--r-- | test/src/xdisp-tests.el | 33 |
21 files changed, 749 insertions, 160 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 849fbbf474e..bfab95b9381 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -253,11 +253,17 @@ endef | |||
| 253 | 253 | ||
| 254 | $(foreach test,${TESTS},$(eval $(call test_template,${test}))) | 254 | $(foreach test,${TESTS},$(eval $(call test_template,${test}))) |
| 255 | 255 | ||
| 256 | # Get the tests for only a specific directory | 256 | ## Get the tests for only a specific directory. |
| 257 | NET_TESTS := $(patsubst %.el,%,$(wildcard lisp/net/*.el)) | 257 | SUBDIRS = $(sort $(shell find lib-src lisp src -type d ! -path "*resources*" -print)) |
| 258 | LISP_TESTS := $(patsubst %.el,%,$(wildcard lisp/*.el)) | 258 | |
| 259 | check-net: ${NET_TESTS} | 259 | define subdir_template |
| 260 | check-lisp: ${LISP_TESTS} | 260 | .PHONY: check-$(subst /,-,$(1)) |
| 261 | check-$(subst /,-,$(1)): | ||
| 262 | @${MAKE} check LOGFILES="$(patsubst %.el,%.log, \ | ||
| 263 | $(patsubst $(srcdir)/%,%,$(wildcard $(1)/*.el)))" | ||
| 264 | endef | ||
| 265 | |||
| 266 | $(foreach subdir, $(SUBDIRS), $(eval $(call subdir_template,$(subdir)))) | ||
| 261 | 267 | ||
| 262 | ifeq (@HAVE_MODULES@, yes) | 268 | ifeq (@HAVE_MODULES@, yes) |
| 263 | # -fPIC is a no-op on Windows, but causes a compiler warning | 269 | # -fPIC is a no-op on Windows, but causes a compiler warning |
| @@ -325,10 +331,10 @@ check-doit: | |||
| 325 | ifeq ($(TEST_INTERACTIVE), yes) | 331 | ifeq ($(TEST_INTERACTIVE), yes) |
| 326 | HOME=$(TEST_HOME) $(emacs) \ | 332 | HOME=$(TEST_HOME) $(emacs) \ |
| 327 | -l ert ${ert_opts} \ | 333 | -l ert ${ert_opts} \ |
| 328 | $(patsubst %,-l %,$(if $(findstring $(TEST_LOAD_EL),yes),$ELFILES,$(ELFILES:.el=))) \ | 334 | $(patsubst %,-l %,$(if $(findstring $(TEST_LOAD_EL),yes),$ELFILES,$(ELFILES:.el=))) \ |
| 329 | $(TEST_RUN_ERT) | 335 | $(TEST_RUN_ERT) |
| 330 | else | 336 | else |
| 331 | -@${MAKE} -k ${LOGFILES} | 337 | -@${MAKE} -k ${LOGFILES} |
| 332 | @$(emacs) --batch -l ert --eval \ | 338 | @$(emacs) --batch -l ert --eval \ |
| 333 | "(ert-summarize-tests-batch-and-exit ${SUMMARIZE_TESTS})" ${LOGFILES} | 339 | "(ert-summarize-tests-batch-and-exit ${SUMMARIZE_TESTS})" ${LOGFILES} |
| 334 | endif | 340 | endif |
diff --git a/test/README b/test/README index 38f4a109701..5f3c10adbe1 100644 --- a/test/README +++ b/test/README | |||
| @@ -39,11 +39,10 @@ The Makefile in this directory supports the following targets: | |||
| 39 | * make check-all | 39 | * make check-all |
| 40 | Like "make check", but run all tests. | 40 | Like "make check", but run all tests. |
| 41 | 41 | ||
| 42 | * make check-lisp | 42 | * make check-<dirname> |
| 43 | Like "make check", but run only the tests in test/lisp/*.el | 43 | Like "make check", but run only the tests in test/<dirname>/*.el. |
| 44 | 44 | <dirname> is a relative directory path, which has replaced "/" by "-", | |
| 45 | * make check-net | 45 | like in "check-src" or "check-lisp-net". |
| 46 | Like "make check", but run only the tests in test/lisp/net/*.el | ||
| 47 | 46 | ||
| 48 | * make <filename> -or- make <filename>.log | 47 | * make <filename> -or- make <filename>.log |
| 49 | Run all tests declared in <filename>.el. This includes expensive | 48 | Run all tests declared in <filename>.el. This includes expensive |
| @@ -61,7 +60,9 @@ https://www.gnu.org/software/emacs/manual/html_node/ert/Test-Selectors.html | |||
| 61 | 60 | ||
| 62 | You could use predefined selectors of the Makefile. "make <filename> | 61 | You could use predefined selectors of the Makefile. "make <filename> |
| 63 | SELECTOR='$(SELECTOR_DEFAULT)'" runs all tests for <filename>.el | 62 | SELECTOR='$(SELECTOR_DEFAULT)'" runs all tests for <filename>.el |
| 64 | except the tests tagged as expensive or unstable. | 63 | except the tests tagged as expensive or unstable. Other predefined |
| 64 | selectors are $(SELECTOR_EXPENSIVE) (run all tests except unstable | ||
| 65 | ones) and $(SELECTOR_ALL) (run all tests). | ||
| 65 | 66 | ||
| 66 | If your test file contains the tests "test-foo", "test2-foo" and | 67 | If your test file contains the tests "test-foo", "test2-foo" and |
| 67 | "test-foo-remote", and you want to run only the former two tests, you | 68 | "test-foo-remote", and you want to run only the former two tests, you |
diff --git a/test/file-organization.org b/test/file-organization.org index efc354529c5..7cf5b88d6d0 100644 --- a/test/file-organization.org +++ b/test/file-organization.org | |||
| @@ -17,13 +17,15 @@ Sub-directories are in many cases themed after packages (~gnus~, ~org~, | |||
| 17 | ~calc~), related functionality (~net~, ~emacs-lisp~, ~progmodes~) or status | 17 | ~calc~), related functionality (~net~, ~emacs-lisp~, ~progmodes~) or status |
| 18 | (~obsolete~). | 18 | (~obsolete~). |
| 19 | 19 | ||
| 20 | C source is stored in the ~src~ directory, which is flat. | 20 | C source is stored in the ~src~ directory, which is flat. Source for |
| 21 | utility programs is stored in the ~lib-src~ directory. | ||
| 21 | 22 | ||
| 22 | ** Test Files | 23 | ** Test Files |
| 23 | 24 | ||
| 24 | Automated tests should be stored in the ~test/lisp~ directory for | 25 | Automated tests should be stored in the ~test/lisp~ directory for |
| 25 | tests of functionality implemented in Lisp, and in the ~test/src~ | 26 | tests of functionality implemented in Lisp, in the ~test/src~ |
| 26 | directory for functionality implemented in C. Tests should reflect | 27 | directory for functionality implemented in C, and in the |
| 28 | ~test/lib-src~ directory for utility programs. Tests should reflect | ||
| 27 | the directory structure of the source tree; so tests for files in the | 29 | the directory structure of the source tree; so tests for files in the |
| 28 | ~lisp/emacs-lisp~ source directory should reside in the | 30 | ~lisp/emacs-lisp~ source directory should reside in the |
| 29 | ~test/lisp/emacs-lisp~ directory. | 31 | ~test/lisp/emacs-lisp~ directory. |
| @@ -36,10 +38,10 @@ files of any name which are themselves placed in a directory named | |||
| 36 | after the feature with ~-tests~ appended, such as | 38 | after the feature with ~-tests~ appended, such as |
| 37 | ~/test/lisp/emacs-lisp/eieio-tests~ | 39 | ~/test/lisp/emacs-lisp/eieio-tests~ |
| 38 | 40 | ||
| 39 | Similarly, features implemented in C should reside in ~/test/src~ and | 41 | Similarly, tests of features implemented in C should reside in |
| 40 | be named after the C file with ~-tests.el~ added to the base-name of | 42 | ~/test/src~ or in ~test/lib-src~ and be named after the C file with |
| 41 | the tested source file. Thus, tests for ~src/fileio.c~ should be in | 43 | ~-tests.el~ added to the base-name of the tested source file. Thus, |
| 42 | ~test/src/fileio-tests.el~. | 44 | tests for ~src/fileio.c~ should be in ~test/src/fileio-tests.el~. |
| 43 | 45 | ||
| 44 | There are also some test materials that cannot be run automatically | 46 | There are also some test materials that cannot be run automatically |
| 45 | (i.e. via ert). These should be placed in ~/test/manual~; they are | 47 | (i.e. via ert). These should be placed in ~/test/manual~; they are |
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index dd41982ad59..421264db9c9 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba | |||
| @@ -41,7 +41,7 @@ COPY . /checkout | |||
| 41 | WORKDIR /checkout | 41 | WORKDIR /checkout |
| 42 | RUN ./autogen.sh autoconf | 42 | RUN ./autogen.sh autoconf |
| 43 | RUN ./configure --without-makeinfo | 43 | RUN ./configure --without-makeinfo |
| 44 | RUN make bootstrap | 44 | RUN make -j4 bootstrap |
| 45 | RUN make -j4 | 45 | RUN make -j4 |
| 46 | 46 | ||
| 47 | FROM emacs-base as emacs-filenotify-gio | 47 | FROM emacs-base as emacs-filenotify-gio |
diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml new file mode 100644 index 00000000000..5a0ab54e4b9 --- /dev/null +++ b/test/infra/gitlab-ci.yml | |||
| @@ -0,0 +1,245 @@ | |||
| 1 | # Copyright (C) 2017-2021 Free Software Foundation, Inc. | ||
| 2 | # | ||
| 3 | # This file is part of GNU Emacs. | ||
| 4 | # | ||
| 5 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation, either version 3 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 17 | |||
| 18 | # GNU Emacs support for the GitLab protocol for CI | ||
| 19 | |||
| 20 | # The presence of this file does not imply any FSF/GNU endorsement of | ||
| 21 | # any particular service that uses that protocol. Also, it is intended for | ||
| 22 | # evaluation purposes, thus possibly temporary. | ||
| 23 | |||
| 24 | # Maintainer: Ted Zlatanov <tzz@lifelogs.com> | ||
| 25 | # URL: https://emba.gnu.org/emacs/emacs | ||
| 26 | |||
| 27 | # Never run merge request pipelines, they usually duplicate push pipelines | ||
| 28 | # see https://docs.gitlab.com/ee/ci/yaml/README.html#common-if-clauses-for-rules | ||
| 29 | |||
| 30 | # Rules: always run tags and branches named master*, emacs*, feature*, fix* | ||
| 31 | # Test that it triggers by pushing a tag: `git tag mytag; git push origin mytag` | ||
| 32 | # Test that it triggers by pushing to: feature/emba, feature1, master, master-2, fix/emba, emacs-299, fix-2 | ||
| 33 | # Test that it doesn't trigger by pushing to: scratch-2, scratch/emba, oldbranch, dev | ||
| 34 | workflow: | ||
| 35 | rules: | ||
| 36 | - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' | ||
| 37 | when: never | ||
| 38 | - if: '$CI_COMMIT_TAG' | ||
| 39 | when: always | ||
| 40 | - if: '$CI_COMMIT_BRANCH !~ /^(master|emacs|feature|fix)/' | ||
| 41 | when: never | ||
| 42 | - when: always | ||
| 43 | |||
| 44 | variables: | ||
| 45 | GIT_STRATEGY: fetch | ||
| 46 | EMACS_EMBA_CI: 1 | ||
| 47 | # # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled | ||
| 48 | # DOCKER_HOST: tcp://docker:2376 | ||
| 49 | # DOCKER_TLS_CERTDIR: "/certs" | ||
| 50 | # Put the configuration for each run in a separate directory to avoid conflicts | ||
| 51 | DOCKER_CONFIG: "/.docker-config-${CI_COMMIT_SHA}" | ||
| 52 | # We don't use ${CI_COMMIT_SHA} to be able to do one bootstrap across multiple builds | ||
| 53 | BUILD_TAG: ${CI_COMMIT_REF_SLUG} | ||
| 54 | |||
| 55 | default: | ||
| 56 | image: docker:19.03.12 | ||
| 57 | timeout: 3 hours | ||
| 58 | before_script: | ||
| 59 | - docker info | ||
| 60 | - echo "docker registry is ${CI_REGISTRY}" | ||
| 61 | - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} | ||
| 62 | |||
| 63 | .job-template: | ||
| 64 | rules: | ||
| 65 | - changes: | ||
| 66 | - "**/Makefile.in" | ||
| 67 | - .gitlab-ci.yml | ||
| 68 | - aclocal.m4 | ||
| 69 | - autogen.sh | ||
| 70 | - configure.ac | ||
| 71 | - lib/*.{h,c} | ||
| 72 | - lisp/**/*.el | ||
| 73 | - src/*.{h,c} | ||
| 74 | - test/infra/* | ||
| 75 | - test/lib-src/*.el | ||
| 76 | - test/lisp/**/*.el | ||
| 77 | - test/src/*.el | ||
| 78 | - changes: | ||
| 79 | # gfilemonitor, kqueue | ||
| 80 | - src/gfilenotify.c | ||
| 81 | - src/kqueue.c | ||
| 82 | # MS Windows | ||
| 83 | - "**/w32*" | ||
| 84 | # GNUstep | ||
| 85 | - lisp/term/ns-win.el | ||
| 86 | - src/ns*.{h,m} | ||
| 87 | - src/macfont.{h,m} | ||
| 88 | when: never | ||
| 89 | # these will be cached across builds | ||
| 90 | cache: | ||
| 91 | key: ${CI_COMMIT_SHA} | ||
| 92 | paths: [] | ||
| 93 | policy: pull-push | ||
| 94 | # these will be saved for followup builds | ||
| 95 | artifacts: | ||
| 96 | expire_in: 24 hrs | ||
| 97 | paths: [] | ||
| 98 | # - "test/**/*.log" | ||
| 99 | # - "**/*.log" | ||
| 100 | # using the variables for each job | ||
| 101 | script: | ||
| 102 | - docker pull ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} | ||
| 103 | # TODO: with make -j4 several of the tests were failing, for example shadowfile-tests, but passed without it | ||
| 104 | - 'export PWD=$(pwd)' | ||
| 105 | - 'docker run -i --rm -e EMACS_EMBA_CI=${EMACS_EMBA_CI} --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j4 && make ${make_params}"' | ||
| 106 | |||
| 107 | .build-template: | ||
| 108 | rules: | ||
| 109 | - if: '$CI_PIPELINE_SOURCE == "web"' | ||
| 110 | when: always | ||
| 111 | - changes: | ||
| 112 | - "**/Makefile.in" | ||
| 113 | - .gitlab-ci.yml | ||
| 114 | - aclocal.m4 | ||
| 115 | - autogen.sh | ||
| 116 | - configure.ac | ||
| 117 | - lib/*.{h,c} | ||
| 118 | - lisp/emacs-lisp/*.el | ||
| 119 | - src/*.{h,c} | ||
| 120 | - test/infra/* | ||
| 121 | - changes: | ||
| 122 | # gfilemonitor, kqueue | ||
| 123 | - src/gfilenotify.c | ||
| 124 | - src/kqueue.c | ||
| 125 | # MS Windows | ||
| 126 | - "**/w32*" | ||
| 127 | # GNUstep | ||
| 128 | - lisp/term/ns-win.el | ||
| 129 | - src/ns*.{h,m} | ||
| 130 | - src/macfont.{h,m} | ||
| 131 | when: never | ||
| 132 | script: | ||
| 133 | - docker build --pull --target ${target} -t ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} -f test/infra/Dockerfile.emba . | ||
| 134 | - docker push ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} | ||
| 135 | |||
| 136 | .gnustep-template: | ||
| 137 | rules: | ||
| 138 | - if: '$CI_PIPELINE_SOURCE == "web"' | ||
| 139 | - if: '$CI_PIPELINE_SOURCE == "schedule"' | ||
| 140 | changes: | ||
| 141 | - "**/Makefile.in" | ||
| 142 | - .gitlab-ci.yml | ||
| 143 | - configure.ac | ||
| 144 | - src/ns*.{h,m} | ||
| 145 | - src/macfont.{h,m} | ||
| 146 | - lisp/term/ns-win.el | ||
| 147 | - nextstep/**/* | ||
| 148 | - test/infra/* | ||
| 149 | |||
| 150 | .filenotify-gio-template: | ||
| 151 | rules: | ||
| 152 | - if: '$CI_PIPELINE_SOURCE == "web"' | ||
| 153 | - if: '$CI_PIPELINE_SOURCE == "schedule"' | ||
| 154 | changes: | ||
| 155 | - "**/Makefile.in" | ||
| 156 | - .gitlab-ci.yml | ||
| 157 | - lisp/autorevert.el | ||
| 158 | - lisp/filenotify.el | ||
| 159 | - lisp/net/tramp-sh.el | ||
| 160 | - src/gfilenotify.c | ||
| 161 | - test/infra/* | ||
| 162 | - test/lisp/autorevert-tests.el | ||
| 163 | - test/lisp/filenotify-tests.el | ||
| 164 | |||
| 165 | stages: | ||
| 166 | - prep-images | ||
| 167 | - build-images | ||
| 168 | - fast | ||
| 169 | - normal | ||
| 170 | - platform-images | ||
| 171 | - platforms | ||
| 172 | - slow | ||
| 173 | |||
| 174 | prep-image-base: | ||
| 175 | stage: prep-images | ||
| 176 | extends: [.job-template, .build-template] | ||
| 177 | variables: | ||
| 178 | target: emacs-base | ||
| 179 | |||
| 180 | build-image-inotify: | ||
| 181 | stage: build-images | ||
| 182 | extends: [.job-template, .build-template] | ||
| 183 | variables: | ||
| 184 | target: emacs-inotify | ||
| 185 | |||
| 186 | test-fast-inotify: | ||
| 187 | stage: fast | ||
| 188 | extends: [.job-template] | ||
| 189 | variables: | ||
| 190 | target: emacs-inotify | ||
| 191 | make_params: "-C test check" | ||
| 192 | |||
| 193 | build-image-filenotify-gio: | ||
| 194 | stage: platform-images | ||
| 195 | extends: [.job-template, .build-template, .filenotify-gio-template] | ||
| 196 | variables: | ||
| 197 | target: emacs-filenotify-gio | ||
| 198 | |||
| 199 | build-image-gnustep: | ||
| 200 | stage: platform-images | ||
| 201 | extends: [.job-template, .build-template, .gnustep-template] | ||
| 202 | variables: | ||
| 203 | target: emacs-gnustep | ||
| 204 | |||
| 205 | test-lisp-inotify: | ||
| 206 | stage: normal | ||
| 207 | extends: [.job-template] | ||
| 208 | variables: | ||
| 209 | target: emacs-inotify | ||
| 210 | make_params: "-C test check-lisp" | ||
| 211 | |||
| 212 | test-lisp-net-inotify: | ||
| 213 | stage: normal | ||
| 214 | extends: [.job-template] | ||
| 215 | variables: | ||
| 216 | target: emacs-inotify | ||
| 217 | make_params: "-C test check-lisp-net" | ||
| 218 | |||
| 219 | test-filenotify-gio: | ||
| 220 | # This tests file monitor libraries gfilemonitor and gio. | ||
| 221 | stage: platforms | ||
| 222 | extends: [.job-template, .filenotify-gio-template] | ||
| 223 | variables: | ||
| 224 | target: emacs-filenotify-gio | ||
| 225 | make_params: "-k -C test autorevert-tests filenotify-tests" | ||
| 226 | |||
| 227 | test-gnustep: | ||
| 228 | # This tests the GNUstep build process | ||
| 229 | stage: platforms | ||
| 230 | extends: [.job-template, .gnustep-template] | ||
| 231 | variables: | ||
| 232 | target: emacs-gnustep | ||
| 233 | make_params: install | ||
| 234 | |||
| 235 | test-all-inotify: | ||
| 236 | # This tests also file monitor libraries inotify and inotifywatch. | ||
| 237 | stage: slow | ||
| 238 | extends: [.job-template] | ||
| 239 | rules: | ||
| 240 | # note there's no "changes" section, so this always runs on a schedule | ||
| 241 | - if: '$CI_PIPELINE_SOURCE == "web"' | ||
| 242 | - if: '$CI_PIPELINE_SOURCE == "schedule"' | ||
| 243 | variables: | ||
| 244 | target: emacs-inotify | ||
| 245 | make_params: check-expensive | ||
diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 6da515bb2c8..45cf6353960 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el | |||
| @@ -524,8 +524,10 @@ This expects `auto-revert--messages' to be bound by | |||
| 524 | (auto-revert-test--write-file "1-b" file-1) | 524 | (auto-revert-test--write-file "1-b" file-1) |
| 525 | (auto-revert-test--wait-for-buffer-text | 525 | (auto-revert-test--wait-for-buffer-text |
| 526 | buf-1 "1-b" (auto-revert--timeout)) | 526 | buf-1 "1-b" (auto-revert--timeout)) |
| 527 | (should (buffer-local-value | 527 | ;; On emba, `buf-1' is a killed buffer. |
| 528 | 'auto-revert-notify-watch-descriptor buf-1)) | 528 | (when (buffer-live-p buf-1) |
| 529 | (should (buffer-local-value | ||
| 530 | 'auto-revert-notify-watch-descriptor buf-1))) | ||
| 529 | 531 | ||
| 530 | ;; Write a buffer to a new file, then modify the new file on disk. | 532 | ;; Write a buffer to a new file, then modify the new file on disk. |
| 531 | (with-current-buffer buf-2 | 533 | (with-current-buffer buf-2 |
| @@ -607,11 +609,12 @@ This expects `auto-revert--messages' to be bound by | |||
| 607 | (should auto-revert-mode)) | 609 | (should auto-revert-mode)) |
| 608 | 610 | ||
| 609 | (dotimes (i num-buffers) | 611 | (dotimes (i num-buffers) |
| 610 | (add-to-list | 612 | (push (make-indirect-buffer |
| 611 | 'buffers | 613 | (car buffers) |
| 612 | (make-indirect-buffer | 614 | (format "%s-%d" (buffer-file-name (car buffers)) i) |
| 613 | (car buffers) (format "%s-%d" (buffer-file-name (car buffers)) i) 'clone) | 615 | 'clone) |
| 614 | 'append)) | 616 | buffers)) |
| 617 | (setq buffers (nreverse buffers)) | ||
| 615 | (dolist (buf buffers) | 618 | (dolist (buf buffers) |
| 616 | (with-current-buffer buf | 619 | (with-current-buffer buf |
| 617 | (should (string-equal (buffer-string) "any text")) | 620 | (should (string-equal (buffer-string) "any text")) |
| @@ -638,10 +641,10 @@ This expects `auto-revert--messages' to be bound by | |||
| 638 | (auto-revert-tests--write-file "any text" tmpfile (pop times)) | 641 | (auto-revert-tests--write-file "any text" tmpfile (pop times)) |
| 639 | 642 | ||
| 640 | (dotimes (i num-buffers) | 643 | (dotimes (i num-buffers) |
| 641 | (add-to-list | 644 | (push (generate-new-buffer |
| 642 | 'buffers | 645 | (format "%s-%d" (file-name-nondirectory tmpfile) i)) |
| 643 | (generate-new-buffer (format "%s-%d" (file-name-nondirectory tmpfile) i)) | 646 | buffers)) |
| 644 | 'append)) | 647 | (setq buffers (nreverse buffers)) |
| 645 | (dolist (buf buffers) | 648 | (dolist (buf buffers) |
| 646 | (with-current-buffer buf | 649 | (with-current-buffer buf |
| 647 | (insert-file-contents tmpfile 'visit) | 650 | (insert-file-contents tmpfile 'visit) |
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el b/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el new file mode 100644 index 00000000000..47481574ea8 --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | ;; -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | (defsubst foo-inlineable (foo-var) | ||
| 4 | (+ foo-var 2)) | ||
| 5 | |||
| 6 | (provide 'foo-inlinable) | ||
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el b/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el new file mode 100644 index 00000000000..5582b2ab0ea --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | ;; -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; In this test, we try and make sure that inlined functions's code isn't | ||
| 4 | ;; mistakenly re-interpreted in the caller's context: we import an | ||
| 5 | ;; inlinable function from another file where `foo-var' is a normal | ||
| 6 | ;; lexical variable, and then call(inline) it in a function where | ||
| 7 | ;; `foo-var' is a dynamically-scoped variable. | ||
| 8 | |||
| 9 | (require 'foo-inlinable | ||
| 10 | (expand-file-name "foo-inlinable.el" | ||
| 11 | (file-name-directory | ||
| 12 | (or byte-compile-current-file load-file-name)))) | ||
| 13 | |||
| 14 | (defvar foo-var) | ||
| 15 | |||
| 16 | (defun foo-fun () | ||
| 17 | (+ (foo-inlineable 5) 1)) | ||
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index a07af188fac..980b402ca2d 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -617,13 +617,13 @@ Subtests signal errors if something goes wrong." | |||
| 617 | (make-obsolete-variable 'bytecomp--tests-obsolete-var nil "99.99") | 617 | (make-obsolete-variable 'bytecomp--tests-obsolete-var nil "99.99") |
| 618 | 618 | ||
| 619 | (bytecomp--define-warning-file-test "warn-obsolete-hook.el" | 619 | (bytecomp--define-warning-file-test "warn-obsolete-hook.el" |
| 620 | "bytecomp--tests-obs.*obsolete.*99.99") | 620 | "bytecomp--tests-obs.*obsolete[^z-a]*99.99") |
| 621 | 621 | ||
| 622 | (bytecomp--define-warning-file-test "warn-obsolete-variable-same-file.el" | 622 | (bytecomp--define-warning-file-test "warn-obsolete-variable-same-file.el" |
| 623 | "foo-obs.*obsolete.*99.99" t) | 623 | "foo-obs.*obsolete.*99.99" t) |
| 624 | 624 | ||
| 625 | (bytecomp--define-warning-file-test "warn-obsolete-variable.el" | 625 | (bytecomp--define-warning-file-test "warn-obsolete-variable.el" |
| 626 | "bytecomp--tests-obs.*obsolete.*99.99") | 626 | "bytecomp--tests-obs.*obsolete[^z-a]*99.99") |
| 627 | 627 | ||
| 628 | (bytecomp--define-warning-file-test "warn-obsolete-variable-bound.el" | 628 | (bytecomp--define-warning-file-test "warn-obsolete-variable-bound.el" |
| 629 | "bytecomp--tests-obs.*obsolete.*99.99" t) | 629 | "bytecomp--tests-obs.*obsolete.*99.99" t) |
| @@ -713,6 +713,10 @@ Subtests signal errors if something goes wrong." | |||
| 713 | "warn-wide-docstring-multiline.el" | 713 | "warn-wide-docstring-multiline.el" |
| 714 | "defvar.*foo.*wider than.*characters") | 714 | "defvar.*foo.*wider than.*characters") |
| 715 | 715 | ||
| 716 | (bytecomp--define-warning-file-test | ||
| 717 | "nowarn-inline-after-defvar.el" | ||
| 718 | "Lexical argument shadows" 'reverse) | ||
| 719 | |||
| 716 | 720 | ||
| 717 | ;;;; Macro expansion. | 721 | ;;;; Macro expansion. |
| 718 | 722 | ||
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 97a44c43ef7..065ca4fa651 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el | |||
| @@ -543,15 +543,7 @@ | |||
| 543 | (apply (lambda (x) (+ x 1)) (list 8))))) | 543 | (apply (lambda (x) (+ x 1)) (list 8))))) |
| 544 | '(5 (6 5) (6 6) 9)))) | 544 | '(5 (6 5) (6 6) 9)))) |
| 545 | 545 | ||
| 546 | (defun cl-lib-tests--dummy-function () | ||
| 547 | ;; Dummy function to see if the file is compiled. | ||
| 548 | t) | ||
| 549 | |||
| 550 | (ert-deftest cl-lib-defstruct-record () | 546 | (ert-deftest cl-lib-defstruct-record () |
| 551 | ;; This test fails when compiled, see Bug#24402/27718. | ||
| 552 | :expected-result (if (byte-code-function-p | ||
| 553 | (symbol-function 'cl-lib-tests--dummy-function)) | ||
| 554 | :failed :passed) | ||
| 555 | (cl-defstruct foo x) | 547 | (cl-defstruct foo x) |
| 556 | (let ((x (make-foo :x 42))) | 548 | (let ((x (make-foo :x 42))) |
| 557 | (should (recordp x)) | 549 | (should (recordp x)) |
| @@ -566,6 +558,7 @@ | |||
| 566 | (should (eq (type-of x) 'vector)) | 558 | (should (eq (type-of x) 'vector)) |
| 567 | 559 | ||
| 568 | (cl-old-struct-compat-mode 1) | 560 | (cl-old-struct-compat-mode 1) |
| 561 | (defvar cl-struct-foo) | ||
| 569 | (let ((cl-struct-foo (cl--struct-get-class 'foo))) | 562 | (let ((cl-struct-foo (cl--struct-get-class 'foo))) |
| 570 | (setf (symbol-function 'cl-struct-foo) :quick-object-witness-check) | 563 | (setf (symbol-function 'cl-struct-foo) :quick-object-witness-check) |
| 571 | (should (eq (type-of x) 'foo)) | 564 | (should (eq (type-of x) 'foo)) |
diff --git a/test/lisp/emacs-lisp/pcase-tests.el b/test/lisp/emacs-lisp/pcase-tests.el index 1b06c6e7543..e6f4c097504 100644 --- a/test/lisp/emacs-lisp/pcase-tests.el +++ b/test/lisp/emacs-lisp/pcase-tests.el | |||
| @@ -32,6 +32,10 @@ | |||
| 32 | (should (equal (pcase '(2 . 3) ;bug#18554 | 32 | (should (equal (pcase '(2 . 3) ;bug#18554 |
| 33 | (`(,hd . ,(and (pred atom) tl)) (list hd tl)) | 33 | (`(,hd . ,(and (pred atom) tl)) (list hd tl)) |
| 34 | ((pred consp) nil)) | 34 | ((pred consp) nil)) |
| 35 | '(2 3))) | ||
| 36 | (should (equal (pcase '(2 . 3) | ||
| 37 | (`(,hd . ,(and (pred (not consp)) tl)) (list hd tl)) | ||
| 38 | ((pred consp) nil)) | ||
| 35 | '(2 3)))) | 39 | '(2 3)))) |
| 36 | 40 | ||
| 37 | (pcase-defmacro pcase-tests-plus (pat n) | 41 | (pcase-defmacro pcase-tests-plus (pat n) |
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 670398354a6..05c7fbe781e 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el | |||
| @@ -29,6 +29,9 @@ | |||
| 29 | (require 'ert) | 29 | (require 'ert) |
| 30 | (require 'seq) | 30 | (require 'seq) |
| 31 | 31 | ||
| 32 | (eval-when-compile | ||
| 33 | (require 'cl-lib)) | ||
| 34 | |||
| 32 | (defmacro with-test-sequences (spec &rest body) | 35 | (defmacro with-test-sequences (spec &rest body) |
| 33 | "Successively bind VAR to a list, vector, and string built from SEQ. | 36 | "Successively bind VAR to a list, vector, and string built from SEQ. |
| 34 | Evaluate BODY for each created sequence. | 37 | Evaluate BODY for each created sequence. |
| @@ -108,16 +111,12 @@ Evaluate BODY for each created sequence. | |||
| 108 | '((a 0) (b 1) (c 2) (d 3))))) | 111 | '((a 0) (b 1) (c 2) (d 3))))) |
| 109 | 112 | ||
| 110 | (ert-deftest test-seq-do-indexed () | 113 | (ert-deftest test-seq-do-indexed () |
| 111 | (let ((result nil)) | 114 | (let (result) |
| 112 | (seq-do-indexed (lambda (elt i) | 115 | (seq-do-indexed (lambda (elt i) (push (list elt i) result)) ()) |
| 113 | (add-to-list 'result (list elt i))) | 116 | (should-not result)) |
| 114 | nil) | ||
| 115 | (should (equal result nil))) | ||
| 116 | (with-test-sequences (seq '(4 5 6)) | 117 | (with-test-sequences (seq '(4 5 6)) |
| 117 | (let ((result nil)) | 118 | (let (result) |
| 118 | (seq-do-indexed (lambda (elt i) | 119 | (seq-do-indexed (lambda (elt i) (push (list elt i) result)) seq) |
| 119 | (add-to-list 'result (list elt i))) | ||
| 120 | seq) | ||
| 121 | (should (equal (seq-elt result 0) '(6 2))) | 120 | (should (equal (seq-elt result 0) '(6 2))) |
| 122 | (should (equal (seq-elt result 1) '(5 1))) | 121 | (should (equal (seq-elt result 1) '(5 1))) |
| 123 | (should (equal (seq-elt result 2) '(4 0)))))) | 122 | (should (equal (seq-elt result 2) '(4 0)))))) |
| @@ -410,12 +409,10 @@ Evaluate BODY for each created sequence. | |||
| 410 | 409 | ||
| 411 | (ert-deftest test-seq-random-elt-take-all () | 410 | (ert-deftest test-seq-random-elt-take-all () |
| 412 | (let ((seq '(a b c d e)) | 411 | (let ((seq '(a b c d e)) |
| 413 | (elts '())) | 412 | elts) |
| 414 | (should (= 0 (length elts))) | ||
| 415 | (dotimes (_ 1000) | 413 | (dotimes (_ 1000) |
| 416 | (let ((random-elt (seq-random-elt seq))) | 414 | (let ((random-elt (seq-random-elt seq))) |
| 417 | (add-to-list 'elts | 415 | (cl-pushnew random-elt elts))) |
| 418 | random-elt))) | ||
| 419 | (should (= 5 (length elts))))) | 416 | (should (= 5 (length elts))))) |
| 420 | 417 | ||
| 421 | (ert-deftest test-seq-random-elt-signal-on-empty () | 418 | (ert-deftest test-seq-random-elt-signal-on-empty () |
diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el index 6e77259fe1b..c0db9c9de17 100644 --- a/test/lisp/faces-tests.el +++ b/test/lisp/faces-tests.el | |||
| @@ -217,5 +217,13 @@ | |||
| 217 | )) | 217 | )) |
| 218 | ) | 218 | ) |
| 219 | 219 | ||
| 220 | (ert-deftest test-tty-find-type () | ||
| 221 | (let ((pred (lambda (string) | ||
| 222 | (locate-library (concat "term/" string ".el"))))) | ||
| 223 | (should (tty-find-type pred "cygwin")) | ||
| 224 | (should (tty-find-type pred "cygwin-foo")) | ||
| 225 | (should (equal (tty-find-type pred "xterm") "xterm")) | ||
| 226 | (should (equal (tty-find-type pred "screen.xterm") "screen")))) | ||
| 227 | |||
| 220 | (provide 'faces-tests) | 228 | (provide 'faces-tests) |
| 221 | ;;; faces-tests.el ends here | 229 | ;;; faces-tests.el ends here |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ef0968a3385..7757c55c16b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2272,8 +2272,8 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2272 | (delete-file tmp-name) | 2272 | (delete-file tmp-name) |
| 2273 | (should-not (file-exists-p tmp-name)) | 2273 | (should-not (file-exists-p tmp-name)) |
| 2274 | 2274 | ||
| 2275 | ;; Trashing files doesn't work for crypted remote files. | 2275 | ;; Trashing files doesn't work on MS Windows, and for crypted remote files. |
| 2276 | (unless (tramp--test-crypt-p) | 2276 | (unless (or (tramp--test-windows-nt-p) (tramp--test-crypt-p)) |
| 2277 | (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) | 2277 | (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) |
| 2278 | (delete-by-moving-to-trash t)) | 2278 | (delete-by-moving-to-trash t)) |
| 2279 | (make-directory trash-directory) | 2279 | (make-directory trash-directory) |
| @@ -2786,9 +2786,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 2786 | (should-not (file-directory-p tmp-name1)) | 2786 | (should-not (file-directory-p tmp-name1)) |
| 2787 | 2787 | ||
| 2788 | ;; Trashing directories works only since Emacs 27.1. It doesn't | 2788 | ;; Trashing directories works only since Emacs 27.1. It doesn't |
| 2789 | ;; work for crypted remote directories and for ange-ftp. | 2789 | ;; work on MS Windows, for crypted remote directories and for ange-ftp. |
| 2790 | (when (and (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p)) | 2790 | (when (and (not (tramp--test-windows-nt-p)) (not (tramp--test-crypt-p)) |
| 2791 | (tramp--test-emacs27-p)) | 2791 | (not (tramp--test-ftp-p)) (tramp--test-emacs27-p)) |
| 2792 | (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) | 2792 | (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) |
| 2793 | (delete-by-moving-to-trash t)) | 2793 | (delete-by-moving-to-trash t)) |
| 2794 | (make-directory trash-directory) | 2794 | (make-directory trash-directory) |
| @@ -5247,7 +5247,7 @@ Use direct async.") | |||
| 5247 | ;; order to avoid a question. `explicit-sh-args' echoes the | 5247 | ;; order to avoid a question. `explicit-sh-args' echoes the |
| 5248 | ;; test data. | 5248 | ;; test data. |
| 5249 | (with-current-buffer (get-buffer-create "*shell*") | 5249 | (with-current-buffer (get-buffer-create "*shell*") |
| 5250 | (ignore-errors (kill-process (current-buffer))) | 5250 | (ignore-errors (kill-process (get-buffer-process (current-buffer)))) |
| 5251 | (should-not explicit-shell-file-name) | 5251 | (should-not explicit-shell-file-name) |
| 5252 | (call-interactively #'shell) | 5252 | (call-interactively #'shell) |
| 5253 | (with-timeout (10) | 5253 | (with-timeout (10) |
| @@ -5720,16 +5720,16 @@ This requires restrictions of file name syntax." | |||
| 5720 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 5720 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 5721 | 'tramp-ftp-file-name-handler)) | 5721 | 'tramp-ftp-file-name-handler)) |
| 5722 | 5722 | ||
| 5723 | (defun tramp--test-crypt-p () | ||
| 5724 | "Check, whether the remote directory is crypted" | ||
| 5725 | (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) | ||
| 5726 | |||
| 5723 | (defun tramp--test-docker-p () | 5727 | (defun tramp--test-docker-p () |
| 5724 | "Check, whether the docker method is used. | 5728 | "Check, whether the docker method is used. |
| 5725 | This does not support some special file names." | 5729 | This does not support some special file names." |
| 5726 | (string-equal | 5730 | (string-equal |
| 5727 | "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) | 5731 | "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) |
| 5728 | 5732 | ||
| 5729 | (defun tramp--test-crypt-p () | ||
| 5730 | "Check, whether the remote directory is crypted" | ||
| 5731 | (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) | ||
| 5732 | |||
| 5733 | (defun tramp--test-ftp-p () | 5733 | (defun tramp--test-ftp-p () |
| 5734 | "Check, whether an FTP-like method is used. | 5734 | "Check, whether an FTP-like method is used. |
| 5735 | This does not support globbing characters in file names (yet)." | 5735 | This does not support globbing characters in file names (yet)." |
| @@ -5748,7 +5748,7 @@ If optional METHOD is given, it is checked first." | |||
| 5748 | "Check, whether the remote host runs HP-UX. | 5748 | "Check, whether the remote host runs HP-UX. |
| 5749 | Several special characters do not work properly there." | 5749 | Several special characters do not work properly there." |
| 5750 | ;; We must refill the cache. `file-truename' does it. | 5750 | ;; We must refill the cache. `file-truename' does it. |
| 5751 | (file-truename tramp-test-temporary-file-directory) nil | 5751 | (file-truename tramp-test-temporary-file-directory) |
| 5752 | (string-match-p | 5752 | (string-match-p |
| 5753 | "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) | 5753 | "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) |
| 5754 | 5754 | ||
| @@ -5757,7 +5757,7 @@ Several special characters do not work properly there." | |||
| 5757 | ksh93 makes some strange conversions of non-latin characters into | 5757 | ksh93 makes some strange conversions of non-latin characters into |
| 5758 | a $'' syntax." | 5758 | a $'' syntax." |
| 5759 | ;; We must refill the cache. `file-truename' does it. | 5759 | ;; We must refill the cache. `file-truename' does it. |
| 5760 | (file-truename tramp-test-temporary-file-directory) nil | 5760 | (file-truename tramp-test-temporary-file-directory) |
| 5761 | (string-match-p | 5761 | (string-match-p |
| 5762 | "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) | 5762 | "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) |
| 5763 | 5763 | ||
| @@ -5787,6 +5787,15 @@ This does not support special file names." | |||
| 5787 | "Check, whether the remote host runs a based method from tramp-sh.el." | 5787 | "Check, whether the remote host runs a based method from tramp-sh.el." |
| 5788 | (tramp-sh-file-name-handler-p tramp-test-vec)) | 5788 | (tramp-sh-file-name-handler-p tramp-test-vec)) |
| 5789 | 5789 | ||
| 5790 | (defun tramp--test-sh-no-ls--dired-p () | ||
| 5791 | "Check, whether the remote host runs a based method from tramp-sh.el. | ||
| 5792 | Additionally, ls does not support \"--dired\"." | ||
| 5793 | (and (tramp--test-sh-p) | ||
| 5794 | (with-temp-buffer | ||
| 5795 | ;; We must refill the cache. `insert-directory' does it. | ||
| 5796 | (insert-directory tramp-test-temporary-file-directory "-al") | ||
| 5797 | (not (tramp-get-connection-property tramp-test-vec "ls--dired" nil))))) | ||
| 5798 | |||
| 5790 | (defun tramp--test-share-p () | 5799 | (defun tramp--test-share-p () |
| 5791 | "Check, whether the method needs a share." | 5800 | "Check, whether the method needs a share." |
| 5792 | (and (tramp--test-gvfs-p) | 5801 | (and (tramp--test-gvfs-p) |
| @@ -6023,17 +6032,20 @@ This requires restrictions of file name syntax." | |||
| 6023 | ;; expanded to <TAB>. | 6032 | ;; expanded to <TAB>. |
| 6024 | (let ((files | 6033 | (let ((files |
| 6025 | (list | 6034 | (list |
| 6026 | (if (or (tramp--test-ange-ftp-p) | 6035 | (cond ((or (tramp--test-ange-ftp-p) |
| 6027 | (tramp--test-gvfs-p) | 6036 | (tramp--test-gvfs-p) |
| 6028 | (tramp--test-rclone-p) | 6037 | (tramp--test-rclone-p) |
| 6029 | (tramp--test-sudoedit-p) | 6038 | (tramp--test-sudoedit-p) |
| 6030 | (tramp--test-windows-nt-or-smb-p)) | 6039 | (tramp--test-windows-nt-or-smb-p)) |
| 6031 | "foo bar baz" | 6040 | "foo bar baz") |
| 6032 | (if (or (tramp--test-adb-p) | 6041 | ((or (tramp--test-adb-p) |
| 6033 | (tramp--test-docker-p) | 6042 | (tramp--test-docker-p) |
| 6034 | (eq system-type 'cygwin)) | 6043 | (eq system-type 'cygwin)) |
| 6035 | " foo bar baz " | 6044 | " foo bar baz ") |
| 6036 | " foo\tbar baz\t")) | 6045 | ((tramp--test-sh-no-ls--dired-p) |
| 6046 | "\tfoo bar baz\t") | ||
| 6047 | (t " foo\tbar baz\t")) | ||
| 6048 | "@foo@bar@baz@" | ||
| 6037 | "$foo$bar$$baz$" | 6049 | "$foo$bar$$baz$" |
| 6038 | "-foo-bar-baz-" | 6050 | "-foo-bar-baz-" |
| 6039 | "%foo%bar%baz%" | 6051 | "%foo%bar%baz%" |
| @@ -6349,6 +6361,7 @@ process sentinels. They shall not disturb each other." | |||
| 6349 | (tramp--test-sh-p))) | 6361 | (tramp--test-sh-p))) |
| 6350 | (skip-unless (not (tramp--test-crypt-p))) | 6362 | (skip-unless (not (tramp--test-crypt-p))) |
| 6351 | (skip-unless (not (tramp--test-docker-p))) | 6363 | (skip-unless (not (tramp--test-docker-p))) |
| 6364 | (skip-unless (not (tramp--test-windows-nt-p))) | ||
| 6352 | 6365 | ||
| 6353 | (with-timeout | 6366 | (with-timeout |
| 6354 | (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler)) | 6367 | (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler)) |
| @@ -6358,12 +6371,11 @@ process sentinels. They shall not disturb each other." | |||
| 6358 | (shell-file-name (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")) | 6371 | (shell-file-name (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")) |
| 6359 | ;; It doesn't work on w32 systems. | 6372 | ;; It doesn't work on w32 systems. |
| 6360 | (watchdog | 6373 | (watchdog |
| 6361 | (unless (tramp--test-windows-nt-p) | 6374 | (start-process-shell-command |
| 6362 | (start-process-shell-command | 6375 | "*watchdog*" nil |
| 6363 | "*watchdog*" nil | 6376 | (format |
| 6364 | (format | 6377 | "sleep %d; kill -USR1 %d" |
| 6365 | "sleep %d; kill -USR1 %d" | 6378 | tramp--test-asynchronous-requests-timeout (emacs-pid)))) |
| 6366 | tramp--test-asynchronous-requests-timeout (emacs-pid))))) | ||
| 6367 | (tmp-name (tramp--test-make-temp-name)) | 6379 | (tmp-name (tramp--test-make-temp-name)) |
| 6368 | (default-directory tmp-name) | 6380 | (default-directory tmp-name) |
| 6369 | ;; Do not cache Tramp properties. | 6381 | ;; Do not cache Tramp properties. |
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index a10d5dab906..0da0e393535 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el | |||
| @@ -314,7 +314,19 @@ | |||
| 314 | (let* ((xref (pop xrefs)) | 314 | (let* ((xref (pop xrefs)) |
| 315 | (expected (pop expected-xrefs)) | 315 | (expected (pop expected-xrefs)) |
| 316 | (expected-xref (or (when (consp expected) (car expected)) expected)) | 316 | (expected-xref (or (when (consp expected) (car expected)) expected)) |
| 317 | (expected-source (when (consp expected) (cdr expected)))) | 317 | (expected-source (when (consp expected) (cdr expected))) |
| 318 | (xref-file (xref-elisp-location-file (oref xref location))) | ||
| 319 | (expected-file (xref-elisp-location-file | ||
| 320 | (oref expected-xref location)))) | ||
| 321 | |||
| 322 | ;; Make sure file names compare as strings. | ||
| 323 | (when (file-name-absolute-p xref-file) | ||
| 324 | (setf (xref-elisp-location-file (oref xref location)) | ||
| 325 | (file-truename (xref-elisp-location-file (oref xref location))))) | ||
| 326 | (when (file-name-absolute-p expected-file) | ||
| 327 | (setf (xref-elisp-location-file (oref expected-xref location)) | ||
| 328 | (file-truename (xref-elisp-location-file | ||
| 329 | (oref expected-xref location))))) | ||
| 318 | 330 | ||
| 319 | ;; Downcase the filenames for case-insensitive file systems. | 331 | ;; Downcase the filenames for case-insensitive file systems. |
| 320 | (when xref--case-insensitive | 332 | (when xref--case-insensitive |
| @@ -822,5 +834,56 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 822 | (indent-region (point-min) (point-max)) | 834 | (indent-region (point-min) (point-max)) |
| 823 | (should (equal (buffer-string) orig))))) | 835 | (should (equal (buffer-string) orig))))) |
| 824 | 836 | ||
| 837 | (defun test--font (form search) | ||
| 838 | (with-temp-buffer | ||
| 839 | (emacs-lisp-mode) | ||
| 840 | (if (stringp form) | ||
| 841 | (insert form) | ||
| 842 | (pp form (current-buffer))) | ||
| 843 | (font-lock-debug-fontify) | ||
| 844 | (goto-char (point-min)) | ||
| 845 | (and (re-search-forward search nil t) | ||
| 846 | (get-text-property (match-beginning 1) 'face)))) | ||
| 847 | |||
| 848 | (ert-deftest test-elisp-font-keywords-1 () | ||
| 849 | ;; Special form. | ||
| 850 | (should (eq (test--font '(if foo bar) "(\\(if\\)") | ||
| 851 | 'font-lock-keyword-face)) | ||
| 852 | ;; Macro. | ||
| 853 | (should (eq (test--font '(when foo bar) "(\\(when\\)") | ||
| 854 | 'font-lock-keyword-face)) | ||
| 855 | (should (eq (test--font '(condition-case nil | ||
| 856 | (foo) | ||
| 857 | (error (if a b))) | ||
| 858 | "(\\(if\\)") | ||
| 859 | 'font-lock-keyword-face)) | ||
| 860 | (should (eq (test--font '(condition-case nil | ||
| 861 | (foo) | ||
| 862 | (when (if a b))) | ||
| 863 | "(\\(when\\)") | ||
| 864 | 'nil))) | ||
| 865 | |||
| 866 | (ert-deftest test-elisp-font-keywords-2 () | ||
| 867 | :expected-result :failed ; FIXME bug#43265 | ||
| 868 | (should (eq (test--font '(condition-case nil | ||
| 869 | (foo) | ||
| 870 | (error (when a b))) | ||
| 871 | "(\\(when\\)") | ||
| 872 | 'font-lock-keyword-face))) | ||
| 873 | |||
| 874 | (ert-deftest test-elisp-font-keywords-3 () | ||
| 875 | :expected-result :failed ; FIXME bug#43265 | ||
| 876 | (should (eq (test--font '(setq a '(if when zot)) | ||
| 877 | "(\\(if\\)") | ||
| 878 | nil))) | ||
| 879 | |||
| 880 | (ert-deftest test-elisp-font-keywords-if () | ||
| 881 | :expected-result :failed ; FIXME bug#43265 | ||
| 882 | (should (eq (test--font '(condition-case nil | ||
| 883 | (foo) | ||
| 884 | ((if foo) (when a b))) | ||
| 885 | "(\\(if\\)") | ||
| 886 | nil))) | ||
| 887 | |||
| 825 | (provide 'elisp-mode-tests) | 888 | (provide 'elisp-mode-tests) |
| 826 | ;;; elisp-mode-tests.el ends here | 889 | ;;; elisp-mode-tests.el ends here |
diff --git a/test/lisp/replace-tests.el b/test/lisp/replace-tests.el index 8c2682a1f13..2db570c97dd 100644 --- a/test/lisp/replace-tests.el +++ b/test/lisp/replace-tests.el | |||
| @@ -587,5 +587,18 @@ bound to HIGHLIGHT-LOCUS." | |||
| 587 | (get-text-property (point) 'occur-target)) | 587 | (get-text-property (point) 'occur-target)) |
| 588 | (should (funcall check-overlays has-overlay))))))) | 588 | (should (funcall check-overlays has-overlay))))))) |
| 589 | 589 | ||
| 590 | (ert-deftest replace-regexp-bug45973 () | ||
| 591 | "Test for https://debbugs.gnu.org/45973 ." | ||
| 592 | (let ((before "1RB 1LC 1RC 1RB 1RD 0LE 1LA 1LD 1RH 0LA") | ||
| 593 | (after "1LB 1RC 1LC 1LB 1LD 0RE 1RA 1RD 1LH 0RA")) | ||
| 594 | (with-temp-buffer | ||
| 595 | (insert before) | ||
| 596 | (goto-char (point-min)) | ||
| 597 | (replace-regexp | ||
| 598 | "\\(\\(L\\)\\|\\(R\\)\\)" | ||
| 599 | '(replace-eval-replacement | ||
| 600 | replace-quote | ||
| 601 | (if (match-string 2) "R" "L"))) | ||
| 602 | (should (equal (buffer-string) after))))) | ||
| 590 | 603 | ||
| 591 | ;;; replace-tests.el ends here | 604 | ;;; replace-tests.el ends here |
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index c43c81af9fd..62a27f09cbd 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el | |||
| @@ -146,4 +146,48 @@ position to retrieve THING.") | |||
| 146 | (should (thing-at-point-looking-at "2abcd")) | 146 | (should (thing-at-point-looking-at "2abcd")) |
| 147 | (should (equal (match-data) m2))))) | 147 | (should (equal (match-data) m2))))) |
| 148 | 148 | ||
| 149 | (ert-deftest test-symbol-thing-1 () | ||
| 150 | (with-temp-buffer | ||
| 151 | (insert "foo bar zot") | ||
| 152 | (goto-char 4) | ||
| 153 | (should (eq (symbol-at-point) 'foo)) | ||
| 154 | (forward-char 1) | ||
| 155 | (should (eq (symbol-at-point) 'bar)) | ||
| 156 | (forward-char 1) | ||
| 157 | (should (eq (symbol-at-point) 'bar)) | ||
| 158 | (forward-char 1) | ||
| 159 | (should (eq (symbol-at-point) 'bar)) | ||
| 160 | (forward-char 1) | ||
| 161 | (should (eq (symbol-at-point) 'bar)) | ||
| 162 | (forward-char 1) | ||
| 163 | (should (eq (symbol-at-point) 'zot)))) | ||
| 164 | |||
| 165 | (ert-deftest test-symbol-thing-2 () | ||
| 166 | (with-temp-buffer | ||
| 167 | (insert " bar ") | ||
| 168 | (goto-char (point-max)) | ||
| 169 | (should (eq (symbol-at-point) nil)) | ||
| 170 | (forward-char -1) | ||
| 171 | (should (eq (symbol-at-point) 'bar)))) | ||
| 172 | |||
| 173 | (ert-deftest test-symbol-thing-2 () | ||
| 174 | (with-temp-buffer | ||
| 175 | (insert " bar ") | ||
| 176 | (goto-char (point-max)) | ||
| 177 | (should (eq (symbol-at-point) nil)) | ||
| 178 | (forward-char -1) | ||
| 179 | (should (eq (symbol-at-point) 'bar)))) | ||
| 180 | |||
| 181 | (ert-deftest test-symbol-thing-3 () | ||
| 182 | (with-temp-buffer | ||
| 183 | (insert "bar") | ||
| 184 | (goto-char 2) | ||
| 185 | (should (eq (symbol-at-point) 'bar)))) | ||
| 186 | |||
| 187 | (ert-deftest test-symbol-thing-3 () | ||
| 188 | (with-temp-buffer | ||
| 189 | (insert "`[[`(") | ||
| 190 | (goto-char 2) | ||
| 191 | (should (eq (symbol-at-point) nil)))) | ||
| 192 | |||
| 149 | ;;; thingatpt.el ends here | 193 | ;;; thingatpt.el ends here |
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 81488c3df19..4ae3c1917dd 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el | |||
| @@ -262,40 +262,48 @@ | |||
| 262 | (ert-deftest time-stamp-format-day-of-week () | 262 | (ert-deftest time-stamp-format-day-of-week () |
| 263 | "Test time-stamp formats for named day of week." | 263 | "Test time-stamp formats for named day of week." |
| 264 | (with-time-stamp-test-env | 264 | (with-time-stamp-test-env |
| 265 | ;; implemented and documented since 1997 | 265 | (let ((Mon (format-time-string "%a" ref-time1 t)) |
| 266 | (should (equal (time-stamp-string "%3a" ref-time1) "Mon")) | 266 | (MON (format-time-string "%^a" ref-time1 t)) |
| 267 | (should (equal (time-stamp-string "%#A" ref-time1) "MONDAY")) | 267 | (Monday (format-time-string "%A" ref-time1 t)) |
| 268 | ;; documented 1997-2019 | 268 | (MONDAY (format-time-string "%^A" ref-time1 t))) |
| 269 | (should (equal (time-stamp-string "%3A" ref-time1) "MON")) | 269 | ;; implemented and documented since 1997 |
| 270 | (should (equal (time-stamp-string "%:a" ref-time1) "Monday")) | 270 | (should (equal (time-stamp-string "%3a" ref-time1) Mon)) |
| 271 | ;; implemented since 2001, documented since 2019 | 271 | (should (equal (time-stamp-string "%#A" ref-time1) MONDAY)) |
| 272 | (should (equal (time-stamp-string "%#a" ref-time1) "MON")) | 272 | ;; documented 1997-2019 |
| 273 | (should (equal (time-stamp-string "%:A" ref-time1) "Monday")) | 273 | (should (equal (time-stamp-string "%3A" ref-time1) MON)) |
| 274 | ;; allowed but undocumented since 2019 (warned 1997-2019) | 274 | (should (equal (time-stamp-string "%:a" ref-time1) Monday)) |
| 275 | (should (equal (time-stamp-string "%^A" ref-time1) "MONDAY")) | 275 | ;; implemented since 2001, documented since 2019 |
| 276 | ;; warned 1997-2019, changed in 2019 | 276 | (should (equal (time-stamp-string "%#a" ref-time1) MON)) |
| 277 | (should (equal (time-stamp-string "%a" ref-time1) "Mon")) | 277 | (should (equal (time-stamp-string "%:A" ref-time1) Monday)) |
| 278 | (should (equal (time-stamp-string "%^a" ref-time1) "MON")) | 278 | ;; allowed but undocumented since 2019 (warned 1997-2019) |
| 279 | (should (equal (time-stamp-string "%A" ref-time1) "Monday")))) | 279 | (should (equal (time-stamp-string "%^A" ref-time1) MONDAY)) |
| 280 | ;; warned 1997-2019, changed in 2019 | ||
| 281 | (should (equal (time-stamp-string "%a" ref-time1) Mon)) | ||
| 282 | (should (equal (time-stamp-string "%^a" ref-time1) MON)) | ||
| 283 | (should (equal (time-stamp-string "%A" ref-time1) Monday))))) | ||
| 280 | 284 | ||
| 281 | (ert-deftest time-stamp-format-month-name () | 285 | (ert-deftest time-stamp-format-month-name () |
| 282 | "Test time-stamp formats for month name." | 286 | "Test time-stamp formats for month name." |
| 283 | (with-time-stamp-test-env | 287 | (with-time-stamp-test-env |
| 284 | ;; implemented and documented since 1997 | 288 | (let ((Jan (format-time-string "%b" ref-time1 t)) |
| 285 | (should (equal (time-stamp-string "%3b" ref-time1) "Jan")) | 289 | (JAN (format-time-string "%^b" ref-time1 t)) |
| 286 | (should (equal (time-stamp-string "%#B" ref-time1) "JANUARY")) | 290 | (January (format-time-string "%B" ref-time1 t)) |
| 287 | ;; documented 1997-2019 | 291 | (JANUARY (format-time-string "%^B" ref-time1 t))) |
| 288 | (should (equal (time-stamp-string "%3B" ref-time1) "JAN")) | 292 | ;; implemented and documented since 1997 |
| 289 | (should (equal (time-stamp-string "%:b" ref-time1) "January")) | 293 | (should (equal (time-stamp-string "%3b" ref-time1) Jan)) |
| 290 | ;; implemented since 2001, documented since 2019 | 294 | (should (equal (time-stamp-string "%#B" ref-time1) JANUARY)) |
| 291 | (should (equal (time-stamp-string "%#b" ref-time1) "JAN")) | 295 | ;; documented 1997-2019 |
| 292 | (should (equal (time-stamp-string "%:B" ref-time1) "January")) | 296 | (should (equal (time-stamp-string "%3B" ref-time1) JAN)) |
| 293 | ;; allowed but undocumented since 2019 (warned 1997-2019) | 297 | (should (equal (time-stamp-string "%:b" ref-time1) January)) |
| 294 | (should (equal (time-stamp-string "%^B" ref-time1) "JANUARY")) | 298 | ;; implemented since 2001, documented since 2019 |
| 295 | ;; warned 1997-2019, changed in 2019 | 299 | (should (equal (time-stamp-string "%#b" ref-time1) JAN)) |
| 296 | (should (equal (time-stamp-string "%b" ref-time1) "Jan")) | 300 | (should (equal (time-stamp-string "%:B" ref-time1) January)) |
| 297 | (should (equal (time-stamp-string "%^b" ref-time1) "JAN")) | 301 | ;; allowed but undocumented since 2019 (warned 1997-2019) |
| 298 | (should (equal (time-stamp-string "%B" ref-time1) "January")))) | 302 | (should (equal (time-stamp-string "%^B" ref-time1) JANUARY)) |
| 303 | ;; warned 1997-2019, changed in 2019 | ||
| 304 | (should (equal (time-stamp-string "%b" ref-time1) Jan)) | ||
| 305 | (should (equal (time-stamp-string "%^b" ref-time1) JAN)) | ||
| 306 | (should (equal (time-stamp-string "%B" ref-time1) January))))) | ||
| 299 | 307 | ||
| 300 | (ert-deftest time-stamp-format-day-of-month () | 308 | (ert-deftest time-stamp-format-day-of-month () |
| 301 | "Test time-stamp formats for day of month." | 309 | "Test time-stamp formats for day of month." |
| @@ -483,14 +491,18 @@ | |||
| 483 | (ert-deftest time-stamp-format-am-pm () | 491 | (ert-deftest time-stamp-format-am-pm () |
| 484 | "Test time-stamp formats for AM and PM strings." | 492 | "Test time-stamp formats for AM and PM strings." |
| 485 | (with-time-stamp-test-env | 493 | (with-time-stamp-test-env |
| 486 | ;; implemented and documented since 1997 | 494 | (let ((pm (format-time-string "%#p" ref-time1 t)) |
| 487 | (should (equal (time-stamp-string "%#p" ref-time1) "pm")) | 495 | (am (format-time-string "%#p" ref-time3 t)) |
| 488 | (should (equal (time-stamp-string "%#p" ref-time3) "am")) | 496 | (PM (format-time-string "%p" ref-time1 t)) |
| 489 | (should (equal (time-stamp-string "%P" ref-time1) "PM")) | 497 | (AM (format-time-string "%p" ref-time3 t))) |
| 490 | (should (equal (time-stamp-string "%P" ref-time3) "AM")) | 498 | ;; implemented and documented since 1997 |
| 491 | ;; warned 1997-2019, changed in 2019 | 499 | (should (equal (time-stamp-string "%#p" ref-time1) pm)) |
| 492 | (should (equal (time-stamp-string "%p" ref-time1) "PM")) | 500 | (should (equal (time-stamp-string "%#p" ref-time3) am)) |
| 493 | (should (equal (time-stamp-string "%p" ref-time3) "AM")))) | 501 | (should (equal (time-stamp-string "%P" ref-time1) PM)) |
| 502 | (should (equal (time-stamp-string "%P" ref-time3) AM)) | ||
| 503 | ;; warned 1997-2019, changed in 2019 | ||
| 504 | (should (equal (time-stamp-string "%p" ref-time1) PM)) | ||
| 505 | (should (equal (time-stamp-string "%p" ref-time3) AM))))) | ||
| 494 | 506 | ||
| 495 | (ert-deftest time-stamp-format-day-number-in-week () | 507 | (ert-deftest time-stamp-format-day-number-in-week () |
| 496 | "Test time-stamp formats for day number in week." | 508 | "Test time-stamp formats for day number in week." |
| @@ -567,10 +579,15 @@ | |||
| 567 | (ert-deftest time-stamp-format-ignored-modifiers () | 579 | (ert-deftest time-stamp-format-ignored-modifiers () |
| 568 | "Test additional args allowed (but ignored) to allow for future expansion." | 580 | "Test additional args allowed (but ignored) to allow for future expansion." |
| 569 | (with-time-stamp-test-env | 581 | (with-time-stamp-test-env |
| 570 | ;; allowed modifiers | 582 | (let ((May (format-time-string "%B" ref-time3 t))) |
| 571 | (should (equal (time-stamp-string "%.,@-+_ ^(stuff)P" ref-time3) "AM")) | 583 | ;; allowed modifiers |
| 572 | ;; not all punctuation is allowed | 584 | (should (equal (time-stamp-string "%.,@+ (stuff)B" ref-time3) May)) |
| 573 | (should-not (equal (time-stamp-string "%&P" ref-time3) "AM")))) | 585 | ;; parens nest |
| 586 | (should (equal (time-stamp-string "%(st(u)ff)B" ref-time3) May)) | ||
| 587 | ;; escaped parens do not change the nesting level | ||
| 588 | (should (equal (time-stamp-string "%(st\\)u\\(ff)B" ref-time3) May)) | ||
| 589 | ;; not all punctuation is allowed | ||
| 590 | (should-not (equal (time-stamp-string "%&B" ref-time3) May))))) | ||
| 574 | 591 | ||
| 575 | (ert-deftest time-stamp-format-non-conversions () | 592 | (ert-deftest time-stamp-format-non-conversions () |
| 576 | "Test that without a %, the text is copied literally." | 593 | "Test that without a %, the text is copied literally." |
| @@ -580,16 +597,22 @@ | |||
| 580 | (ert-deftest time-stamp-format-string-width () | 597 | (ert-deftest time-stamp-format-string-width () |
| 581 | "Test time-stamp string width modifiers." | 598 | "Test time-stamp string width modifiers." |
| 582 | (with-time-stamp-test-env | 599 | (with-time-stamp-test-env |
| 583 | ;; strings truncate on the right or are blank-padded on the left | 600 | (let ((May (format-time-string "%b" ref-time3 t)) |
| 584 | (should (equal (time-stamp-string "%0P" ref-time3) "")) | 601 | (SUN (format-time-string "%^a" ref-time3 t)) |
| 585 | (should (equal (time-stamp-string "%1P" ref-time3) "A")) | 602 | (NOV (format-time-string "%^b" ref-time2 t))) |
| 586 | (should (equal (time-stamp-string "%2P" ref-time3) "AM")) | 603 | ;; strings truncate on the right or are blank-padded on the left |
| 587 | (should (equal (time-stamp-string "%3P" ref-time3) " AM")) | 604 | (should (equal (time-stamp-string "%0b" ref-time3) "")) |
| 588 | (should (equal (time-stamp-string "%0%" ref-time3) "")) | 605 | (should (equal (time-stamp-string "%1b" ref-time3) (substring May 0 1))) |
| 589 | (should (equal (time-stamp-string "%1%" ref-time3) "%")) | 606 | (should (equal (time-stamp-string "%2b" ref-time3) (substring May 0 2))) |
| 590 | (should (equal (time-stamp-string "%2%" ref-time3) " %")) | 607 | (should (equal (time-stamp-string "%3b" ref-time3) May)) |
| 591 | (should (equal (time-stamp-string "%#3a" ref-time3) "SUN")) | 608 | (should (equal (time-stamp-string "%4b" ref-time3) (concat " " May))) |
| 592 | (should (equal (time-stamp-string "%#3b" ref-time2) "NOV")))) | 609 | (should (equal (time-stamp-string "%0%" ref-time3) "")) |
| 610 | (should (equal (time-stamp-string "%1%" ref-time3) "%")) | ||
| 611 | (should (equal (time-stamp-string "%2%" ref-time3) " %")) | ||
| 612 | (should (equal (time-stamp-string "%9%" ref-time3) " %")) | ||
| 613 | (should (equal (time-stamp-string "%10%" ref-time3) " %")) | ||
| 614 | (should (equal (time-stamp-string "%#3a" ref-time3) SUN)) | ||
| 615 | (should (equal (time-stamp-string "%#3b" ref-time2) NOV))))) | ||
| 593 | 616 | ||
| 594 | ;;; Tests of helper functions | 617 | ;;; Tests of helper functions |
| 595 | 618 | ||
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el index 17fdfefce84..f843649784a 100644 --- a/test/lisp/wid-edit-tests.el +++ b/test/lisp/wid-edit-tests.el | |||
| @@ -322,4 +322,15 @@ return nil, even with a non-nil bubblep argument." | |||
| 322 | (widget-backward 1) | 322 | (widget-backward 1) |
| 323 | (should (string= "Second" (widget-value (widget-at)))))) | 323 | (should (string= "Second" (widget-value (widget-at)))))) |
| 324 | 324 | ||
| 325 | (ert-deftest widget-test-color-match () | ||
| 326 | "Test that the :match function for the color widget works." | ||
| 327 | (let ((widget (widget-convert 'color))) | ||
| 328 | (should (widget-apply widget :match "red")) | ||
| 329 | (should (widget-apply widget :match "#fa3")) | ||
| 330 | (should (widget-apply widget :match "#ff0000")) | ||
| 331 | (should (widget-apply widget :match "#111222333")) | ||
| 332 | (should (widget-apply widget :match "#111122223333")) | ||
| 333 | (should-not (widget-apply widget :match "someundefinedcolorihope")) | ||
| 334 | (should-not (widget-apply widget :match "#11223")))) | ||
| 335 | |||
| 325 | ;;; wid-edit-tests.el ends here | 336 | ;;; wid-edit-tests.el ends here |
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 57097cfa052..a3fba8d328b 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -576,11 +576,6 @@ FD_SETSIZE file descriptors (Bug#24325)." | |||
| 576 | (should (memq (process-status process) '(run exit))) | 576 | (should (memq (process-status process) '(run exit))) |
| 577 | (when (process-live-p process) | 577 | (when (process-live-p process) |
| 578 | (process-send-eof process)) | 578 | (process-send-eof process)) |
| 579 | ;; FIXME: This `sleep-for' shouldn't be needed. It | ||
| 580 | ;; indicates a bug in Emacs; perhaps SIGCHLD is | ||
| 581 | ;; received in parallel with `accept-process-output', | ||
| 582 | ;; causing the latter to hang. | ||
| 583 | (sleep-for 0.1) | ||
| 584 | (while (accept-process-output process)) | 579 | (while (accept-process-output process)) |
| 585 | (should (eq (process-status process) 'exit)) | 580 | (should (eq (process-status process) 'exit)) |
| 586 | ;; If there's an error between fork and exec, Emacs | 581 | ;; If there's an error between fork and exec, Emacs |
| @@ -739,5 +734,150 @@ Return nil if that can't be determined." | |||
| 739 | (match-string-no-properties 1)))))) | 734 | (match-string-no-properties 1)))))) |
| 740 | process-tests--EMFILE-message) | 735 | process-tests--EMFILE-message) |
| 741 | 736 | ||
| 737 | (ert-deftest process-tests/sentinel-called () | ||
| 738 | "Check that sentinels are called after processes finish" | ||
| 739 | (let ((command (process-tests--emacs-command))) | ||
| 740 | (skip-unless command) | ||
| 741 | (dolist (conn-type '(pipe pty)) | ||
| 742 | (ert-info ((format "Connection type: %s" conn-type)) | ||
| 743 | (process-tests--with-processes processes | ||
| 744 | (let* ((calls ()) | ||
| 745 | (process (make-process | ||
| 746 | :name "echo" | ||
| 747 | :command (process-tests--eval | ||
| 748 | command '(print "first")) | ||
| 749 | :noquery t | ||
| 750 | :connection-type conn-type | ||
| 751 | :coding 'utf-8-unix | ||
| 752 | :sentinel (lambda (process message) | ||
| 753 | (push (list process message) | ||
| 754 | calls))))) | ||
| 755 | (push process processes) | ||
| 756 | (while (accept-process-output process)) | ||
| 757 | (should (equal calls | ||
| 758 | (list (list process "finished\n")))))))))) | ||
| 759 | |||
| 760 | (ert-deftest process-tests/sentinel-with-multiple-processes () | ||
| 761 | "Check that sentinels are called in time even when other processes | ||
| 762 | have written output." | ||
| 763 | (let ((command (process-tests--emacs-command))) | ||
| 764 | (skip-unless command) | ||
| 765 | (dolist (conn-type '(pipe pty)) | ||
| 766 | (ert-info ((format "Connection type: %s" conn-type)) | ||
| 767 | (process-tests--with-processes processes | ||
| 768 | (let* ((calls ()) | ||
| 769 | (process (make-process | ||
| 770 | :name "echo" | ||
| 771 | :command (process-tests--eval | ||
| 772 | command '(print "first")) | ||
| 773 | :noquery t | ||
| 774 | :connection-type conn-type | ||
| 775 | :coding 'utf-8-unix | ||
| 776 | :sentinel (lambda (process message) | ||
| 777 | (push (list process message) | ||
| 778 | calls))))) | ||
| 779 | (push process processes) | ||
| 780 | (push (make-process | ||
| 781 | :name "bash" | ||
| 782 | :command (process-tests--eval | ||
| 783 | command | ||
| 784 | '(progn (sleep-for 10) (print "second"))) | ||
| 785 | :noquery t | ||
| 786 | :connection-type conn-type) | ||
| 787 | processes) | ||
| 788 | (while (accept-process-output process)) | ||
| 789 | (should (equal calls | ||
| 790 | (list (list process "finished\n")))))))))) | ||
| 791 | |||
| 792 | (ert-deftest process-tests/multiple-threads-waiting () | ||
| 793 | (skip-unless (fboundp 'make-thread)) | ||
| 794 | (with-timeout (60 (ert-fail "Test timed out")) | ||
| 795 | (process-tests--with-processes processes | ||
| 796 | (let ((threads ()) | ||
| 797 | (cat (executable-find "cat"))) | ||
| 798 | (skip-unless cat) | ||
| 799 | (dotimes (i 10) | ||
| 800 | (let* ((name (format "test %d" i)) | ||
| 801 | (process (make-process :name name | ||
| 802 | :command (list cat) | ||
| 803 | :coding 'no-conversion | ||
| 804 | :noquery t | ||
| 805 | :connection-type 'pipe))) | ||
| 806 | (push process processes) | ||
| 807 | (set-process-thread process nil) | ||
| 808 | (push (make-thread | ||
| 809 | (lambda () | ||
| 810 | (while (accept-process-output process))) | ||
| 811 | name) | ||
| 812 | threads))) | ||
| 813 | (mapc #'process-send-eof processes) | ||
| 814 | (cl-loop for process in processes | ||
| 815 | and thread in threads | ||
| 816 | do | ||
| 817 | (should-not (thread-join thread)) | ||
| 818 | (should-not (thread-last-error)) | ||
| 819 | (should (eq (process-status process) 'exit)) | ||
| 820 | (should (eql (process-exit-status process) 0))))))) | ||
| 821 | |||
| 822 | (defun process-tests--eval (command form) | ||
| 823 | "Return a command that evaluates FORM in an Emacs subprocess. | ||
| 824 | COMMAND must be a list returned by | ||
| 825 | `process-tests--emacs-command'." | ||
| 826 | (let ((print-gensym t) | ||
| 827 | (print-circle t) | ||
| 828 | (print-length nil) | ||
| 829 | (print-level nil) | ||
| 830 | (print-escape-control-characters t) | ||
| 831 | (print-escape-newlines t) | ||
| 832 | (print-escape-multibyte t) | ||
| 833 | (print-escape-nonascii t)) | ||
| 834 | `(,@command "--quick" "--batch" ,(format "--eval=%S" form)))) | ||
| 835 | |||
| 836 | (defun process-tests--emacs-command () | ||
| 837 | "Return a command to reinvoke the current Emacs instance. | ||
| 838 | Return nil if that doesn't appear to be possible." | ||
| 839 | (when-let ((binary (process-tests--emacs-binary)) | ||
| 840 | (dump (process-tests--dump-file))) | ||
| 841 | (cons binary | ||
| 842 | (unless (eq dump :not-needed) | ||
| 843 | (list (concat "--dump-file=" | ||
| 844 | (file-name-unquote dump))))))) | ||
| 845 | |||
| 846 | (defun process-tests--emacs-binary () | ||
| 847 | "Return the filename of the currently running Emacs binary. | ||
| 848 | Return nil if that can't be determined." | ||
| 849 | (and (stringp invocation-name) | ||
| 850 | (not (file-remote-p invocation-name)) | ||
| 851 | (not (file-name-absolute-p invocation-name)) | ||
| 852 | (stringp invocation-directory) | ||
| 853 | (not (file-remote-p invocation-directory)) | ||
| 854 | (file-name-absolute-p invocation-directory) | ||
| 855 | (when-let ((file (process-tests--usable-file-for-reinvoke | ||
| 856 | (expand-file-name invocation-name | ||
| 857 | invocation-directory)))) | ||
| 858 | (and (file-executable-p file) file)))) | ||
| 859 | |||
| 860 | (defun process-tests--dump-file () | ||
| 861 | "Return the filename of the dump file used to start Emacs. | ||
| 862 | Return nil if that can't be determined. Return `:not-needed' if | ||
| 863 | Emacs wasn't started with a dump file." | ||
| 864 | (if-let ((stats (and (fboundp 'pdumper-stats) (pdumper-stats)))) | ||
| 865 | (when-let ((file (process-tests--usable-file-for-reinvoke | ||
| 866 | (cdr (assq 'dump-file-name stats))))) | ||
| 867 | (and (file-readable-p file) file)) | ||
| 868 | :not-needed)) | ||
| 869 | |||
| 870 | (defun process-tests--usable-file-for-reinvoke (filename) | ||
| 871 | "Return a version of FILENAME that can be used to reinvoke Emacs. | ||
| 872 | Return nil if FILENAME doesn't exist." | ||
| 873 | (when (and (stringp filename) | ||
| 874 | (not (file-remote-p filename))) | ||
| 875 | (cl-callf file-truename filename) | ||
| 876 | (and (stringp filename) | ||
| 877 | (not (file-remote-p filename)) | ||
| 878 | (file-name-absolute-p filename) | ||
| 879 | (file-regular-p filename) | ||
| 880 | filename))) | ||
| 881 | |||
| 742 | (provide 'process-tests) | 882 | (provide 'process-tests) |
| 743 | ;;; process-tests.el ends here | 883 | ;;; process-tests.el ends here |
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el index ec96d777ffb..4e7d2ad8ab2 100644 --- a/test/src/xdisp-tests.el +++ b/test/src/xdisp-tests.el | |||
| @@ -75,31 +75,28 @@ | |||
| 75 | (ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748 | 75 | (ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748 |
| 76 | (with-temp-buffer | 76 | (with-temp-buffer |
| 77 | (insert "xxx") | 77 | (insert "xxx") |
| 78 | (let* ((window | 78 | (switch-to-buffer (current-buffer)) |
| 79 | (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) | 79 | (let* ((char-width (frame-char-width)) |
| 80 | (char-width (frame-char-width)) | 80 | (size (window-text-pixel-size nil t t)) |
| 81 | (size (window-text-pixel-size nil t t))) | 81 | (width-in-chars (/ (car size) char-width))) |
| 82 | (delete-frame (window-frame window)) | 82 | (should (equal width-in-chars 3))))) |
| 83 | (should (equal (/ (car size) char-width) 3))))) | ||
| 84 | 83 | ||
| 85 | (ert-deftest xdisp-tests--window-text-pixel-size-leading-space () ;; bug#45748 | 84 | (ert-deftest xdisp-tests--window-text-pixel-size-leading-space () ;; bug#45748 |
| 86 | (with-temp-buffer | 85 | (with-temp-buffer |
| 87 | (insert " xx") | 86 | (insert " xx") |
| 88 | (let* ((window | 87 | (switch-to-buffer (current-buffer)) |
| 89 | (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) | 88 | (let* ((char-width (frame-char-width)) |
| 90 | (char-width (frame-char-width)) | 89 | (size (window-text-pixel-size nil t t)) |
| 91 | (size (window-text-pixel-size nil t t))) | 90 | (width-in-chars (/ (car size) char-width))) |
| 92 | (delete-frame (window-frame window)) | 91 | (should (equal width-in-chars 3))))) |
| 93 | (should (equal (/ (car size) char-width) 3))))) | ||
| 94 | 92 | ||
| 95 | (ert-deftest xdisp-tests--window-text-pixel-size-trailing-space () ;; bug#45748 | 93 | (ert-deftest xdisp-tests--window-text-pixel-size-trailing-space () ;; bug#45748 |
| 96 | (with-temp-buffer | 94 | (with-temp-buffer |
| 97 | (insert "xx ") | 95 | (insert "xx ") |
| 98 | (let* ((window | 96 | (switch-to-buffer (current-buffer)) |
| 99 | (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) | 97 | (let* ((char-width (frame-char-width)) |
| 100 | (char-width (frame-char-width)) | 98 | (size (window-text-pixel-size nil t t)) |
| 101 | (size (window-text-pixel-size nil t t))) | 99 | (width-in-chars (/ (car size) char-width))) |
| 102 | (delete-frame (window-frame window)) | 100 | (should (equal width-in-chars 3))))) |
| 103 | (should (equal (/ (car size) char-width) 3))))) | ||
| 104 | 101 | ||
| 105 | ;;; xdisp-tests.el ends here | 102 | ;;; xdisp-tests.el ends here |