;;; Tests for (gulie suppression) (use-modules (srfi srfi-64) (gulie suppression) (gulie diagnostic)) (test-begin "suppression") (test-group "parse-inline-suppress" (let ((supps (parse-suppressions "(define x 1) ; gulie:suppress trailing-whitespace\n"))) (test-equal "one suppression" 1 (length supps)) (test-equal "this-line kind" 'this-line (caddr (car supps))))) (test-group "parse-next-line-suppress" (let ((supps (parse-suppressions ";; gulie:suppress line-length\n(define x 1)\n"))) (test-equal "one suppression" 1 (length supps)) (test-equal "targets line 2" 2 (car (car supps))))) (test-group "parse-suppress-all" (let ((supps (parse-suppressions "(define x 1) ; gulie:suppress\n"))) (test-equal "one suppression" 1 (length supps)) (test-eq "all rules" #t (cadr (car supps))))) (test-group "filter-diagnostics" (let ((diags (list (make-diagnostic "f.scm" 1 0 'warning 'trailing-whitespace "tw" #f) (make-diagnostic "f.scm" 2 0 'warning 'line-length "ll" #f))) (supps (parse-suppressions "(define x 1) ; gulie:suppress trailing-whitespace\n(define y 2)\n"))) (let ((filtered (filter-suppressions diags supps))) (test-equal "one diagnostic filtered" 1 (length filtered)) (test-eq "remaining is line-length" 'line-length (diagnostic-rule (car filtered)))))) (test-group "region-suppression" (let ((supps (parse-suppressions ";; gulie:disable line-length\n(define x 1)\n(define y 2)\n;; gulie:enable line-length\n(define z 3)\n"))) ;; Should have region-start and region-end (test-assert "has region entries" (>= (length supps) 2)))) (test-end "suppression")