From 01fe27a77a08c932b6457f1621796a57e6b866d7 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 23 Jun 2024 21:54:03 -0700 Subject: fix InstructionTextSink panicking in write_char --- tests/display.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/display.rs b/tests/display.rs index a6d6eb1..8826303 100644 --- a/tests/display.rs +++ b/tests/display.rs @@ -19,6 +19,35 @@ fn formatters_are_not_feature_gated() { #[cfg(feature="alloc")] #[test] +fn instruction_text_sink_write_char_requires_ascii() { + use core::fmt::Write; + + let mut text = String::with_capacity(512); + let mut sink = unsafe { + yaxpeax_arch::display::InstructionTextSink::new(&mut text) + }; + let expected = "`1234567890-=+_)(*&^%$#@!~\\][poiuytrewq |}{POIUYTREWQ';lkjhgfdsa\":LKJHGFDSA/.,mnbvcxz?>