From ffb9b68bd3629d81d082193db000959039347518 Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Thu, 27 Jul 2023 09:40:16 -0400 Subject: [PATCH] pkgs.format.toml: introduce test for checking semantics --- pkgs/pkgs-lib/tests/formats.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix index 80df247f7b6a..b7e958565ca6 100644 --- a/pkgs/pkgs-lib/tests/formats.nix +++ b/pkgs/pkgs-lib/tests/formats.nix @@ -219,6 +219,35 @@ in runBuildTests { ''; }; + # see https://github.com/NixOS/nixpkgs/issues/237521 for this particular test + testTomlSemantics = { + drv = evalFormat formats.toml {} { + processors = { + override = [ + { tags = { cluster = "staging"; }; } + ]; + rename = [ + { + replace = [ + { dest = "ceph_telegraf_check"; measurement = "exec"; } + ]; + } + ]; + }; + }; + expected = '' + [processors] + [[processors.override]] + [processors.override.tags] + cluster = "staging" + + [[processors.rename]] + [[processors.rename.replace]] + dest = "ceph_telegraf_check" + measurement = "exec" + ''; + }; + # This test is responsible for # 1. testing type coercions # 2. providing a more readable example test