From 2a9862ae8d8f90a1ee2b2a400dc303947035a353 Mon Sep 17 00:00:00 2001 From: Sameer Puri Date: Sat, 14 Aug 2021 21:14:05 -0400 Subject: [PATCH] lib: correct formatter call in tests --- lib/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/lib.rs b/lib/src/lib.rs index dd1a97c..fa5fbb5 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -17,6 +17,7 @@ pub use turtle::Turtle; #[cfg(test)] mod test { use super::*; + use g_code::emit::{format_gcode_fmt, FormatOptions}; use pretty_assertions::assert_eq; fn get_actual(input: &str) -> String { @@ -27,9 +28,9 @@ mod test { let mut program = converter::svg2program(&document, options, &mut turtle); postprocess::set_origin(&mut program, [0., 0.]); - let mut actual = vec![]; - assert!(tokens_into_gcode_bytes(&program, &mut actual).is_ok()); - String::from_utf8(actual).unwrap() + let mut acc = String::new(); + format_gcode_fmt(&program, FormatOptions::default(), &mut acc).unwrap(); + acc } #[test]