diff options
author | iximeow <me@iximeow.net> | 2024-06-20 12:40:53 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-06-20 12:40:53 -0700 |
commit | 89b8aeef32518a0fece8c1283fe83da369113afd (patch) | |
tree | a4ec0d1f214865a3f2f591fe16c4e91654722cb9 /test | |
parent | 55a64ffa7fddc9d8372e4072c554a676e2f0fc17 (diff) |
starting to get new DisplaySink stuff ready to extract...
Diffstat (limited to 'test')
-rw-r--r-- | test/long_mode/mod.rs | 15 |
1 files changed, 7 insertions, 8 deletions
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, |