Unverified Commit e583a2b3 authored by Matt Sturgeon's avatar Matt Sturgeon Committed by GitHub
Browse files

treefmt: use structuredAttrs instead of passAsFile in test (#515389)

parents 41a8214c 958259c3
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -72,10 +72,6 @@ in
    runCommand "run-nixfmt-example"
      {
        nativeBuildInputs = [ nixfmtExamplePackage ];
        passAsFile = [
          "input"
          "expected"
        ];
        input = ''
          {
            foo="bar";
@@ -90,18 +86,19 @@ in
            list = [ ];
          }
        '';
        __structuredAttrs = true;
      }
      ''
        export XDG_CACHE_HOME=$(mktemp -d)
        # The example config assumes the tree root has a .git/index file
        mkdir .git && touch .git/index

        # Copy the input file, then format it using the wrapped treefmt
        cp $inputPath input.nix
        # Create the input file, then format it using the wrapped treefmt
        printf "%s" "$input" > input.nix
        treefmt

        # Assert that input.nix now matches expected
        if diff -u $expectedPath input.nix; then
        if diff -u <(printf "%s" "$expected") input.nix; then
          touch $out
        else
          echo