rewrite-to-python: add test for hocon includes, fix generator bug
This commit is contained in:
12
flake.nix
12
flake.nix
@@ -39,6 +39,18 @@
|
||||
|
||||
overlays.default = final: prev: self.packages.${final.system};
|
||||
|
||||
checks = forAllSystems (system: pkgs: {
|
||||
hocon-include = let
|
||||
format = pkgs.formats.hocon { };
|
||||
in format.generate "minecraft-kartverket-test-hocon-include" {
|
||||
_includes = [
|
||||
(format.lib.mkInclude "${self.packages.${system}.bluemap-export}/overworld.hocon")
|
||||
(format.lib.mkInclude "${self.packages.${system}.bluemap-export}/nether.hocon")
|
||||
(format.lib.mkInclude "${self.packages.${system}.bluemap-export}/the-end.hocon")
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
packages = forAllSystems (system: pkgs: {
|
||||
default = self.packages.${system}.mckart;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ def to_hocon(x: Any) -> str:
|
||||
return f"[\n{'\n'.join(items)}\n]"
|
||||
elif isinstance(x, dict):
|
||||
items = [
|
||||
f' {k}: {indent(to_hocon(v), ' ').removeprefix(' ')}'
|
||||
f' "{k}": {indent(to_hocon(v), ' ').removeprefix(' ')}'
|
||||
for k, v in x.items()
|
||||
]
|
||||
return f"{{\n{'\n'.join(items)}\n}}"
|
||||
|
||||
Reference in New Issue
Block a user