aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-style.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/guix-style.sh')
-rw-r--r--tests/guix-style.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/guix-style.sh b/tests/guix-style.sh
index 2de879d5e3..9333139435 100644
--- a/tests/guix-style.sh
+++ b/tests/guix-style.sh
@@ -58,6 +58,24 @@ cat > "$tmpfile" <<EOF
;; The services.
(services
(cons (service mcron-service-type) %base-services)))
+;; Incomplete package definitions in alphabetical order.
+
+(define-public pkg
+ (package
+ (name "bar")
+ (version "2")))
+
+;; The comment below belongs to the foo package.
+(define-public pkg
+ (package
+ (name "bar")
+ (version "1")))
+;; Incomplete package definitions in alphabetical order.
+
+(define-public pkg
+ (package
+ (name "foo")
+ (version "2")))
EOF
cp "$tmpfile" "$tmpfile.bak"
@@ -78,3 +96,11 @@ test "$initial_hash" != "$(guix hash "$tmpfile")"
guix style -f "$tmpfile"
test "$initial_hash" = "$(guix hash "$tmpfile")"
+
+# Swap foo and bar packages.
+sed -i "$tmpfile" -e 's/"foo"/"bar"/g'
+sed -i "$tmpfile" -e '0,/"bar"/{s//"foo"/}'
+test "$initial_hash" != "$(guix hash "$tmpfile")"
+
+guix style -fA "$tmpfile"
+test "$initial_hash" = "$(guix hash "$tmpfile")"