formats.javaProperties: use structuredAttrs instead of passAsFile in test

This commit is contained in:
Stefan Frijters
2026-06-10 15:34:37 +02:00
parent dfde99fd70
commit 3cb8b0787d
@@ -53,13 +53,13 @@ stdenv.mkDerivation {
jdk
glibcLocales
];
__structuredAttrs = true;
strictDeps = true;
# technically should go through the type.merge first, but that's tested
# in tests/formats.nix.
properties = javaProperties.generate "example.properties" input;
# Expected output as printed by Main.java
passAsFile = [ "expected" ];
expected = concatStrings (
attrValues (
mapAttrs (key: value: ''
@@ -76,7 +76,7 @@ stdenv.mkDerivation {
"**/*.java"
];
# On Linux, this can be C.UTF-8, but darwin + zulu requires en_US.UTF-8
LANG = "en_US.UTF-8";
env.LANG = "en_US.UTF-8";
buildPhase = ''
javac Main.java
'';
@@ -84,7 +84,7 @@ stdenv.mkDerivation {
checkPhase = ''
cat -v $properties
java Main $properties >actual
diff -U3 $expectedPath actual
diff -U3 <(printf "%s" "$expected") actual
'';
installPhase = "touch $out";
}