diff --git a/pkgs/development/interpreters/racket/minimal.nix b/pkgs/development/interpreters/racket/minimal.nix index 50f4cfc4e6805..5e8ae81f9bd41 100644 --- a/pkgs/development/interpreters/racket/minimal.nix +++ b/pkgs/development/interpreters/racket/minimal.nix @@ -86,12 +86,11 @@ stdenv.mkDerivation (finalAttrs: { dontStrip = isDarwin; passthru = { - tests = builtins.mapAttrs (name: path: callPackage path { racket = finalAttrs.finalPackage; }) { - write-greeting = ./tests/write-greeting.nix; - get-current-launcher-variant = ./tests/get-current-launcher-variant.nix; - nix-write-script = ./tests/nix-write-script.nix; - }; + # Useful information # + configDir = "etc/racket"; + collectsDir = "share/racket/collects"; + # Functionalities # writeScript = nameOrPath: { @@ -106,6 +105,17 @@ stdenv.mkDerivation (finalAttrs: { } ) nameOrPath; writeScriptBin = name: finalAttrs.passthru.writeScript "/bin/${name}"; + + # Tests # + tests = builtins.mapAttrs (name: path: callPackage path { racket = finalAttrs.finalPackage; }) { + ## Basic ## + write-greeting = ./tests/write-greeting.nix; + get-current-launcher-variant = ./tests/get-current-launcher-variant.nix; + + ## Nixpkgs supports ## + nix-write-script = ./tests/nix-write-script.nix; + nix-dirs = ./tests/nix-dirs.nix; + }; }; meta = { diff --git a/pkgs/development/interpreters/racket/tests/nix-dirs.nix b/pkgs/development/interpreters/racket/tests/nix-dirs.nix new file mode 100644 index 0000000000000..c1a95f83a9d81 --- /dev/null +++ b/pkgs/development/interpreters/racket/tests/nix-dirs.nix @@ -0,0 +1,40 @@ +{ + lib, + runCommandLocal, + racket, +}: + +let + expectation = lib.concatMapStringsSep ":" (subDir: "${racket}/${subDir}/") ( + with racket.passthru; + [ + configDir + collectsDir + ] + ); +in + +runCommandLocal "racket-test-nix-dirs" + { + nativeBuildInputs = [ racket ]; + } + '' + expectation="${expectation}" + + racket -f - <string + (list (find-config-dir) + (find-collects-dir))) + ":")))) + EOF + + output="$(cat $out)" + + if test "$output" != "$expectation"; then + echo "output mismatch: expected ''${expectation}, but got ''${output}" + exit 1 + fi + ''