From: bakaq Date: Mon, 30 Sep 2024 02:45:40 +0000 (-0300) Subject: Document test methods X-Git-Tag: v0.10.0~92^2~16 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=e6cc408ff20df2079f13808c66e2a45e15aaa577;p=scryer-prolog.git Document test methods --- diff --git a/src/machine/mock_wam.rs b/src/machine/mock_wam.rs index 2c7e37d6..a4aba112 100644 --- a/src/machine/mock_wam.rs +++ b/src/machine/mock_wam.rs @@ -232,10 +232,12 @@ pub(crate) fn parse_and_write_parsed_term_to_heap( } impl Machine { + /// For use in tests. pub fn with_test_streams() -> Self { Machine::new(MachineConfig::default().with_streams(StreamConfig::in_memory())) } + /// For use in tests. pub fn test_load_file(&mut self, file: &str) -> Vec { let stream = Stream::from_owned_string( std::fs::read_to_string(AsRef::::as_ref(file)).unwrap(), @@ -246,6 +248,7 @@ impl Machine { self.user_output.bytes().map(|b| b.unwrap()).collect() } + /// For use in tests. pub fn test_load_string(&mut self, code: &str) -> Vec { let stream = Stream::from_owned_string(code.to_owned(), &mut self.machine_st.arena);