Add a RocBox test and pub use it

This commit is contained in:
Richard Feldman 2022-06-09 22:25:06 -04:00
parent 67bec4828e
commit a668cd67e0
No known key found for this signature in database
GPG Key ID: 7E4127D1E4241798
2 changed files with 10 additions and 1 deletions

View File

@ -16,6 +16,7 @@ mod roc_list;
mod roc_str;
mod storage;
pub use roc_box::RocBox;
pub use roc_list::RocList;
pub use roc_str::{InteriorNulError, RocStr};
pub use storage::Storage;

View File

@ -59,7 +59,7 @@ pub unsafe extern "C" fn roc_memset(dst: *mut c_void, c: i32, n: usize) -> *mut
#[cfg(test)]
mod test_roc_std {
use roc_std::{RocDec, RocList, RocResult, RocStr};
use roc_std::{RocBox, RocDec, RocList, RocResult, RocStr};
fn roc_str_byte_representation(string: &RocStr) -> [u8; RocStr::SIZE] {
unsafe { core::mem::transmute_copy(string) }
@ -189,6 +189,14 @@ mod test_roc_std {
assert!(roc_result.is_err());
}
#[test]
fn create_roc_box() {
let contents = 42;
let roc_box = RocBox::new(contents);
assert_eq!(roc_box.into_inner(), contents)
}
#[test]
fn roc_dec_fmt() {
assert_eq!(