mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-07-08 01:31:53 +08:00
Add workround fix
This commit is contained in:
@@ -112,7 +112,10 @@ impl INode for CommandNode {
|
|||||||
} else {
|
} else {
|
||||||
s.push_str(", ");
|
s.push_str(", ");
|
||||||
}
|
}
|
||||||
if arg.contains(" ") || arg.contains(",") || arg.contains("=") {
|
if (arg.contains(" ") && !arg.chars().all(|s| s.is_ascii_digit() || s == ' '))
|
||||||
|
|| arg.contains(",")
|
||||||
|
|| arg.contains("=")
|
||||||
|
{
|
||||||
s.push_str(&format!("\"{}\"", arg));
|
s.push_str(&format!("\"{}\"", arg));
|
||||||
} else {
|
} else {
|
||||||
s.push_str(arg);
|
s.push_str(arg);
|
||||||
@@ -835,4 +838,16 @@ mod tests {
|
|||||||
})])],
|
})])],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn test_ser1() {
|
||||||
|
assert_eq!(
|
||||||
|
(CommandNode {
|
||||||
|
name: "EV.CMXYZ".into(),
|
||||||
|
args: vec!["0 474".into(), "54".into(), "-58".into()],
|
||||||
|
has_args: true,
|
||||||
|
})
|
||||||
|
.serialize(),
|
||||||
|
r"\EV.CMXYZ(0 474, 54, -58)"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user