Add test for iolist_to_binary with ProcBin
use crate::otp;
use crate::scheduler::with_process;
use liblumen_alloc::badarg;
-use liblumen_alloc::erts::term::prelude::Atom;
+use liblumen_alloc::erts::term::prelude::*;
// > Bin1 = <<1,2,3>>.
// <<1,2,3>>
@@ -57,6 +57,27 @@ fn with_binary_returns_binary() {
});
}
+#[test]
+fn with_procbin_in_list_returns_binary() {
+ with_process(|process| {
+ let bytes = [7; 65];
+ let procbin = process.binary_from_bytes(&bytes).unwrap();
+ // We expect this to be a procbin, since it's > 64 bytes. Make sure it is.
+ assert!(procbin.is_boxed_procbin());
+ let iolist = process
+ .list_from_slice(&[
+ procbin
+ ]).unwrap();
+
+ assert_eq!(
+ otp::erlang::iolist_to_binary_1::native(process, iolist),
+ Ok(process
+ .binary_from_bytes(&bytes)
+ .unwrap())
+ )
+ });
+}
+
#[test]
fn with_subbinary_in_list_returns_binary() {
with_process(|process| {
