On 2022-11-05, Ludovic Courtès wrote: > Vagrant Cascadian skribis: >> From bfa13fdd3616839883e50efbbc05fb132610ce67 Mon Sep 17 00:00:00 2001 >> From: Vagrant Cascadian >> Date: Wed, 2 Nov 2022 19:56:12 -0700 >> Subject: [PATCH 01/12] guix: lint: Exclude some "@" symbols from various >> checks. >> >> The visual representation of "@code{}" or similar in the description and >> synopsis do not include the string, so exclude it from checks to avoid false >> positives. >> >> FIXME handle @command, @file, @acronym, etc. >> >> * guix/linx.scm (properly-starts-sentence): Exclude leading "@". >> (check-synopsis-length): Exclude "@code" and "@acronym". > > LGTM! Bonus points for a test in ‘tests/lint.scm’. :-) No bonus points for me just yet... diff --git a/tests/lint.scm b/tests/lint.scm index ce22e2355a..26e93ca37b 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -283,6 +283,16 @@ (define (warning-contains? str warnings) (synopsis (make-string 80 #\X))))) (check-synopsis-style pkg)))) +(test-equal "synopsis: exclude @code from long synopsis" + '() + (single-lint-warning-message + (let ((pkg (dummy-package "x" + (synopsis + (string-append + "@code{X}" + (make-string 72 #\X)))))) + (check-synopsis-style pkg)))) + (test-equal "synopsis: start with package name" "synopsis should not start with the package name" (single-lint-warning-message The above test doesn't catch this issue, even though the code works on real packages... I am a bit stumped as to why. I guess '() (or "" which I also tried) is not a valid way to try to express "this test expects no warning/error/message/etc."? Here is a log from the test I cargo-culted: test-name: synopsis: too long location: /home/vagrant/src/guix/tests/lint.scm:279 source: + (test-equal + "synopsis: too long" + "synopsis should be less than 80 characters long" + (single-lint-warning-message + (let ((pkg (dummy-package + "x" + (synopsis (make-string 80 #\X))))) + (check-synopsis-style pkg)))) expected-value: "synopsis should be less than 80 characters long" actual-value: "synopsis should be less than 80 characters long" result: PASS And from my test in the patch listed above: test-name: synopsis: exclude @code from long synopsis location: /home/vagrant/src/guix/tests/lint.scm:286 source: + (test-equal + "synopsis: exclude @code from long synopsis" + '() + (single-lint-warning-message + (let ((pkg (dummy-package + "x" + (synopsis + (string-append "@code{X}" (make-string 72 #\X)))))) + (check-synopsis-style pkg)))) expected-value: () actual-value: #f actual-error: + (match-error "match" "no matching pattern" ()) result: FAIL What is failing to match what here? live well, vagrant