push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;
class Main {
public static void main (String args[]) {
try {
InputStream input = new FileInputStream(args[0]);
Properties prop = new Properties();
prop.load(input);
SortedSet<String> keySet = new TreeSet(prop.keySet());
for (String key : keySet) {
System.out.println("KEY");
System.out.println(key);
System.out.println("VALUE");
System.out.println(prop.get(key));
System.out.println("");
}
} catch (Exception e) {
e.printStackTrace();
System.err.println(e.toString());
System.exit(1);
}
}
}

View File

@@ -0,0 +1,90 @@
{
formats,
glibcLocales,
jdk,
lib,
stdenv,
}:
# This test primarily tests correct escaping.
# See also testJavaProperties in
# pkgs/pkgs-lib/tests/formats.nix, which tests
# type coercions and is a bit easier to read.
let
inherit (lib) concatStrings attrValues mapAttrs;
javaProperties = formats.javaProperties { };
input = {
foo = "bar";
"empty value" = "";
"typical.dot.syntax" = "com.sun.awt";
"" = "empty key's value";
"1" = "2 3";
"#" = "not a comment # still not";
"!" = "not a comment!";
"!a" = "still not! a comment";
"!b" = "still not ! a comment";
"dos paths" = "C:\\Program Files\\Nix For Windows\\nix.exe";
"a \t\nb" = " c";
"angry \t\nkey" = ''
multi
${"\tline\r"}
space-
indented
trailing-space${" "}
trailing-space${" "}
value
'';
"this=not" = "bad";
"nor = this" = "bad";
"all stuff" = "foo = bar";
"unicode big brain" = "e = mc";
"ütf-8" = "dûh";
# NB: Some editors (vscode) show this _whole_ line in right-to-left order
"الجبر" = "أكثر من مجرد أرقام";
};
in
stdenv.mkDerivation {
name = "pkgs.formats.javaProperties-test-${jdk.name}";
nativeBuildInputs = [
jdk
glibcLocales
];
# 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: ''
KEY
${key}
VALUE
${value}
'') input
)
);
src = lib.sourceByRegex ./. [
".*\\.java"
];
# On Linux, this can be C.UTF-8, but darwin + zulu requires en_US.UTF-8
LANG = "en_US.UTF-8";
buildPhase = ''
javac Main.java
'';
doCheck = true;
checkPhase = ''
cat -v $properties
java Main $properties >actual
diff -U3 $expectedPath actual
'';
installPhase = "touch $out";
}