From 89b8aeef32518a0fece8c1283fe83da369113afd Mon Sep 17 00:00:00 2001 From: iximeow Date: Thu, 20 Jun 2024 12:40:53 -0700 Subject: starting to get new DisplaySink stuff ready to extract... --- test/long_mode/mod.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index 24df133..dcc9aad 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -15,18 +15,20 @@ use std::fmt::Write; use yaxpeax_arch::{AddressBase, Decoder, LengthedInstruction}; use yaxpeax_x86::long_mode::InstDecoder; +/* #[test] #[cfg(feature="std")] fn test_write_hex_specialization() { use crate::yaxpeax_x86::long_mode::DisplaySink; for i in 0..0xffu8 { - let mut out = yaxpeax_x86::long_mode::BigEnoughString::new(); + let mut out = yaxpeax_x86::long_mode::InstructionFormatter::new(); out.write_char('0').unwrap(); out.write_char('x').unwrap(); out.write_u8(i).unwrap(); assert_eq!(out.into_inner(), format!("0x{:x}", i)); } } +*/ fn test_invalid(data: &[u8]) { test_invalid_under(&InstDecoder::default(), data); @@ -76,13 +78,11 @@ fn test_display_under(decoder: &InstDecoder, data: &[u8], expected: &'static str expected ); - let mut text2 = yaxpeax_x86::long_mode::BigEnoughString::new(); + let mut text2 = String::new(); let mut out = yaxpeax_x86::long_mode::NoColorsSink { out: &mut text2, }; instr.write_to(&mut out).expect("printing succeeds"); - core::mem::drop(out); - let text2 = text2.into_inner(); assert!( text2 == text, @@ -94,13 +94,12 @@ fn test_display_under(decoder: &InstDecoder, data: &[u8], expected: &'static str text, ); - let mut text3 = yaxpeax_x86::long_mode::BigEnoughString::new(); - instr.write_to(&mut text3).expect("printing succeeds"); - let text3 = text3.into_inner(); + let mut formatter = yaxpeax_x86::long_mode::InstructionFormatter::new(); + let text3 = formatter.format_inst(&instr).expect("printing succeeds"); assert!( text3 == text, - "display error through BigEnoughString for {}:\n decoded: {:?} under decoder {}\n displayed: {}\n expected: {}\n", + "display error through InstructionFormatter for {}:\n decoded: {:?} under decoder {}\n displayed: {}\n expected: {}\n", hex, instr, decoder, -- cgit v1.1