Make surface rules token-aware

This commit is contained in:
2026-04-04 16:11:46 +02:00
parent bd89fb476e
commit 8488cab0ac
4 changed files with 197 additions and 98 deletions

View File

@@ -140,6 +140,28 @@
diags))))
(delete-file tmp)))
(test-group "lint-file-token-aware-no-tabs"
(let ((tmp (tmpnam)))
(call-with-output-file tmp
(lambda (p)
(display "#| block\tcomment |#\n" p)))
(let ((diags (lint-file tmp '((%pass . surface)))))
(test-assert "tab in block comment ignored"
(not (any (lambda (d) (eq? (diagnostic-rule d) 'no-tabs))
diags))))
(delete-file tmp)))
(test-group "lint-file-token-aware-comment-semantics"
(let ((tmp (tmpnam)))
(call-with-output-file tmp
(lambda (p)
(display "(display \"hello\n; not a comment\nworld\")\n" p)))
(let ((diags (lint-file tmp '((%pass . surface)))))
(test-assert "semicolon inside multiline string ignored"
(not (any (lambda (d) (eq? (diagnostic-rule d) 'comment-semicolons))
diags))))
(delete-file tmp)))
;;; Fix mode
(test-group "fix-trailing-whitespace"