From 574e847b8ea692aeea051d487cc95cec1257aba7 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Wed, 22 Oct 2014 13:47:01 -0500 Subject: guix: lint: Check for proper end-of-sentence space. * guix/scripts/lint.scm (start-with-capital-letter?): Handle empty strings. (check-description-style): New check for end-of-sentence space. * tests/lint.scm: Test it. --- tests/lint.scm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/lint.scm b/tests/lint.scm index 62a9df90d8..b013231b29 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013 Cyril Roelandt +;;; Copyright © 2014 Eric Bavier ;;; ;;; This file is part of GNU Guix. ;;; @@ -53,6 +54,34 @@ (check-description-style pkg)))) "description should start with an upper-case letter"))) +(test-assert "description: two spaces after end of sentence" + (->bool + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (description "Bad. Quite bad.")))) + (check-description-style pkg)))) + "sentences in description should be followed by two spaces"))) + +(test-assert "description: end-of-sentence detection with abbreviations" + (not + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (description + "E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD).")))) + (check-description-style pkg)))) + "sentences in description should be followed by two spaces"))) + +(test-assert "synopsis: not empty" + (->bool + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (synopsis "")))) + (check-synopsis-style pkg)))) + "synopsis should not be empty"))) + (test-assert "synopsis: does not start with an upper-case letter" (->bool (string-contains (call-with-warnings -- cgit v1.2.3