Skip to content

Commit

Permalink
Update the regular expression for core types.
Browse files Browse the repository at this point in the history
* rbs-mode.el (rbs-mode--core-type-regexp): Add word end pattern at the end of
this regular expression.
* rbs-mode-test.el: Add regression tests.
* Makefile (check): Add task to run ERT.
* CHANGELOG.md: Add change log entry.
* .editorconfig: Add a rule for the Makefile.
  • Loading branch information
gemmaro committed Aug 4, 2024
1 parent 69af306 commit f4a0c53
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ charset = utf-8
indent_style = space
indent_size = 2
max_line_length = 100

[Makefile]
indent_style = tab
indent_size = 8
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
check:
emacs --batch \
--load ert \
--load rbs-mode.el \
--load rbs-mode-test.el \
--funcall ert-run-tests-batch-and-exit
.PHONY: check
27 changes: 27 additions & 0 deletions rbs-mode-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
;;; rbs-mode-test --- rbs-mode tests

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

"Version:" or "Package-Version:" header is missing. MELPA will handle this, but other archives will not.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

Package should have a ;;; Commentary section.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

Package should have a Homepage or URL header.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

package.el cannot parse this buffer: Package lacks a file header

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

You should have a section marked ";;; Commentary:"

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

"Version:" or "Package-Version:" header is missing. MELPA will handle this, but other archives will not.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

Package should have a ;;; Commentary section.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

Package should have a Homepage or URL header.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

package.el cannot parse this buffer: Package lacks a file header

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

You should have a section marked ";;; Commentary:"

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

"Version:" or "Package-Version:" header is missing. MELPA will handle this, but other archives will not.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

Package should have a ;;; Commentary section.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

Package should have a Homepage or URL header.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

package.el cannot parse this buffer: Package lacks a file header

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

You should have a section marked ";;; Commentary:"

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

"Version:" or "Package-Version:" header is missing. MELPA will handle this, but other archives will not.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

Package should have a ;;; Commentary section.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

Package should have a Homepage or URL header.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

package.el cannot parse this buffer: Package lacks a file header

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

You should have a section marked ";;; Commentary:"

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

"Version:" or "Package-Version:" header is missing. MELPA will handle this, but other archives will not.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

Package should have a ;;; Commentary section.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

Package should have a Homepage or URL header.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

package.el cannot parse this buffer: Package lacks a file header

Check warning on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

"Version:" or "Package-Version:" header is missing. MELPA will handle this, but other archives will not.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

Package should have a ;;; Commentary section.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

Package should have a Homepage or URL header.

Check failure on line 1 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

package.el cannot parse this buffer: Package lacks a file header

;; 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 <https://www.gnu.org/licenses/>.

;;; Code:

(defvar rbs-mode--core-type-regexp)

(ert-deftest string-is-core-type ()

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

"string-is-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

"string-is-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

"string-is-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

"string-is-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

"string-is-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 20 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

You should depend on (emacs "24.1") if you need `ert-deftest'.
(should (string-match rbs-mode--core-type-regexp "String")))

Check failure on line 21 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 21 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 21 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 21 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 21 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 21 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

You should depend on (emacs "24.1") if you need `should'.

(ert-deftest string-scanner-is-not-core-type ()

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

"string-scanner-is-not-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

"string-scanner-is-not-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

"string-scanner-is-not-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

"string-scanner-is-not-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

You should depend on (emacs "24.1") if you need `ert-deftest'.

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

"string-scanner-is-not-core-type" doesn't start with package's prefix "rbs-mode-test".

Check failure on line 23 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

You should depend on (emacs "24.1") if you need `ert-deftest'.
(should (eql nil (string-match rbs-mode--core-type-regexp "StringScanner"))))

Check failure on line 24 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (26.3)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 24 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (25.3)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 24 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (24.5)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 24 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (27.2)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 24 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (28.2)

You should depend on (emacs "24.1") if you need `should'.

Check failure on line 24 in rbs-mode-test.el

View workflow job for this annotation

GitHub Actions / lint (29.3)

You should depend on (emacs "24.1") if you need `should'.

(provide 'rbs-mode-test)
;;; rbs-mode-test.el ends here.
3 changes: 2 additions & 1 deletion rbs-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@
"_ToPath"
"_ToProc"
"_ToS"
"_ToStr"))))
"_ToStr"))
word-end))

(defconst rbs-mode--type-definition-regexp
(rx
Expand Down

0 comments on commit f4a0c53

Please sign in to comment.