Skip to content

Commit

Permalink
test(edit): Show dotted-key comment bug
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 5, 2024
1 parent 35e5326 commit 16c8353
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions crates/toml_edit/tests/testsuite/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1488,3 +1488,36 @@ fn despan_keys() {

assert_eq!(doc.to_string(), "aaaaaa = 1\nbbb = 2\n");
}

#[test]
fn dotted_key_comment_roundtrip() {
let input = r###"
rust.unsafe_op_in_unsafe_fn = "deny"
rust.explicit_outlives_requirements = "warn"
# rust.unused_crate_dependencies = "warn"
clippy.cast_lossless = "warn"
clippy.doc_markdown = "warn"
clippy.exhaustive_enums = "warn"
"###;
let expected = r###"
rust.unsafe_op_in_unsafe_fn = "deny"
rust.explicit_outlives_requirements = "warn"
# rust.unused_crate_dependencies = "warn"
clippy.cast_lossless = "warn"
# rust.unused_crate_dependencies = "warn"
clippy.doc_markdown = "warn"
# rust.unused_crate_dependencies = "warn"
clippy.exhaustive_enums = "warn"
"###;

let manifest: toml_edit::Document = input.parse().unwrap();
let actual = manifest.to_string();

assert_eq(expected, actual);
}

0 comments on commit 16c8353

Please sign in to comment.