From 600afb5deea8c2b3e664b2a824ae82cd39334c80 Mon Sep 17 00:00:00 2001 From: gemmaro Date: Mon, 5 Aug 2024 12:07:23 +0900 Subject: [PATCH 1/3] Update the regular expression for core types. * rbs-mode.el (rbs-mode--core-type-regexp): Add word end pattern at the end of this regular expression. * CHANGELOG.md: Add a change log entry. --- CHANGELOG.md | 3 +++ rbs-mode.el | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e125767..d393380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Next version +- Fix the regular expression for core types. `StringScanner` is now ignored as a core type rather + than `String` plus `Scanner`, for instance. + ## 0.3.1 (2021-04-30) - Update the incorrect `Version` field. diff --git a/rbs-mode.el b/rbs-mode.el index e24b919..98c2566 100644 --- a/rbs-mode.el +++ b/rbs-mode.el @@ -209,7 +209,8 @@ "_ToPath" "_ToProc" "_ToS" - "_ToStr")))) + "_ToStr")) + word-end)) (defconst rbs-mode--type-definition-regexp (rx From 4f85133011fe72e7ccdc44015b1645e4aede1930 Mon Sep 17 00:00:00 2001 From: gemmaro Date: Mon, 5 Aug 2024 12:08:04 +0900 Subject: [PATCH 2/3] Add regression tests for core type regexp. * rbs-mode-test.el: Add regression tests for core type regexp. * .github/workflows/test.yml: Add GitHub Actions settings for ERT [1]. The first elisp-check is for linting source [2]. [1] https://github.com/leotaku/elisp-check#tests [2] https://github.com/leotaku/elisp-check/blob/b931bcc80dbd7e6dd8b3fa05fecd899025bcb811/index.js#L14-L25 Co-authored-by: Masafumi Koba --- .github/workflows/test.yml | 6 ++++++ rbs-mode-test.el | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 rbs-mode-test.el diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9da356e..26ee166 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,3 +25,9 @@ jobs: with: version: ${{ matrix.emacs-version }} - uses: leotaku/elisp-check@6a1fc6b11ae66dda13859f8b3474a36dfe3ef225 + with: + file: rbs-mode.el + - uses: leotaku/elisp-check@6a1fc6b11ae66dda13859f8b3474a36dfe3ef225 + with: + check: ert + file: rbs-mode-test.el diff --git a/rbs-mode-test.el b/rbs-mode-test.el new file mode 100644 index 0000000..01bf0e4 --- /dev/null +++ b/rbs-mode-test.el @@ -0,0 +1,29 @@ +;;; rbs-mode-test --- rbs-mode tests + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(load (concat default-directory "rbs-mode.el")) + +(defvar rbs-mode--core-type-regexp) + +(ert-deftest string-is-core-type () + (should (string-match rbs-mode--core-type-regexp "String"))) + +(ert-deftest string-scanner-is-not-core-type () + (should (eql nil (string-match rbs-mode--core-type-regexp "StringScanner")))) + +(provide 'rbs-mode-test) +;;; rbs-mode-test.el ends here. From 42da3e52805c1f23714f055034949e16bf8ab612 Mon Sep 17 00:00:00 2001 From: gemmaro Date: Mon, 5 Aug 2024 12:08:42 +0900 Subject: [PATCH 3/3] Add Makefile check task. * Makefile (check): Add a task. * .editorconfig: Add EditorConfig settings for Makefile. --- .editorconfig | 4 ++++ Makefile | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 Makefile diff --git a/.editorconfig b/.editorconfig index b560564..2cc172b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,7 @@ charset = utf-8 indent_style = space indent_size = 2 max_line_length = 100 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2d14cb5 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +check: + emacs --batch \ + --load ert \ + --load rbs-mode-test.el \ + --funcall ert-run-tests-batch-and-exit +.PHONY: check