Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regular expression for core types and add test #13

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ jobs:
with:
version: ${{ matrix.emacs-version }}
- uses: leotaku/elisp-check@6a1fc6b11ae66dda13859f8b3474a36dfe3ef225
gemmaro marked this conversation as resolved.
Show resolved Hide resolved
with:
file: rbs-mode.el
- uses: leotaku/elisp-check@6a1fc6b11ae66dda13859f8b3474a36dfe3ef225
with:
check: ert
file: rbs-mode-test.el
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
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
check:
emacs --batch \
--load ert \
--load rbs-mode-test.el \
--funcall ert-run-tests-batch-and-exit
.PHONY: check
29 changes: 29 additions & 0 deletions rbs-mode-test.el
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

;;; 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.
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 Expand Up @@ -296,3 +297,3 @@

(provide 'rbs-mode)
;;; rbs-mode.el ends here