use bwrap::ExistNlPref; use bwrap::Result; use bwrap::WrapStyle; use bwrap::Wrapper; mod ascii { use super::*; #[test] fn _1() -> Result<()> { let before = "hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hhhhh"); Ok(()) } #[test] fn _2() -> Result<()> { let before = "hhhhh hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hhhhh\n---hhhhh"); Ok(()) } #[test] fn _3() -> Result<()> { let before = "hh hhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hh \n---hhh"); Ok(()) } #[test] fn _4() -> Result<()> { let before = "hhhhh hhhhh hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hhhhh\n---hhhhh\n---hhhhh"); Ok(()) } #[test] fn _5() -> Result<()> { let before = "hhhhh hhhhh hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hhhhh\n---hhhhh\n---hhhhh"); Ok(()) } #[test] fn _6() -> Result<()> { let before = " hhhhh hhhhh hhhhh "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b" \n---hhhhh\n---hhhhh\n---hhhhh\n---"); Ok(()) } //- } mod ascii_existnl { use super::*; #[test] fn _1() -> Result<()> { let before = "hhh\nhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hhh\nhh"); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"hhh\nhh"); Ok(()) } #[test] fn _2() -> Result<()> { let before = "hhhhh\n hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hhhhh\n\n---hhhhh"); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"hhhhh\nhhhhh"); Ok(()) } #[test] fn _3() -> Result<()> { let before = "hh \n hhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hh \n \n---hhh"); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"hh \nhhh"); Ok(()) } #[test] fn _33() -> Result<()> { let before = "hh \n \n hhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hh \n \n \n---hhh"); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"hh \n\nhhh"); Ok(()) } #[test] fn _4() -> Result<()> { let before = "hh\nhhh hhh\nhh\n hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"hh\nhhh\n---hhh\nhh\n\n---hhhhh"); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"hh\nhhh\n---hhh\nhh\nhhhhh"); Ok(()) } #[test] fn _5() -> Result<()> { let before = "hh\n\n\nhhh hhh\n\n\nhh\n\n\n hhhhh"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], b"hh\n\n\nhhh\n---hhh\n\n\nhh\n\n\n \n---hhhhh" ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"hh\n\n\nhhh\n---hhh\n\n\nhh\n\n\nhhhhh"); Ok(()) } #[test] fn _6() -> Result<()> { let before = "\nhhhhh hhhhh hhhhh\n"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], b"\nhhhhh\n---hhhhh\n---hhhhh\n"); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], b"\nhhhhh\n---hhhhh\n---hhhhh\n"); Ok(()) } #[test] fn _7() -> Result<()> { let before = "\nh\nh\nh\nh\nh h\nh\nh\nh\nh h\nh\nh\nh\nh\n"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], b"\nh\nh\nh\nh\nh \n---h\nh\nh\nh\nh \n---h\nh\nh\nh\nh\n" ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], b"\nh\nh\nh\nh\nh \n---h\nh\nh\nh\nh \n---h\nh\nh\nh\nh\n" ); Ok(()) } #[test] fn _77() -> Result<()> { let before = "\nh\nh\nh\nh\nh h\nh\nh\nh\nh h\nh\nh\nh\nh\n "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], b"\nh\nh\nh\nh\nh \n---h\nh\nh\nh\nh \n---h\nh\nh\nh\nh\n " ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], b"\nh\nh\nh\nh\nh \n---h\nh\nh\nh\nh \n---h\nh\nh\nh\nh\n" ); Ok(()) } #[test] fn _8() -> Result<()> { let before = "\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\n"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], b"\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\n" ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], b"\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nh\n" ); Ok(()) } //- } mod nonascii { use super::*; #[test] fn _1() -> Result<()> { let before = "HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], "HHHHH".as_bytes()); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], "HHHHH".as_bytes()); Ok(()) } #[test] fn _2() -> Result<()> { let before = "HHHHH HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], "HHHHH\n---HHHHH".as_bytes()); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], "HHHHH\n---HHHHH".as_bytes()); Ok(()) } #[test] fn _3() -> Result<()> { let before = "HHHHH HHHHH HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHHH\n---HHHHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHHH\n---HHHHH".as_bytes() ); Ok(()) } #[test] fn _4() -> Result<()> { let before = "HHHHH HHHHH HHHHH HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHHH\n---HHHHH\n---HHHHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHHH\n---HHHHH\n---HHHHH".as_bytes() ); Ok(()) } #[test] fn _5() -> Result<()> { let before = "HHHHH HHHhH HHHHH HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHhH\n---HHHHH\n---HHHHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHhH\n---HHHHH\n---HHHHH".as_bytes() ); Ok(()) } #[test] fn _7() -> Result<()> { let before = "HHHHH HHHhH HHHHH HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHhH\n---HHHHH\n---HHHHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("---"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHHHH\n---HHHhH\n---HHHHH\n---HHHHH".as_bytes() ); Ok(()) } #[test] fn _8() -> Result<()> { let before = " HHHHH HHHhH HHHHH HHHHH "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 2, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("--"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], " \n--HHHHH\n--HHHhH\n--HHHHH\n--HHHHH\n--".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 2, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("--"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], " \n--HHHHH\n--HHHhH\n--HHHHH\n--HHHHH\n--".as_bytes() ); Ok(()) } } mod nonascii_existnl { use super::*; #[test] fn _1() -> Result<()> { let before = "HHH\nHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], "HHH\nHH".as_bytes()); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], "HHH\nHH".as_bytes()); Ok(()) } #[test] fn _2() -> Result<()> { let before = "HHH\nHH HHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], "HHH\nHH\n⤷⤷⤷HHHHH".as_bytes()); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], "HHH\nHH\n⤷⤷⤷HHHHH".as_bytes()); Ok(()) } #[test] fn _3() -> Result<()> { let before = "HHH\nHH H\nHHHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!(&after[..len], "HHH\nHH H\nHHHH".as_bytes()); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!(&after[..len], "HHH\nHH H\nHHHH".as_bytes()); Ok(()) } #[test] fn _4() -> Result<()> { let before = "HHH\nHH H\nHHHH HHH\nHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH H\nHHHH\n⤷⤷⤷HHH\nHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH H\nHHHH\n⤷⤷⤷HHH\nHH".as_bytes() ); Ok(()) } #[test] fn _44() -> Result<()> { let before = "HHH\nHH H\n HHHH HHH\nHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH H\n\n⤷⤷⤷HHHH\n⤷⤷⤷HHH\nHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH H\nHHHH\n⤷⤷⤷HHH\nHH".as_bytes() ); Ok(()) } #[test] fn _5() -> Result<()> { let before = "HHH\nHH Hh\nHHH HhH\nHH"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH\n⤷⤷⤷Hh\nHHH\n⤷⤷⤷HhH\nHH".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH\n⤷⤷⤷Hh\nHHH\n⤷⤷⤷HhH\nHH".as_bytes() ); Ok(()) } #[test] fn _55() -> Result<()> { let before = "HHH\n HH Hh\nHHH HhH\n HH\n "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "HHH\n HH\n⤷⤷⤷Hh\nHHH\n⤷⤷⤷HhH\n HH\n ".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "HHH\nHH\n⤷⤷⤷Hh\nHHH\n⤷⤷⤷HhH\nHH\n".as_bytes() ); Ok(()) } #[test] fn _6() -> Result<()> { let before = "\nH\nH\nH\nH\nH H\nH\nH\nH\nH H\nH\nH\nH\nH\n"; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "\nH\nH\nH\nH\nH H\nH\nH\nH\nH H\nH\nH\nH\nH\n".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 7, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "\nH\nH\nH\nH\nH H\nH\nH\nH\nH H\nH\nH\nH\nH\n".as_bytes() ); Ok(()) } #[test] fn _7() -> Result<()> { let before = "\nH\nH\nH\nH\nH H\nH\nH\nH\nH H\nH\nH\nH\nH\n"; let mut after = [0u8; 427]; let len = Wrapper::new(before, 2, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], "\nH\nH\nH\nH\nH\n⤷⤷H\nH\nH\nH\nH\n⤷⤷H\nH\nH\nH\nH\n".as_bytes() ); let mut after = [0u8; 427]; let len = Wrapper::new(before, 2, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], "\nH\nH\nH\nH\nH\n⤷⤷H\nH\nH\nH\nH\n⤷⤷H\nH\nH\nH\nH\n".as_bytes() ); Ok(()) } #[test] fn _77() -> Result<()> { // similar to _7 but max_width is 3 let before = " \nH\n H\nH\nH\nH H\nH\n H\nH\nH H\nH\n H\nH\nH\n "; let mut after = [0u8; 660]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], " \nH\n H\nH\nH\nH\n⤷⤷⤷H\nH\n H\nH\nH\n⤷⤷⤷H\nH\n H\nH\nH\n ".as_bytes() ); let mut after = [0u8; 660]; let len = Wrapper::new(before, 3, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], " \nH\nH\nH\nH\nH\n⤷⤷⤷H\nH\nH\nH\nH\n⤷⤷⤷H\nH\nH\nH\nH\n".as_bytes() ); Ok(()) } #[test] fn _8() -> Result<()> { let before = " HHHH\nH HHHhH HHHHH "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 4, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], " \n⤷⤷⤷HHHH\nH \n⤷⤷⤷HHHhH\n⤷⤷⤷HHHHH\n⤷⤷⤷".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 4, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], " \n⤷⤷⤷HHHH\nH \n⤷⤷⤷HHHhH\n⤷⤷⤷HHHHH\n⤷⤷⤷".as_bytes() ); Ok(()) } #[test] fn _9() -> Result<()> { // note , we dont alter existing NL let before = " HHHH\nH HHHhH HHHHH \n "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 4, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], " \n⤷⤷⤷HHHH\nH \n⤷⤷⤷HHHhH\n⤷⤷⤷HHHHH\n⤷⤷⤷\n ".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 4, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], " \n⤷⤷⤷HHHH\nH \n⤷⤷⤷HHHhH\n⤷⤷⤷HHHHH\n⤷⤷⤷\n".as_bytes() ); Ok(()) } #[test] fn _99() -> Result<()> { // note again, we dont alter existing NL let before = " \n HHHH\nH \n HHHhH \n HHHHH \n "; let mut after = [0u8; 1024]; let len = Wrapper::new(before, 4, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::KeepTrailSpc))?; assert_eq!( &after[..len], " \n \n⤷⤷⤷HHHH\nH \n \n⤷⤷⤷HHHhH\n⤷⤷⤷\n \n⤷⤷⤷HHHHH\n⤷⤷⤷\n ".as_bytes() ); let mut after = [0u8; 1024]; let len = Wrapper::new(before, 4, &mut after)? .wrap_use_style(WrapStyle::NoBrk(Some("⤷⤷⤷"), ExistNlPref::TrimTrailSpc))?; assert_eq!( &after[..len], " \nHHHH\nH \nHHHhH\n⤷⤷⤷\nHHHHH\n⤷⤷⤷\n".as_bytes() ); Ok(()) } }