summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-08-19 11:22:07 +0200
committerLudovic Courtès <ludo@gnu.org>2015-08-19 11:39:17 +0200
commit40a7d4e58ba05f39bf11edab68de6d3ae9c43306 (patch)
tree96f1e22f0039c2721654d68bc5f0254bd9355120 /tests
parent7cb6f648b2486b0e6060a333564432a0830637de (diff)
lint: Add 'formatting' checker.
* guix/scripts/lint.scm (report-tabulations, report-trailing-white-space, report-long-line, report-formatting-issues, check-formatting): New procedures. (%formatting-reporters): New variable. (%checkers): Add 'formatting' checker. * tests/lint.scm ("formatting: tabulation", "formatting: trailing white space", "formatting: long line", "formatting: alright"): New tests. * doc/guix.texi (Invoking guix lint): Mention the 'formatting' checker.
Diffstat (limited to 'tests')
-rw-r--r--tests/lint.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lint.scm b/tests/lint.scm
index 2807eba1cc..5d56420966 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -420,6 +420,32 @@ requests."
(check-source pkg))))
"not reachable: 404")))
+(test-assert "formatting: tabulation"
+ (string-contains
+ (with-warnings
+ (check-formatting (dummy-package "leave the tab here: ")))
+ "tabulation"))
+
+(test-assert "formatting: trailing white space"
+ (string-contains
+ (with-warnings
+ ;; Leave the trailing white space on the next line!
+ (check-formatting (dummy-package "x")))
+ "trailing white space"))
+
+(test-assert "formatting: long line"
+ (string-contains
+ (with-warnings
+ (check-formatting
+ (dummy-package "x" ;here is a stupid comment just to make a long line
+ )))
+ "too long"))
+
+(test-assert "formatting: alright"
+ (string-null?
+ (with-warnings
+ (check-formatting (dummy-package "x")))))
+
(test-end "lint")