Unverified Commit 5f5d29e3 authored by Stefan Frijters's avatar Stefan Frijters
Browse files

bats: add let binding to passthru.tests.libraries

We don't actually need to pass the script as an argument to runCommand
since we can reference it directly.

Moving bats.withLibraries [...] out of the string interpolation seems a
bit more readable as well.
parent d3d6e2f3
Loading
Loading
Loading
Loading
+39 −41
Original line number Diff line number Diff line
@@ -156,8 +156,7 @@ resholve.mkDerivation rec {

  passthru.tests = {
    libraries =
      runCommand "${bats.name}-with-libraries-test"
        {
      let
        testScript = writeText "bats-libraries-test-script" ''
          setup() {
            bats_load_library bats-support
@@ -192,16 +191,15 @@ resholve.mkDerivation rec {
            assert_output "hi"
          }
        '';
        }
        ''
          ${
            bats.withLibraries (p: [
        batsWithLibraries = bats.withLibraries (p: [
          p.bats-support
          p.bats-assert
          p.bats-file
          p.bats-detik
            ])
          }/bin/bats "$testScript"
        ]);
      in
      runCommand "${bats.name}-with-libraries-test" { } ''
        ${lib.getExe batsWithLibraries} "${testScript}"
        touch "$out"
      '';