Merge pull request #264444 from liff/fend-tests

fend: add tests and `meta.changelog`
This commit is contained in:
Peder Bergebakken Sundt 2023-12-02 15:35:04 +01:00 committed by GitHub
commit 47c26dc448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,10 @@
, copyDesktopItems
, makeDesktopItem
, nix-update-script
, testers
, writeText
, runCommand
, fend
}:
rustPlatform.buildRustPackage rec {
@ -58,11 +62,26 @@ rustPlatform.buildRustPackage rec {
})
];
passthru.updateScript = nix-update-script { };
passthru = {
updateScript = nix-update-script { };
tests = {
version = testers.testVersion { package = fend; };
units = testers.testEqualContents {
assertion = "fend does simple math and unit conversions";
expected = writeText "expected" ''
36 kph
'';
actual = runCommand "actual" { } ''
${lib.getExe fend} '(100 meters) / (10 seconds) to kph' > $out
'';
};
};
};
meta = with lib; {
description = "Arbitrary-precision unit-aware calculator";
homepage = "https://github.com/printfn/fend";
changelog = "https://github.com/printfn/fend/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ djanatyn liff ];
mainProgram = "fend";