feat: make to nuon raw option remove all white space (#15609)

# Description
Fixes #9942

This adds a new `--minified` flag to `to nuon` which removes all
possible white space. I added an example test to demonstrate the
functionality.

# User-Facing Changes

New flag becomes available to the user.
This commit is contained in:
Artem Chernyak
2025-05-09 01:38:24 +00:00
committed by GitHub
parent 52fa9a978b
commit 73fbe26ef9
12 changed files with 57 additions and 34 deletions

View File

@ -31,7 +31,7 @@ mod tests {
assert_eq!(val, m);
}
assert_eq!(
to_nuon(&engine_state, &val, ToStyle::Raw, None, false).unwrap(),
to_nuon(&engine_state, &val, ToStyle::Default, None, false).unwrap(),
input
);
}
@ -186,7 +186,7 @@ mod tests {
block_id: BlockId::new(0),
captures: vec![]
}),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -211,7 +211,7 @@ mod tests {
to_nuon(
&engine_state,
&from_nuon("0x[1f ff]", None).unwrap(),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -261,7 +261,7 @@ mod tests {
to_nuon(
&engine_state,
&Value::test_float(1.0),
ToStyle::Raw,
ToStyle::Default,
None,
false
)
@ -278,7 +278,7 @@ mod tests {
to_nuon(
&engine_state,
&Value::test_float(f64::INFINITY),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -295,7 +295,7 @@ mod tests {
to_nuon(
&engine_state,
&Value::test_float(f64::NEG_INFINITY),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -312,7 +312,7 @@ mod tests {
to_nuon(
&engine_state,
&Value::test_float(-f64::NAN),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -340,7 +340,7 @@ mod tests {
"c d" => Value::test_int(6)
))
]),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -357,7 +357,7 @@ mod tests {
let res = to_nuon(
&engine_state,
&Value::test_string(""),
ToStyle::Raw,
ToStyle::Default,
None,
false,
);
@ -423,7 +423,7 @@ mod tests {
"c d" => Value::test_int(6)
))
]),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)
@ -438,7 +438,7 @@ mod tests {
"ro name" => Value::test_string("sam"),
"rank" => Value::test_int(10)
)),
ToStyle::Raw,
ToStyle::Default,
None,
false,
)