✅ fix up tests
parent
2a171a8e27
commit
6630002a34
28
src/main.rs
28
src/main.rs
|
@ -371,34 +371,6 @@ fn main () -> Result <()> {
|
|||
|
||||
#[cfg (test)]
|
||||
mod test {
|
||||
use super::{
|
||||
Io,
|
||||
GameError,
|
||||
Result,
|
||||
State,
|
||||
};
|
||||
|
||||
struct TestIo {
|
||||
inputs: Vec <String>,
|
||||
input_idx: usize,
|
||||
}
|
||||
|
||||
impl Io for TestIo {
|
||||
fn print (&mut self, _s: &str) {}
|
||||
|
||||
fn read_input (&mut self) -> Result <String> {
|
||||
if self.input_idx >= self.inputs.len () {
|
||||
return Err (GameError::IoError);
|
||||
}
|
||||
|
||||
let s = self.inputs [self.input_idx].clone ();
|
||||
self.input_idx += 1;
|
||||
Ok (s)
|
||||
}
|
||||
|
||||
fn sleep (&mut self, _milliseconds: u32) {}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_input () {
|
||||
use super::{
|
||||
|
|
Loading…
Reference in New Issue