From f921fd71bb7a18493795d0c56c2f3e5ecf370538 Mon Sep 17 00:00:00 2001 From: klchen0112 Date: Sat, 23 Nov 2024 00:20:39 +0800 Subject: [PATCH] emacs: add test case for darwin --- tests/default.nix | 1 + tests/modules/services/emacs-darwin/basic.nix | 13 +++++++++++ .../modules/services/emacs-darwin/default.nix | 1 + .../emacs-darwin/expected-agent.plist | 22 +++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 tests/modules/services/emacs-darwin/basic.nix create mode 100644 tests/modules/services/emacs-darwin/default.nix create mode 100644 tests/modules/services/emacs-darwin/expected-agent.plist diff --git a/tests/default.nix b/tests/default.nix index 2eaaaa436..8fac3280a 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -173,6 +173,7 @@ in import nmtSrc { ./modules/xresources ] ++ lib.optionals isDarwin [ ./modules/launchd + ./modules/services/emacs-darwin ./modules/services/espanso-darwin ./modules/services/git-sync-darwin ./modules/services/imapnotify-darwin diff --git a/tests/modules/services/emacs-darwin/basic.nix b/tests/modules/services/emacs-darwin/basic.nix new file mode 100644 index 000000000..f65bc2b2f --- /dev/null +++ b/tests/modules/services/emacs-darwin/basic.nix @@ -0,0 +1,13 @@ +{ ... }: { + emacs = { enable = true; }; + + test.stubs.nix = { }; + + nmt.script = '' + serviceFile=LaunchAgents/org.nix-community.home.emacs.plist + + assertFileExists "$serviceFile" + + assertFileContent "$serviceFile" ${./expected-agent.plist} + ''; +} diff --git a/tests/modules/services/emacs-darwin/default.nix b/tests/modules/services/emacs-darwin/default.nix new file mode 100644 index 000000000..8dada1ca9 --- /dev/null +++ b/tests/modules/services/emacs-darwin/default.nix @@ -0,0 +1 @@ +{ emacs = ./basic.nix; } diff --git a/tests/modules/services/emacs-darwin/expected-agent.plist b/tests/modules/services/emacs-darwin/expected-agent.plist new file mode 100644 index 000000000..82cdcc18e --- /dev/null +++ b/tests/modules/services/emacs-darwin/expected-agent.plist @@ -0,0 +1,22 @@ + + + + + KeepAlive + + Crashed + + SuccessfulExit + + + Label + org.nix-community.home.emacs + ProgramArguments + + @emacs/bin/emacs + --fg-daemon + + RunAtLoad + + +%