Restructure cleanCargoToml tests

This commit is contained in:
Ivan Petkov 2021-12-31 18:29:43 -08:00
parent 8d6d973261
commit 6b9ebe7220
No known key found for this signature in database
GPG Key ID: BB6F9EFC065832B6
5 changed files with 7 additions and 19 deletions

View File

@ -3,13 +3,15 @@
, writeTOML , writeTOML
}: }:
path:
let let
cleaned = cleanCargoToml { cleaned = cleanCargoToml {
cargoToml = ./Cargo.toml; cargoToml = path + /Cargo.toml;
}; };
cleanedToml = writeTOML "cleaned.toml" cleaned; cleanedToml = writeTOML "cleaned.toml" cleaned;
expected = path + /expected.toml;
in in
runCommand "compare" { } '' runCommand "compare" { } ''
diff ${./expected.toml} ${cleanedToml} diff ${expected} ${cleanedToml}
touch $out touch $out
'' ''

View File

@ -1,15 +0,0 @@
{ cleanCargoToml
, runCommand
, writeTOML
}:
let
cleaned = cleanCargoToml {
cargoToml = ./Cargo.toml;
};
cleanedToml = writeTOML "cleaned.toml" cleaned;
in
runCommand "compare" { } ''
diff ${./expected.toml} ${cleanedToml}
touch $out
''

View File

@ -12,8 +12,9 @@ pkgs.lib.makeScope myLib.newScope (self:
callPackage = self.newScope { }; callPackage = self.newScope { };
in in
{ {
cleanCargoTomlSimple = callPackage ./cleanCargoToml/simple { }; cmpCleanCargoToml = callPackage ./cleanCargoToml { };
cleanCargoTomlComplex = callPackage ./cleanCargoToml/complex { }; cmpCleanCargoTomlSimple = self.cmpCleanCargoToml ./cleanCargoToml/barebones;
cmpCleanCargoTomlComplex = self.cmpCleanCargoToml ./cleanCargoToml/complex;
compilesFresh = callPackage ./compilesFresh.nix { }; compilesFresh = callPackage ./compilesFresh.nix { };
compilesFreshSimple = self.compilesFresh ./simple "simple"; compilesFreshSimple = self.compilesFresh ./simple "simple";