[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode b3e090e4e5: Fix warnings
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode b3e090e4e5: Fix warnings |
Date: |
Mon, 19 Sep 2022 02:59:12 -0400 (EDT) |
branch: elpa/swift-mode
commit b3e090e4e518334fcc5500e1981f6f1876b92a90
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <taku0@users.noreply.github.com>
Fix warnings
- Add an email address to Maintainer header for elpa.nongnu.org.
- Fix linter script to check dependency errors.
- Fix dependency errors and other warnings.
- Rename `test/swift-files/imenu/imenu-expected.el` to
`test/swift-files/imenu/imenu-expected.eld` since it only contains data
rather than code.
Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
---
Eldev | 3 +
scripts/lint_in_docker.sh | 2 +-
scripts/run_linter.sh | 5 +-
scripts/run_test.sh | 6 +-
scripts/test_in_docker.sh | 2 +-
swift-mode-beginning-of-defun.el | 2 +-
swift-mode-fill.el | 2 +-
swift-mode-font-lock.el | 57 ++++++-----------
swift-mode-imenu.el | 4 +-
swift-mode-indent.el | 22 +++----
swift-mode-lexer.el | 2 +-
swift-mode-repl.el | 45 ++++++-------
swift-mode.el | 7 ++-
.../{imenu-expected.el => imenu-expected.eld} | 0
test/swift-mode-test-beginning-of-defun.el | 73 +++++++++++-----------
test/swift-mode-test-fill.el | 23 +++----
test/swift-mode-test-font-lock.el | 5 +-
test/swift-mode-test-imenu.el | 3 +-
test/swift-mode-test-indent.el | 1 +
test/swift-mode-test.el | 26 ++++----
20 files changed, 133 insertions(+), 157 deletions(-)
diff --git a/Eldev b/Eldev
index 1b949408b1..c6edf601ab 100644
--- a/Eldev
+++ b/Eldev
@@ -2,6 +2,9 @@
(eldev-use-package-archive 'gnu)
(eldev-use-package-archive 'melpa)
+
+(eldev-add-loading-roots 'test "test")
+
(setq elisp-lint-indent-specs
'((swift-mode:with-temp-comment-buffer . 0)))
diff --git a/scripts/lint_in_docker.sh b/scripts/lint_in_docker.sh
index 9289ba5702..7f925d985d 100755
--- a/scripts/lint_in_docker.sh
+++ b/scripts/lint_in_docker.sh
@@ -4,7 +4,7 @@
for version in 28 27 26 25 24
do
- rm -f *.elc
+ rm -f *.elc test/*.elc
docker \
run \
--rm \
diff --git a/scripts/run_linter.sh b/scripts/run_linter.sh
index 78489f5a0b..73b708f21b 100755
--- a/scripts/run_linter.sh
+++ b/scripts/run_linter.sh
@@ -3,4 +3,7 @@
# Run linter. Used in Makefile.
./scripts/invoke_eldev.sh emacs --version || exit 1
-find ./*.el test/*.el '!' -name '*autoloads.el' -exec
./scripts/invoke_eldev.sh lint doc re elisp '{}' '+'
+find . -name '*.elc' -exec rm '{}' '+' || exit 1
+./scripts/invoke_eldev.sh compile --set=all
+find ./*.el test/*.el '!' -name '*autoloads.el' -exec \
+ ./scripts/invoke_eldev.sh lint doc re elisp '{}' '+'
diff --git a/scripts/run_test.sh b/scripts/run_test.sh
index f5abf89c83..3871c818e1 100755
--- a/scripts/run_test.sh
+++ b/scripts/run_test.sh
@@ -3,11 +3,7 @@
# Run tests. Used in Makefile.
./scripts/invoke_eldev.sh emacs --version || exit 1
-./scripts/invoke_eldev.sh emacs --batch -q \
- --eval "(add-to-list 'load-path \"$(readlink -f .)\")" \
- --eval "(add-to-list 'load-path \"$(readlink -f .)/test\")" \
- -f batch-byte-compile \
- ./*.el || exit 1
+./scripts/invoke_eldev.sh compile --set=all
./scripts/invoke_eldev.sh emacs --batch -q \
--eval "(add-to-list 'load-path \"$(readlink -f .)\")" \
--eval "(add-to-list 'load-path \"$(readlink -f .)/test\")" \
diff --git a/scripts/test_in_docker.sh b/scripts/test_in_docker.sh
index 17b6bd9cd0..4bd2155379 100755
--- a/scripts/test_in_docker.sh
+++ b/scripts/test_in_docker.sh
@@ -4,7 +4,7 @@
for version in 28 27 26 25 24
do
- rm -f *.elc
+ rm -f *.elc test/*.elc
rm -f *-autoloads.el
docker \
run \
diff --git a/swift-mode-beginning-of-defun.el b/swift-mode-beginning-of-defun.el
index 92a6c22162..40a76a6845 100644
--- a/swift-mode-beginning-of-defun.el
+++ b/swift-mode-beginning-of-defun.el
@@ -63,7 +63,7 @@ marks the `outer' function. Likewise, it marks `inner1' if
the preference is
(const :tag "Preceding" preceding)
(const :tag "Following" following))
:group 'swift
- :safe 'symbolp)
+ :safe #'symbolp)
(defvar swift-mode:last-mark-direction 'containing
"Last direction of `swift-mode:mark-generic-block'.")
diff --git a/swift-mode-fill.el b/swift-mode-fill.el
index 5d0c876873..afe90253bb 100644
--- a/swift-mode-fill.el
+++ b/swift-mode-fill.el
@@ -34,7 +34,7 @@
"When non-nil, `fill-paragraph' fills entire comment block or string."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
(defconst swift-mode:doc-comment-paragraph-start
(let* ((list-marker '(or (any ?- ?+ ?*) (seq (* (any "0-9")) (any ".)"))))
diff --git a/swift-mode-font-lock.el b/swift-mode-font-lock.el
index 15dcb4e652..afb7fc8b98 100644
--- a/swift-mode-font-lock.el
+++ b/swift-mode-font-lock.el
@@ -44,104 +44,85 @@
t
"Highlight symbols in the standard library."
:type 'boolean
- :group 'swift-mode:faces
- :safe 'booleanp)
+ :safe #'booleanp)
(defcustom swift-mode:highlight-symbols-in-foundation-framework
t
"Highlight symbols in the Foundation framework."
:type 'boolean
- :group 'swift-mode:faces
- :safe 'booleanp)
+ :safe #'booleanp)
(defface swift-mode:constant-keyword-face
'((t . (:inherit font-lock-constant-face)))
"Face for highlighting constant keywords.
-That is, true, false, and nil."
- :group 'swift-mode:faces)
+That is, true, false, and nil.")
(defface swift-mode:preprocessor-keyword-face
'((t . (:inherit font-lock-preprocessor-face)))
"Face for highlighting preprocessor keywords.
-Example: #if, #endif, and #selector."
- :group 'swift-mode:faces)
+Example: #if, #endif, and #selector.")
(defface swift-mode:keyword-face
'((t . (:inherit font-lock-keyword-face)))
- "Face for highlighting keywords."
- :group 'swift-mode:faces)
+ "Face for highlighting keywords.")
(defface swift-mode:builtin-method-trailing-closure-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin methods with trailing closure."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin methods with trailing closure.")
(defface swift-mode:builtin-method-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin methods."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin methods.")
(defface swift-mode:builtin-function-trailing-closure-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin functions with trailing closure."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin functions with trailing closure.")
(defface swift-mode:builtin-function-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin functions."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin functions.")
(defface swift-mode:builtin-property-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin properties."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin properties.")
(defface swift-mode:builtin-constant-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin constants."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin constants.")
(defface swift-mode:builtin-enum-case-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin enum cases."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin enum cases.")
(defface swift-mode:build-config-keyword-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting build configuration keywords."
- :group 'swift-mode:faces)
+ "Face for highlighting build configuration keywords.")
(defface swift-mode:builtin-type-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin types."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin types.")
(defface swift-mode:builtin-precedence-group-face
'((t . (:inherit font-lock-builtin-face)))
- "Face for highlighting builtin precedence groups."
- :group 'swift-mode:faces)
+ "Face for highlighting builtin precedence groups.")
(defface swift-mode:function-call-face
'((t . (:inherit font-lock-function-name-face)))
- "Face for highlighting function calls."
- :group 'swift-mode:faces)
+ "Face for highlighting function calls.")
(defface swift-mode:function-name-face
'((t . (:inherit font-lock-function-name-face)))
- "Face for highlighting function names."
- :group 'swift-mode:faces)
+ "Face for highlighting function names.")
(defface swift-mode:property-access-face
'((t . (:inherit font-lock-variable-name-face)))
- "Face for highlighting property accesses."
- :group 'swift-mode:faces)
+ "Face for highlighting property accesses.")
(defface swift-mode:negation-char-face
'((t . (:inherit font-lock-negation-char-face)))
- "Face for highlighting the negation char."
- :group 'swift-mode:faces)
+ "Face for highlighting the negation char.")
(defun swift-mode:make-set (list)
"Return a hash where its keys are elements of the LIST.
diff --git a/swift-mode-imenu.el b/swift-mode-imenu.el
index b5fa19f6e6..643f16bd87 100644
--- a/swift-mode-imenu.el
+++ b/swift-mode-imenu.el
@@ -26,6 +26,7 @@
;;; Code:
(require 'swift-mode-lexer)
+(require 'swift-mode-indent)
(require 'seq)
;;;###autoload
@@ -43,8 +44,7 @@ Values:
- `flat': Organized into a flat list of fully qualified names."
:type '(choice (const :tag "Nested" nested)
(const :tag "Flat" flat))
- :group 'swift-mode:imenu
- :safe 'symbolp)
+ :safe #'symbolp)
(defun swift-mode:declaration (type name-token children)
"Construct and return a declaration.
diff --git a/swift-mode-indent.el b/swift-mode-indent.el
index 82c9128a93..96c8015114 100644
--- a/swift-mode-indent.el
+++ b/swift-mode-indent.el
@@ -37,55 +37,55 @@
"Amount of indentation for block contents."
:type 'integer
:group 'swift
- :safe 'integerp)
+ :safe #'integerp)
(defcustom swift-mode:parenthesized-expression-offset 2
"Amount of indentation inside parentheses and square brackets."
:type 'integer
:group 'swift
- :safe 'integerp)
+ :safe #'integerp)
(defcustom swift-mode:multiline-statement-offset 2
"Amount of indentation for continuations of expressions."
:type 'integer
:group 'swift
- :safe 'integerp)
+ :safe #'integerp)
(defcustom swift-mode:switch-case-offset 0
"Amount of indentation for case labels in switch statements."
:type 'integer
:group 'swift
- :safe 'integerp)
+ :safe #'integerp)
(defcustom swift-mode:prepend-asterisk-to-comment-line nil
"Automatically insert a asterisk to each comment line if non-nil."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
(defcustom swift-mode:insert-space-after-asterisk-in-comment t
"Automatically insert a space after asterisk in comment if non-nil."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
(defcustom swift-mode:auto-close-multiline-comment t
"If non-nil, `indent-new-comment-line' automatically close multiline
comment."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
(defcustom swift-mode:fix-comment-close t
"Fix \"* /\" in incomplete multiline comment to \"*/\" if non-nil."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
(defcustom swift-mode:break-line-before-comment-close t
"If non-nil, break line before the closing delimiter of multiline comments."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
(defcustom swift-mode:highlight-anchor nil
"Highlight anchor point for indentation if non-nil.
@@ -93,7 +93,7 @@
Intended for debugging."
:type 'boolean
:group 'swift
- :safe 'booleanp)
+ :safe #'booleanp)
;;; Constants and variables
@@ -1300,7 +1300,7 @@ all tokens.
STOP-AT-BOL-TOKEN-TYPES is a list of token types that if we hit
the beginning of a line just before a token with one of given token types,
the function returns. Typically, this is a list of token types that starts
-list element (e.g. 'case' of switch statement body). If
STOP-AT-BOL-TOKEN-TYPES
+list element (e.g. `case' of switch statement body). If
STOP-AT-BOL-TOKEN-TYPES
is the symbol `any', it matches all tokens."
(let*
((parent (swift-mode:backward-token-or-list))
diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index f5a4989e1c..f22916f5a8 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -925,7 +925,7 @@ Return nil otherwise."
(setq swift-mode:in-recursive-call-of-case-colon-p nil)))))
(defun swift-mode:anonymous-parameter-in-p ()
- "Return t if a 'in' token at the cursor is for anonymous function
parameters."
+ "Return t if a `in' token at the cursor is for anonymous function
parameters."
(save-excursion
(eq
;; FIXME: mutual dependency
diff --git a/swift-mode-repl.el b/swift-mode-repl.el
index 92bee3632e..2f4fa7ebde 100644
--- a/swift-mode-repl.el
+++ b/swift-mode-repl.el
@@ -47,32 +47,28 @@
"Path to the Swift CLI. The string is split by spaces, then unquoted."
:tag "Swift Mode REPL Executable"
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:swift-package-executable
(concat (when (executable-find "xcrun") "xcrun ") "swift package")
"Path to the Swift command for package manipulation.
The string is split by spaces, then unquoted."
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:swift-build-executable
(concat (when (executable-find "xcrun") "xcrun ") "swift build")
"Path to the Swift command for building.
The string is split by spaces, then unquoted."
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:debugger-executable
(concat (when (executable-find "xcrun") "xcrun ") "lldb")
"Path to the debugger command.
The string is split by spaces, then unquoted."
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:ios-deploy-executable
"ios-deploy"
@@ -80,38 +76,33 @@ The string is split by spaces, then unquoted."
The string is split by spaces, then unquoted."
:tag "Swift Mode iOS Deploy Executable"
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:simulator-controller-executable
(concat (when (executable-find "xcrun") "xcrun ") "simctl")
"Path to the simulator controller command.
The string is split by spaces, then unquoted."
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:xcodebuild-executable
(concat (when (executable-find "xcrun") "xcrun ") "xcodebuild")
"Path to the Xcode builder.
The string is split by spaces, then unquoted."
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:xcode-select-executable
"xcode-select"
"Path to the Xcode selector.
The string is split by spaces, then unquoted."
:type '(choice string (list string))
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defcustom swift-mode:debugger-prompt-regexp "^(lldb) +\\|^[0-9]+> +"
"Regexp to search a debugger prompt."
:type 'string
- :group 'swift-mode:repl
- :safe 'stringp)
+ :safe #'stringp)
(defvar swift-mode:repl-buffer nil
"Stores the name of the current swift REPL buffer, or nil.")
@@ -187,7 +178,7 @@ Runs the hook `swift-repl-mode-hook' \(after the
`comint-mode-hook' is run).
(swift-repl-mode)
(setq-local swift-mode:repl-buffer buffer))
(unless (comint-check-proc buffer)
- (apply 'make-comint-in-buffer
+ (apply #'make-comint-in-buffer
cmd-string buffer (car cmd-list) nil (cdr cmd-list))
(with-current-buffer buffer
(while (= old-size (buffer-size))
@@ -196,7 +187,7 @@ Runs the hook `swift-repl-mode-hook' \(after the
`comint-mode-hook' is run).
(pop-to-buffer buffer))))
;;;###autoload
-(defalias 'run-swift 'swift-mode:run-repl)
+(defalias 'run-swift #'swift-mode:run-repl)
;;;###autoload
(defun swift-mode:send-region (start end)
@@ -254,7 +245,7 @@ ARGS are rest arguments, appended to the argument list.
Returns the exit status."
(let ((command-list
(append (swift-mode:command-string-to-list executable) args)))
- (apply 'call-process
+ (apply #'call-process
(append
(list (car command-list))
(list infile destination display)
@@ -432,7 +423,7 @@ or its ancestors."
"List available iOS simulator devices."
(let* ((json (swift-mode:list-ios-simulators))
(devices (cdr (assoc 'devices json)))
- (flattened (apply 'seq-concatenate 'list (seq-map 'cdr devices)))
+ (flattened (apply #'seq-concatenate 'list (seq-map #'cdr devices)))
(available-devices
(seq-filter
(lambda (device) (cdr (assoc 'isAvailable device)))
@@ -553,7 +544,7 @@ An list ARGS are appended for builder command line
arguments."
(let ((progress-reporter (make-progress-reporter "Building...")))
(unless
(zerop
- (apply 'swift-mode:call-process
+ (apply #'swift-mode:call-process
swift-mode:swift-build-executable
"--package-path" project-directory
args))
@@ -627,7 +618,7 @@ the value of `swift-mode:ios-project-scheme' is used."
(unless
(zerop
(let ((default-directory project-directory))
- (apply 'swift-mode:call-process xcodebuild-args)))
+ (apply #'swift-mode:call-process xcodebuild-args)))
(compilation-mode)
(goto-char (point-min))
(pop-to-buffer (current-buffer))
@@ -662,7 +653,7 @@ STRING is passed to the command."
(comint-send-input))
(unless swift-mode:repl-command-queue
(remove-hook 'comint-output-filter-functions
- 'swift-mode:wait-for-prompt-then-execute-commands t)))))
+ #'swift-mode:wait-for-prompt-then-execute-commands t)))))
(defun swift-mode:enqueue-repl-commands (&rest commands)
"Enqueue COMMANDS to be executed on REPL."
@@ -670,7 +661,7 @@ STRING is passed to the command."
(setq-local swift-mode:repl-command-queue
(append swift-mode:repl-command-queue commands))
(add-hook 'comint-output-filter-functions
- 'swift-mode:wait-for-prompt-then-execute-commands
+ #'swift-mode:wait-for-prompt-then-execute-commands
nil t)))
(defun swift-mode:debug-swift-module-library (project-directory)
@@ -787,7 +778,7 @@ If WAIT-FOR-DEBUGGER is non-nil, the new process is
suspended until a debugger
attaches to it."
(with-temp-buffer
(unless (zerop (apply
- 'swift-mode:call-process
+ #'swift-mode:call-process
swift-mode:simulator-controller-executable
(append
'("launch")
diff --git a/swift-mode.el b/swift-mode.el
index 80631f9bb8..e9d43966bb 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -3,10 +3,11 @@
;; Copyright (C) 2014-2021 taku0, Chris Barrett, Bozhidar Batsov,
;; Arthur Evstifeev
-;; Author: taku0 (http://github.com/taku0)
+;; Author: taku0 <mxxouy6x3m_github@tatapa.org>
;; Chris Barrett <chris.d.barrett@me.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
;; Arthur Evstifeev <lod@pisem.net>
+;; Maintainer: taku0 <mxxouy6x3m_github@tatapa.org>
;;
;; Version: 8.6.0
;; Package-Requires: ((emacs "24.4") (seq "2.3"))
@@ -48,7 +49,9 @@
:group 'languages
:prefix "swift-mode:")
-;;;`update-directory-autoloads' does not handle `:group'.
+;; FIXME: Could you report the need for these `custom-add-load' as a bug (or
+;; a feature request, but both go through `report-emacs-bug' anyway).
+;;`update-directory-autoloads' does not handle `:group'.
;;;###autoload (custom-add-load 'languages 'swift-mode)
;; WORKAROUND: `cus-load' overrides `custom-loads'
diff --git a/test/swift-files/imenu/imenu-expected.el
b/test/swift-files/imenu/imenu-expected.eld
similarity index 100%
rename from test/swift-files/imenu/imenu-expected.el
rename to test/swift-files/imenu/imenu-expected.eld
diff --git a/test/swift-mode-test-beginning-of-defun.el
b/test/swift-mode-test-beginning-of-defun.el
index 4eccf1d17d..d63478cb86 100644
--- a/test/swift-mode-test-beginning-of-defun.el
+++ b/test/swift-mode-test-beginning-of-defun.el
@@ -28,6 +28,7 @@
;;; Code:
(require 'swift-mode)
+(require 'swift-mode-test)
(require 'swift-mode-beginning-of-defun)
(require 'seq)
@@ -159,45 +160,45 @@ respectively, in the test file, and removed from the
buffer.
(setq match-end (match-end 0))
(cond
((equal match-string "/*{*/")
- (add-to-list 'expected-positions
- (list 'beginning-of-defun
- match-beginning match-beginning
- depth depth))
+ (push (list 'beginning-of-defun
+ match-beginning match-beginning
+ depth depth)
+ expected-positions)
(replace-match ""))
((equal match-string "/*}*/")
- (add-to-list 'expected-positions
- (list 'end-of-defun
- match-beginning match-beginning
- depth depth))
+ (push (list 'end-of-defun
+ match-beginning match-beginning
+ depth depth)
+ expected-positions)
(replace-match ""))
((equal match-string "/*[*/")
- (add-to-list 'expected-positions
- (list 'beginning-of-sentence
- match-beginning match-beginning
- depth depth))
+ (push (list 'beginning-of-sentence
+ match-beginning match-beginning
+ depth depth)
+ expected-positions)
(replace-match ""))
((equal match-string "/*]*/")
- (add-to-list 'expected-positions
- (list 'end-of-sentence
- match-beginning match-beginning
- depth depth))
+ (push (list 'end-of-sentence
+ match-beginning match-beginning
+ depth depth)
+ expected-positions)
(replace-match ""))
((and (member match-string '("{" "[" "(" "/*"))
(not (swift-mode:chunk-after match-beginning)))
(setq depth (1+ depth))
- (add-to-list 'expected-positions
- (list '{ match-beginning match-end (1- depth) depth)))
+ (push (list '{ match-beginning match-end (1- depth) depth)
+ expected-positions))
((and (member match-string '("}" "]" ")" "*/"))
(not (swift-mode:chunk-after match-end)))
(setq depth (1- depth))
- (add-to-list 'expected-positions
- (list '} match-beginning match-end (1+ depth) depth)))
+ (push (list '} match-beginning match-end (1+ depth) depth)
+ expected-positions))
((and (equal match-string "//")
(not (swift-mode:chunk-after match-beginning)))
(setq depth (1+ depth))
- (add-to-list 'expected-positions
- (list '{ match-beginning match-end (1- depth) depth)))
+ (push (list '{ match-beginning match-end (1- depth) depth)
+ expected-positions))
((and (equal match-string "\n")
(eq (swift-mode:chunk:type
(swift-mode:chunk-after match-beginning))
@@ -206,8 +207,8 @@ respectively, in the test file, and removed from the buffer.
;; Fuses with next line.
(goto-char (match-end 0))
(setq depth (1- depth))
- (add-to-list 'expected-positions
- (list '} match-beginning match-end (1+ depth)
depth))))
+ (push (list '} match-beginning match-end (1+ depth) depth)
+ expected-positions)))
((and (equal match-string "\"\"\"")
(not (eq (char-before match-beginning) ?\\))
(not (swift-mode:chunk:comment-p
@@ -215,13 +216,11 @@ respectively, in the test file, and removed from the
buffer.
(if (swift-mode:chunk:multiline-string-p
(swift-mode:chunk-after match-end))
(progn (setq depth (1+ depth))
- (add-to-list
- 'expected-positions
- (list '{ match-beginning match-end (1- depth) depth)))
+ (push (list '{ match-beginning match-end (1- depth) depth)
+ expected-positions))
(setq depth (1- depth))
- (add-to-list
- 'expected-positions
- (list '} match-beginning match-end (1+ depth) depth))))
+ (push (list '} match-beginning match-end (1+ depth) depth)
+ expected-positions)))
((and (equal match-string "\"")
(not (eq (char-before match-beginning) ?\\))
(not (swift-mode:chunk:comment-p
@@ -231,16 +230,14 @@ respectively, in the test file, and removed from the
buffer.
(if (swift-mode:chunk:single-line-string-p
(swift-mode:chunk-after match-end))
(progn (setq depth (1+ depth))
- (add-to-list
- 'expected-positions
- (list '{ match-beginning match-end (1- depth) depth)))
+ (push (list '{ match-beginning match-end (1- depth) depth)
+ expected-positions))
(setq depth (1- depth))
- (add-to-list
- 'expected-positions
- (list '} match-beginning match-end (1+ depth) depth))))))
+ (push (list '} match-beginning match-end (1+ depth) depth)
+ expected-positions)))))
(goto-char (point-max))
- (add-to-list 'expected-positions
- (list 'end-of-defun (point) (point) depth depth))
+ (push (list 'end-of-defun (point) (point) depth depth)
+ expected-positions)
expected-positions)))
(defun swift-mode:test-current-line-beginning-of-defun
diff --git a/test/swift-mode-test-fill.el b/test/swift-mode-test-fill.el
index e53e441855..5efd824d96 100644
--- a/test/swift-mode-test-fill.el
+++ b/test/swift-mode-test-fill.el
@@ -27,6 +27,7 @@
;;; Code:
(require 'swift-mode)
+(require 'swift-mode-test)
(require 'swift-mode-fill)
(require 'diff)
@@ -142,8 +143,8 @@ See `swift-mode:run-test:fill' for ERROR-BUFFER and
ERROR-COUNTS."
(defun swift-mode:do-test-fill-region-as-paragraph
(input
expected
- fill-column
- comment-fill-column
+ fill-column-for-test
+ comment-fill-column-for-test
error-buffer
error-counts)
"Run a test for `fill-region-as-paragraph'.
@@ -152,7 +153,8 @@ INPUT is a text before filling.
EXPECTED is the expected result.
-FILL-COLUMN and COMMENT-FILL-COLUMN is used for respective dynamic variables.
+FILL-COLUMN-FOR-TEST and COMMENT-FILL-COLUMN-FOR-TEST is used for `fill-column'
+and `comment-fill-column' respectively.
See `swift-mode:run-test:fill' for ERROR-BUFFER and ERROR-COUNTS."
(with-temp-buffer
@@ -160,8 +162,8 @@ See `swift-mode:run-test:fill' for ERROR-BUFFER and
ERROR-COUNTS."
(insert input)
(swift-mode)
(syntax-propertize (point-max))
- (let ((fill-column fill-column)
- (comment-fill-column comment-fill-column))
+ (let ((fill-column fill-column-for-test)
+ (comment-fill-column comment-fill-column-for-test))
(fill-region-as-paragraph (point-min) (point-max)))
(let* ((status (if (equal (buffer-string) expected)
'ok
@@ -180,15 +182,15 @@ See `swift-mode:run-test:fill' for ERROR-BUFFER and
ERROR-COUNTS."
The result is list of elements, which is one of:
-- non-paragraph line, (list 'literal STRING), where STRING is the line
+- non-paragraph line, (literal STRING), where STRING is the line
excluding a line break,
-- paragraph, (list 'paragraph PREFIX BLOCK-BOUNDARY-TYPE), where PREFIX is the
+- paragraph, (paragraph PREFIX BLOCK-BOUNDARY-TYPE), where PREFIX is the
fill prefix and BLOCK-BOUNDARY-TYPE is either nil, `start', or `end', or
-- list item, (list 'list-item PREFIX).
+- list item, (list-item PREFIX).
-- heading, (list 'heading PREFIX)."
+- heading, (heading PREFIX)."
(save-excursion
(goto-char (point-min))
(let ((result ()))
@@ -233,8 +235,7 @@ If it is `join' test joining short lines.
See `swift-mode:run-test:fill' for ERROR-BUFFER and ERROR-COUNTS."
(let (regions
expected
- actual
- start)
+ actual)
(with-temp-buffer
(switch-to-buffer (current-buffer))
(swift-mode)
diff --git a/test/swift-mode-test-font-lock.el
b/test/swift-mode-test-font-lock.el
index a777adabb6..a7522b1a6a 100644
--- a/test/swift-mode-test-font-lock.el
+++ b/test/swift-mode-test-font-lock.el
@@ -27,6 +27,7 @@
;;; Code:
(require 'swift-mode)
+(require 'swift-mode-test)
(require 'swift-mode-font-lock)
(defun swift-mode:run-test:font-lock
@@ -52,7 +53,9 @@ PROGRESS-REPORTER is the progress-reporter."
(switch-to-buffer (current-buffer))
(insert-file-contents-literally swift-file)
(swift-mode)
- (font-lock-fontify-buffer)
+ (funcall (if (fboundp 'font-lock-ensure)
+ #'font-lock-ensure
+ #'font-lock-fontify-buffer))
(setq current-line 0)
(while (not (eobp))
(when (not noninteractive)
diff --git a/test/swift-mode-test-imenu.el b/test/swift-mode-test-imenu.el
index 753b664350..20bfe5f2d2 100644
--- a/test/swift-mode-test-imenu.el
+++ b/test/swift-mode-test-imenu.el
@@ -27,6 +27,7 @@
;;; Code:
(require 'swift-mode)
+(require 'swift-mode-test)
(require 'swift-mode-imenu)
(defun swift-mode:run-test:imenu
@@ -53,7 +54,7 @@ PROGRESS-REPORTER is the progress-reporter."
(let* ((actual (swift-mode:scan-declarations))
(expected-file-name (concat
(file-name-sans-extension swift-file)
- "-expected.el"))
+ "-expected.eld"))
(expected
(with-temp-buffer
(insert-file-contents-literally expected-file-name)
diff --git a/test/swift-mode-test-indent.el b/test/swift-mode-test-indent.el
index 686e38c8d4..963df10bc6 100644
--- a/test/swift-mode-test-indent.el
+++ b/test/swift-mode-test-indent.el
@@ -27,6 +27,7 @@
;;; Code:
(require 'swift-mode)
+(require 'swift-mode-test)
(require 'swift-mode-indent)
(defun swift-mode:run-test:indent
diff --git a/test/swift-mode-test.el b/test/swift-mode-test.el
index f7ddffa8a7..ac9fd7dd66 100644
--- a/test/swift-mode-test.el
+++ b/test/swift-mode-test.el
@@ -26,14 +26,9 @@
;;; Code:
-(require 'swift-mode-test-indent)
-(require 'swift-mode-test-beginning-of-defun)
-(require 'swift-mode-test-imenu)
-(require 'swift-mode-test-font-lock)
-(require 'swift-mode-test-fill)
-
(defvar swift-mode:test:basedir
- (file-name-directory (or load-file-name buffer-file-name)))
+ (file-name-directory (if (fboundp 'macroexp-file-name) (macroexp-file-name)
+ (or load-file-name buffer-file-name))))
(defvar swift-mode:test:running nil)
@@ -47,18 +42,19 @@ Return the error-buffer"
(erase-buffer)
(current-buffer))
-(defvar swift-mode:tests
- '(swift-mode:run-test:indent
- swift-mode:run-test:beginning-of-defun
- swift-mode:run-test:imenu
- swift-mode:run-test:font-lock
- swift-mode:run-test:fill))
-
(defun swift-mode:run-test (&optional tests)
"Run TESTS for `swift-mode'."
(interactive)
- (setq tests (or tests swift-mode:tests))
+ (unless tests
+ (dolist (test-source (directory-files swift-mode:test:basedir
+ t "swift-mode-test-.*.el"))
+ (load (file-name-sans-extension test-source) nil 'nomsg))
+ (mapatoms (lambda (sym)
+ (and (fboundp sym)
+ (string-match "\\`swift-mode:run-test:"
+ (symbol-name sym))
+ (push sym tests)))))
(let ((error-buffer
(if noninteractive nil (swift-mode:setup-error-buffer)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/swift-mode b3e090e4e5: Fix warnings,
ELPA Syncer <=