Skip to content

Commit

Permalink
trim whitespace when parsing handles
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Sep 13, 2021
1 parent 76c334d commit 00a6284
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/code_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl CodePair {
impl CodePair {
pub(crate) fn as_handle(&self) -> DxfResult<Handle> {
let mut bytes = vec![];
parse_hex_string(&self.assert_string()?, &mut bytes, self.offset)?;
parse_hex_string(&self.assert_string()?.trim(), &mut bytes, self.offset)?;
while bytes.len() < 8 {
bytes.insert(0, 0);
}
Expand Down Expand Up @@ -148,6 +148,10 @@ mod tests {
.as_handle()
.unwrap()
);
assert_eq!(
Handle(0xAB),
CodePair::new_str(0, " AB ").as_handle().unwrap()
);
}

#[test]
Expand Down

0 comments on commit 00a6284

Please sign in to comment.