Basic WebAssembly support with minimal Javascript API #615. Currently 6/12 crypto functions supported. Tested in browser with all default features disabled.
This commit is contained in:
@@ -332,6 +332,19 @@ impl Machine {
|
||||
self.load_file(file.into(), stream);
|
||||
self.user_output.bytes().map(|b| b.unwrap()).collect()
|
||||
}
|
||||
|
||||
pub fn test_load_string(&mut self, code: &str) -> Vec<u8> {
|
||||
use std::io::Read;
|
||||
|
||||
let stream = Stream::from_owned_string(
|
||||
code.to_owned(),
|
||||
&mut self.machine_st.arena,
|
||||
);
|
||||
|
||||
self.load_file("<stdin>".into(), stream);
|
||||
self.user_output.bytes().map(|b| b.unwrap()).collect()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user