From 42f7a1b3e92baf371c5e46c42fa48203870572d1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 3 Jun 2024 10:58:20 -0500 Subject: [PATCH] test(encode): Show existing quote behavior --- crates/toml_edit/tests/testsuite/edit.rs | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/crates/toml_edit/tests/testsuite/edit.rs b/crates/toml_edit/tests/testsuite/edit.rs index f31119af..f17a0a55 100644 --- a/crates/toml_edit/tests/testsuite/edit.rs +++ b/crates/toml_edit/tests/testsuite/edit.rs @@ -200,6 +200,36 @@ key3 = 8.1415926 "#]]); } +#[test] +fn test_insert_key_with_quotes() { + given( + r#" + [package] + name = "foo" + + [target] + "#, + ) + .running(|root| { + root["target"]["cfg(target_os = \"linux\")"] = table(); + root["target"]["cfg(target_os = \"linux\")"]["dependencies"] = table(); + root["target"]["cfg(target_os = \"linux\")"]["dependencies"]["name"] = value("dep"); + }) + .produces_display(str![[r#" + + [package] + name = "foo" + + [target] + +[target."cfg(target_os = \"linux\")"] + +[target."cfg(target_os = \"linux\")".dependencies] +name = "dep" + +"#]]); +} + // removal #[test]