lint: Simplify no-warnings tests.

* tests/lint.scm ("description: may start with a digit"): Replace
  (not (string-contains exp str)) with (string-null? exp).
  ("description: may start with lower-case package name"): Likewise.
  ("description: end-of-sentence detection with abbreviations"):
  Likewise.
  ("synopsis: may start with a digit"): Likewise.
  ("synopsis: ends with 'etc.'"): Likewise.
This commit is contained in:
Ludovic Courtès 2014-11-07 14:04:02 +01:00
parent 41eb11988e
commit b1e666835e

View file

@ -64,22 +64,20 @@ (define (call-with-warnings thunk)
"description should start with an upper-case letter"))) "description should start with an upper-case letter")))
(test-assert "description: may start with a digit" (test-assert "description: may start with a digit"
(not (string-null?
(string-contains (call-with-warnings (call-with-warnings
(lambda () (lambda ()
(let ((pkg (dummy-package "x" (let ((pkg (dummy-package "x"
(description "2-component library.")))) (description "2-component library."))))
(check-description-style pkg)))) (check-description-style pkg))))))
"description should start with an upper-case letter")))
(test-assert "description: may start with lower-case package name" (test-assert "description: may start with lower-case package name"
(not (string-null?
(string-contains (call-with-warnings (call-with-warnings
(lambda () (lambda ()
(let ((pkg (dummy-package "x" (let ((pkg (dummy-package "x"
(description "x is a dummy package.")))) (description "x is a dummy package."))))
(check-description-style pkg)))) (check-description-style pkg))))))
"description should start with an upper-case letter")))
(test-assert "description: two spaces after end of sentence" (test-assert "description: two spaces after end of sentence"
(->bool (->bool
@ -91,14 +89,13 @@ (define (call-with-warnings thunk)
"sentences in description should be followed by two spaces"))) "sentences in description should be followed by two spaces")))
(test-assert "description: end-of-sentence detection with abbreviations" (test-assert "description: end-of-sentence detection with abbreviations"
(not (string-null?
(string-contains (call-with-warnings (call-with-warnings
(lambda () (lambda ()
(let ((pkg (dummy-package "x" (let ((pkg (dummy-package "x"
(description (description
"E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD).")))) "E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD)."))))
(check-description-style pkg)))) (check-description-style pkg))))))
"sentences in description should be followed by two spaces")))
(test-assert "synopsis: not empty" (test-assert "synopsis: not empty"
(->bool (->bool
@ -119,13 +116,12 @@ (define (call-with-warnings thunk)
"synopsis should start with an upper-case letter"))) "synopsis should start with an upper-case letter")))
(test-assert "synopsis: may start with a digit" (test-assert "synopsis: may start with a digit"
(not (string-null?
(string-contains (call-with-warnings (call-with-warnings
(lambda () (lambda ()
(let ((pkg (dummy-package "x" (let ((pkg (dummy-package "x"
(synopsis "5-dimensional frobnicator")))) (synopsis "5-dimensional frobnicator"))))
(check-synopsis-style pkg)))) (check-synopsis-style pkg))))))
"synopsis should start with an upper-case letter")))
(test-assert "synopsis: ends with a period" (test-assert "synopsis: ends with a period"
(->bool (->bool
@ -137,12 +133,11 @@ (define (call-with-warnings thunk)
"no period allowed at the end of the synopsis"))) "no period allowed at the end of the synopsis")))
(test-assert "synopsis: ends with 'etc.'" (test-assert "synopsis: ends with 'etc.'"
(->bool
(string-null? (call-with-warnings (string-null? (call-with-warnings
(lambda () (lambda ()
(let ((pkg (dummy-package "x" (let ((pkg (dummy-package "x"
(synopsis "Foo, bar, etc.")))) (synopsis "Foo, bar, etc."))))
(check-synopsis-style pkg))))))) (check-synopsis-style pkg))))))
(test-assert "synopsis: starts with 'A'" (test-assert "synopsis: starts with 'A'"
(->bool (->bool