start adding output checks to test
This commit is contained in:
@@ -441,9 +441,11 @@ pub fn print(wam: &mut Machine, result: EvalSession) {
|
||||
|
||||
loop {
|
||||
let mut result = EvalSession::QueryFailure;
|
||||
let bindings = wam.heap_view::<PrinterOutputter>(&heap_locs);
|
||||
let mut output = PrinterOutputter::new();
|
||||
|
||||
let bindings = wam.heap_view(&heap_locs, output).result();
|
||||
|
||||
let stdin = stdin();
|
||||
let stdin = stdin();
|
||||
let mut stdout = stdout().into_raw_mode().unwrap();
|
||||
|
||||
write!(stdout, "{}", bindings).unwrap();
|
||||
|
||||
@@ -349,11 +349,9 @@ impl Machine {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn heap_view<Outputter>(&self, var_dir: &HeapVarDict) -> Outputter::Output
|
||||
pub fn heap_view<Outputter>(&self, var_dir: &HeapVarDict, mut output: Outputter) -> Outputter
|
||||
where Outputter: HeapCellValueOutputter
|
||||
{
|
||||
let mut output = Outputter::new();
|
||||
|
||||
for (var, addr) in var_dir {
|
||||
output.begin_new_var();
|
||||
|
||||
@@ -363,7 +361,7 @@ impl Machine {
|
||||
output = self.ms.print_term(addr, TermFormatter {}, output);
|
||||
}
|
||||
|
||||
output.result()
|
||||
output
|
||||
}
|
||||
|
||||
pub fn or_stack_is_empty(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user