MCPcopy Index your code
hub / github.com/endbasic/endbasic / accept

Method accept

std/src/console/readline.rs:621–639  ·  view source on GitHub ↗

Adds a final return key to the golden input, a newline to the expected output, and executes the test.

(mut self)

Source from the content-addressed store, hash-verified

619 /// Adds a final return key to the golden input, a newline to the expected output, and
620 /// executes the test.
621 fn accept(mut self) {
622 self.keys.push(Key::NewLine);
623 self.exp_output.push(CapturedOut::Print("".to_owned()));
624
625 let mut console = MockConsole::default();
626 console.add_input_keys(&self.keys);
627 console.set_size_chars(self.size_chars);
628 let line = block_on(read_line_interactive(
629 &mut console,
630 self.prompt,
631 self.previous,
632 self.history.as_mut(),
633 self.echo,
634 ))
635 .unwrap();
636 assert_eq!(self.exp_line, &line);
637 assert_eq!(self.exp_output.as_slice(), console.captured_out());
638 assert_eq!(self.exp_history, self.history);
639 }
640
641 /// Executes the test and expects the given error kind.
642 fn expect_err(mut self, exp_kind: io::ErrorKind) {

Calls 4

read_line_interactiveFunction · 0.85
pushMethod · 0.80
add_input_keysMethod · 0.80
set_size_charsMethod · 0.45