1
0
Fork 0
firefox/third_party/rust/ron/tests/240_array_pretty.rs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

50 lines
996 B
Rust

use ron::ser::{to_string_pretty, PrettyConfig};
#[test]
fn small_array() {
let arr = &[(), (), ()][..];
assert_eq!(
to_string_pretty(&arr, PrettyConfig::new().new_line("\n")).unwrap(),
"[
(),
(),
(),
]"
);
assert_eq!(
to_string_pretty(
&arr,
PrettyConfig::new().new_line("\n").compact_arrays(true)
)
.unwrap(),
"[(), (), ()]"
);
assert_eq!(
to_string_pretty(
&arr,
PrettyConfig::new()
.new_line("\n")
.compact_arrays(true)
.separator("")
)
.unwrap(),
"[(),(),()]"
);
assert_eq!(
to_string_pretty(
&vec![(1, 2), (3, 4)],
PrettyConfig::new()
.new_line("\n")
.separate_tuple_members(true)
.compact_arrays(true)
)
.unwrap(),
"[(
1,
2,
), (
3,
4,
)]"
);
}