summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-20 00:33:50 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-20 01:32:17 +0200
commit723bdb8ef0175716a2bfa93e96c3fd757d7b2679 (patch)
tree16183f316342d34246ce8e0346c92906ae679217 /tests
parenta2a94b6e58e5120462d6861bdf72efa2170bfd73 (diff)
ui: 'warn-about-load-error' provides hints for unbound variables.
* guix/ui.scm (warn-about-load-error): Add 'unbound-variable' clause. * tests/guix-build.sh: Add test.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-build.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index d16b92d189..37666ffd01 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -146,8 +146,8 @@ test `guix build -d --sources=transitive foo \
| wc -l` -eq 3
-# Unbound variables.
-cat > "$module_dir/foo.scm"<<EOF
+# Unbound variable in thunked field.
+cat > "$module_dir/foo.scm" <<EOF
(define-module (foo)
#:use-module (guix tests)
#:use-module (guix build-system trivial))
@@ -162,6 +162,21 @@ if guix build package-with-something-wrong -n; then false; else true; fi
guix build package-with-something-wrong -n 2> "$module_dir/err" || true
grep "unbound" "$module_dir/err" # actual error
grep "forget.*(gnu packages base)" "$module_dir/err" # hint
+
+# Unbound variable at the top level.
+cat > "$module_dir/foo.scm" <<EOF
+(define-module (foo)
+ #:use-module (guix tests))
+
+(define-public foo
+ (dummy-package "package-with-something-wrong"
+ (build-system gnu-build-system))) ;unbound variable
+EOF
+
+guix build sed -n 2> "$module_dir/err"
+grep "unbound" "$module_dir/err" # actual error
+grep "forget.*(guix build-system gnu)" "$module_dir/err" # hint
+
rm -f "$module_dir"/*
# Wrong 'define-module' clause reported by 'warn-about-load-error'.