about summary refs log tree commit diff
path: root/pkgs/pkgs-lib/tests
AgeCommit message (Collapse)AuthorFilesLines
2024-02-12pkgs.formats: toINIWithGlobalSection wrapperbenaryorg1-0/+95
The new format is based on the existing wrapper and generates an INI file with an unnamed global section at the top as is used by *stunnel* for instance. Technically the INI format is a subset of this however testing, type checking, and API guarantees profit from two separate generators. Co-authored-by: tim-tx <tim-tx@users.noreply.github.com> Signed-off-by: benaryorg <binary@benary.org>
2024-02-12pkgs.formats: negative type checking testsbenaryorg1-38/+118
Tests using `shouldFail` (new) enable testing for whether the type system catches any unintended uses (missing parameters or unavailable data types in the format). It should not be necessary to test for all possible outliers for each format, however format-specific tests (for instance those using a rigid submodule structure) can ensure that common mistakes err out instead of being silently discarded, while also allowing test-driven development of sorts. Signed-off-by: benaryorg <binary@benary.org>
2024-02-09formats.hocon: add testsh7x41-0/+3
2023-10-27formats.libconfig: add testsh7x41-0/+1
Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> Signed-off-by: h7x4 <h7x4@nani.wtf>
2023-08-27pkgs-lib/tests/formats: fix expected outputK9001-1/+0
2022-06-20formats.keyValue: add testsFrancesco Gazzetta1-0/+45
2022-04-25Merge pull request #167172 from hercules-ci/javaProperties-type-coercionsRobert Hensing1-4/+21
`formats.javaProperties`: add type coercions
2022-04-18pkgs-lib.formats: fix tomlkit outputzowoq1-0/+1
2022-04-10tests formats: fix due to tomlkit output changelassulus1-3/+0
2022-04-04pkgs.formats.javaProperties: Add type coercionsRobert Hensing1-2/+16
A usability improvement.
2022-04-04tests.pkgs-lib.formats: Allow strings with context in test runnerRobert Hensing1-2/+5
2022-04-04tests.pkgs-lib.formats: Detect when impossible input is fedRobert Hensing1-1/+5
2022-04-01formats.javaProperties: Add commentRobert Hensing1-0/+2
2022-04-01formats.javaProperties: initRobert Hensing2-5/+60
2021-08-26formats: Fix yaml testSilvan Mosberger1-2/+2
Faulty test result was introduced in https://github.com/NixOS/nixpkgs/pull/133807
2021-08-25lib.formats.yaml: use well known YAML formatlucasew1-15/+11
The way `(lib.formats.yaml {}).generate` generates YAML is compliant because on YAML 1.2 spec JSON is a subset of YAML but it bugs people's minds and can lead to problems with software that is not compatible with YAML 1.2. This commit also changes the test of the generation function. Data validation/typing remains the same. See #133802. Signed-off-by: lucasew <lucas59356@gmail.com>
2021-08-15treewide: runCommandNoCC -> runCommandRobert Hensing1-1/+1
This has been synonymous for ~5y.
2021-06-28pkgs-lib: allow paths in TOML, YAML and JSONBen Wolsieffer1-0/+4
Paths get automatically added to the store. The INI generator currently chokes on paths, so it is not supported for now.
2021-05-04formats.ini: Introduce `listToValue` argument (#121613)Silvan Mosberger1-0/+16
Allows coercing lists to values. E.g. formats.ini { listToValue = lib.concatMapStringsSep ", " (lib.generators.mkValueStringDefault {}); }
2020-10-19pkgs-lib/tests/formats: improve message on failureVladimír Čunát1-4/+4
Foremost, the message was discarding double quotes on one side of the diff, which was super-confusing to me, as I thought that the format convertor broke that when in fact only whitespace was changed. I thought I'd cat the files, but then... switching to `diff -u` seemed self-sufficient. It felt sufficiently non-controversial to push directly, but certainly feel free to improve further.
2020-10-19pkgs-lib/tests/formats: fix whitespace after PR #100372Vladimír Čunát1-2/+0
Naturally, TOML doesn't define the exact shape of everything. nix build -f pkgs/top-level/release.nix pkgs-lib-tests
2020-07-29pkgs-lib: Add tests for formatsSilvan Mosberger2-0/+159
2020-07-29pkgs: Add pkgs-lib structureSilvan Mosberger1-0/+5