diff options
author | Efraim Flashner <efraim@flashner.co.il> | 2025-07-09 09:58:46 +0300 |
---|---|---|
committer | Efraim Flashner <efraim@flashner.co.il> | 2025-07-28 10:34:36 +0300 |
commit | 54717bb5b3c06c9667efafb9410cc5122f36a25f (patch) | |
tree | ddff011fbb28da5a69a85028309f94f785cb6666 /tests | |
parent | fb8574b148ac0f94fb1a85f30d243d2d253f89e4 (diff) |
guix: lint: Check for misplaced argument flags.
* guix/lint.scm (check-misplaced-flags): New procedure.
(%local-checkers): Register new lint-checker.
* doc/guix.texi (Invoking guix lint): Add entry for misplaced-flags.
* tests/lint.scm (misplaced-flags: make-flag is incorrect,
misplaced-flags: configure-flag is incorrect, misplaced-flags: cargo
feature flags, misplaced-flags: flags without g-exp is incorrect,
misplaced-flags: build-type set correctly): New tests.
Change-Id: Ia8abbe787e26bffc65ee5c763326c7e271c189a4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lint.scm | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/lint.scm b/tests/lint.scm index 3e37438b39..652a55db92 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -414,6 +414,50 @@ (list #:target #false #:make-flags #~(list "CC=gcc")))))) +(test-equal "misplaced-flags: make-flag is incorrect" + "'CMAKE_BUILD_TYPE' should be set with the 'build-type' flag" + (single-lint-warning-message + (check-misplaced-flags + (dummy-package "x" + (arguments + (list #:make-flags #~(list "-DCMAKE_BUILD_TYPE=RELEASE" + "-DTESTS=ON"))))))) + +(test-equal "misplaced-flags: configure-flag is incorrect" + "'buildtype' should be set with the 'build-type' flag" + (single-lint-warning-message + (check-misplaced-flags + (dummy-package "x" + (arguments + (list #:configure-flags #~(list "--buildtype=release" + "--with-tests"))))))) + +(test-equal "misplaced-flags: cargo feature flags" + "'features' should be set with the 'features' flag" + (single-lint-warning-message + (check-misplaced-flags + (dummy-package "x" + (arguments + '(#:cargo-test-flags + '("--features" "force_system_lib"))))))) + +(test-equal "misplaced-flags: flags without g-exp is incorrect" + "'CMAKE_BUILD_TYPE' should be set with the 'build-type' flag" + (single-lint-warning-message + (check-misplaced-flags + (dummy-package "x" + (arguments + '(#:make-flags '("-DCMAKE_BUILD_TYPE=RELEASE" + "-DTESTS=ON"))))))) + +(test-equal "misplaced-flags: build-type set correctly" + '() + (check-misplaced-flags + (dummy-package "x" + (arguments + (list #:build-type "RELEASE" + #:make-flags #~(list "-DTESTS=ON")))))) + ;; The emacs-build-system sets #:tests? #f by default. (test-equal "tests-true: #:tests? #t acceptable for emacs packages" '() |