depot/pkgs/test/dotnet/structured-attrs/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

36 lines
1.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib
, dotnet-sdk
, buildPackages # buildDotnetModule
, testers
, runCommand
}:
let
# Note: without structured attributes, we cant use derivation arguments that
# contain spaces unambiguously because arguments are passed as space-separated
# environment variables.
copyrightString = "Public domain 🅮";
inherit (buildPackages) buildDotnetModule;
app = buildDotnetModule {
name = "structured-attrs-test-application";
src = ./src;
nugetDeps = ./nuget-deps.nix;
dotnetFlags = [ "--property:Copyright=${copyrightString}" ];
env.TargetFramework = "net${lib.versions.majorMinor (lib.getVersion dotnet-sdk)}";
__structuredAttrs = true;
};
in
{
no-structured-attrs = testers.testBuildFailure (app.overrideAttrs {
__structuredAttrs = false;
});
check-output = testers.testEqualContents {
assertion = "buildDotnetModule sets AssemblyCopyrightAttribute with structured attributes";
expected = builtins.toFile "expected-copyright.txt" copyrightString;
actual = runCommand "dotnet-structured-attrs-test" { } ''
${app}/bin/Application >"$out"
'';
};
}