Skip to content

Commit

Permalink
The IonValueFormatter now uses the correct s-exp delimiter (#408)
Browse files Browse the repository at this point in the history
Previously, the IonValueFormatter (which is used in the `Display`
impl for the `Element` API) would use commas to delimit child
values in an s-expression. Commas are the delimiter for list values
and struct fields, but s-expressions simply use whitespace.

Following this change, s-expression values are delimited with a
single space.

Fixes #403.
  • Loading branch information
zslayton committed Aug 10, 2022
1 parent e1d0707 commit cebec11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/text/text_formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ impl<'a, W: std::fmt::Write> IonValueFormatter<'a, W> {
let sexp_value = peekable_itr.next().unwrap();
write!(self.output, "{}", sexp_value)?;
if peekable_itr.peek() != None {
write!(self.output, ", ")?;
write!(self.output, " ")?;
}
}
write!(self.output, " )")?;
Expand Down Expand Up @@ -650,7 +650,7 @@ mod formatter_test {
vec!["hello".to_owned().into(), 5.into(), true.into()].into_iter(),
))
},
"( \"hello\", 5, true )",
"( \"hello\" 5 true )",
);
Ok(())
}
Expand Down

0 comments on commit cebec11

Please sign in to comment.