From c2e3f1cacd0c6b2609552cb6eb1801afe1e6cc3c Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sun, 5 Oct 2025 14:33:23 -0500 Subject: [PATCH] tests/gcc: add tests Signed-off-by: Austin Horstman --- .../programs/gcc/basic-configuration.nix | 13 ++++++++++++ tests/modules/programs/gcc/default.nix | 4 ++++ tests/modules/programs/gcc/with-colors.nix | 21 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 tests/modules/programs/gcc/basic-configuration.nix create mode 100644 tests/modules/programs/gcc/default.nix create mode 100644 tests/modules/programs/gcc/with-colors.nix diff --git a/tests/modules/programs/gcc/basic-configuration.nix b/tests/modules/programs/gcc/basic-configuration.nix new file mode 100644 index 00000000..50b3e5c6 --- /dev/null +++ b/tests/modules/programs/gcc/basic-configuration.nix @@ -0,0 +1,13 @@ +{ + config = { + programs.gcc = { + enable = true; + }; + + nmt.script = '' + # Verify no GCC_COLORS environment variable is set when colors is empty + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileNotRegex $hmEnvFile 'GCC_COLORS' + ''; + }; +} diff --git a/tests/modules/programs/gcc/default.nix b/tests/modules/programs/gcc/default.nix new file mode 100644 index 00000000..ee927739 --- /dev/null +++ b/tests/modules/programs/gcc/default.nix @@ -0,0 +1,4 @@ +{ + gcc-basic-configuration = ./basic-configuration.nix; + gcc-with-colors = ./with-colors.nix; +} diff --git a/tests/modules/programs/gcc/with-colors.nix b/tests/modules/programs/gcc/with-colors.nix new file mode 100644 index 00000000..2a9d543f --- /dev/null +++ b/tests/modules/programs/gcc/with-colors.nix @@ -0,0 +1,21 @@ +{ + config = { + programs.gcc = { + enable = true; + colors = { + error = "01;31"; + warning = "01;33"; + note = "01;36"; + caret = "01;32"; + locus = "01"; + quote = "01"; + }; + }; + + nmt.script = '' + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileExists $hmEnvFile + assertFileRegex $hmEnvFile 'export GCC_COLORS="caret=01;32:error=01;31:locus=01:note=01;36:quote=01:warning=01;33"' + ''; + }; +}