From 6da2a5a5655668f42ec5b26f875ddbc498e132b6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 20 Mar 2022 18:56:46 +0100 Subject: home: import: Properly parse aliases that contain quotes. * guix/scripts/home/import.scm (generate-bash-configuration+modules): Define 'alias-rx'. [bash-alias->pair]: Use it. * tests/home-import.scm (match-home-environment-bash-service-with-alias): New variable. ("manifest->code: Bash service with aliases"): New test. --- tests/home-import.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests') diff --git a/tests/home-import.scm b/tests/home-import.scm index 6d373acf79..ca8aa95431 100644 --- a/tests/home-import.scm +++ b/tests/home-import.scm @@ -158,6 +158,29 @@ corresponding file." ('list ('local-file "/tmp/guix-config/.bashrc" "bashrc")))))))))) +(define-home-environment-matcher match-home-environment-bash-service-with-alias + ('begin + ('use-modules + ('gnu 'home) + ('gnu 'packages) + ('gnu 'services) + ('guix 'gexp) + ('gnu 'home 'services 'shells)) + ('home-environment + ('packages + ('map ('compose 'list 'specification->package+output) + ('list))) + ('services + ('list ('service + 'home-bash-service-type + ('home-bash-configuration + ('aliases + ('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"") + ("ls" . "ls -p")))) + ('bashrc + ('list ('local-file "/tmp/guix-config/.bashrc" + "bashrc")))))))))) + (test-assert "manifest->code: No services" (eval-test-with-home-environment @@ -187,4 +210,12 @@ corresponding file." (make-manifest '()) match-home-environment-bash-service)) +(test-assert "manifest->code: Bash service with aliases" + (eval-test-with-home-environment + '((".bashrc" + . "# Aliases +alias ls=\"ls -p\"; alias grep='grep --exclude-from=\"$HOME/.grep-exclude\"'\n")) + (make-manifest '()) + match-home-environment-bash-service-with-alias)) + (test-end "home-import") -- cgit v1.2.3