nagiosPlugins.check_ssl_cert: 2.85.1 -> 2.86.0 (#379244)
[NixPkgs.git] / pkgs / by-name / ha / hare / mime-module-test.nix
blob073ae09e355708e35d7811c61aa5e0295c8ebaff
2   hare,
3   runCommandNoCC,
4   writeText,
5 }:
6 let
7   mainDotHare = writeText "main.ha" ''
8     use fmt;
9     use mime;
10     export fn main() void = {
11         const ext = "json";
12         match(mime::lookup_ext(ext)) {
13         case let mime: const *mime::mimetype =>
14           fmt::printfln("Found mimetype for extension `{}`: {}", ext, mime.mime)!;
15         case null =>
16           fmt::fatalf("Could not find mimetype for `{}`", ext);
17         };
18       };
19   '';
21 runCommandNoCC "mime-module-test" { nativeBuildInputs = [ hare ]; } ''
22   HARECACHE="$(mktemp -d)"
23   export HARECACHE
24   readonly binout="test-bin"
25   hare build -qRo "$binout" ${mainDotHare}
26   ./$binout
27   : 1>$out