trim stuff

This commit is contained in:
philipp 2023-11-06 13:50:09 +01:00
parent 16862adead
commit f646bd6d12

View File

@ -206,7 +206,7 @@ impl LawBuilder {
match classifier_index {
Some(index) => {
let mut class = ClassifierInstance::new(name, index);
let mut class = ClassifierInstance::new(name.trim(), index);
if self.classifiers[index]
.parent_index
@ -287,7 +287,7 @@ impl LawBuilder {
#[cfg(test)]
self.history.push(format!("New_new_para_header: {header}"));
debug!("new_next_para_header={header}");
self.next_para_header = Some(header.into());
self.next_para_header = Some(header.trim().into());
}
fn get_by_parent(&self, name: &String) -> Vec<ClassifierInstance> {
@ -424,7 +424,7 @@ impl Classifier {
}
fn set_desc(&mut self, desc: &str) {
self.instances.last_mut().unwrap().set_desc(desc);
self.instances.last_mut().unwrap().set_desc(desc.trim());
}
fn used_for(&self, name: &str) -> bool {
@ -494,8 +494,9 @@ mod tests {
"New_new_para_header" => builder.new_next_para_header(content),
"New_par" => {
let (par, real_content) = i.split_once(";").unwrap();
let (_, real_par) = par.split_once(":").unwrap();
let real_content: Content = serde_json::from_str(real_content).unwrap();
builder.new_par(par.into(), real_content);
builder.new_par(real_par.trim().into(), real_content);
}
_ => {
panic!("Don't know command '{command}'");