Add simple DotWriter

This commit is contained in:
Dennis
2024-06-05 14:58:41 +02:00
parent 995eaec555
commit 20708b0ff8
5 changed files with 54 additions and 278 deletions
+41
View File
@@ -0,0 +1,41 @@
use std::io::{self, Write};
use cucumber::{cli, event, parser, Event};
pub struct CustomWriter;
impl<W: 'static> cucumber::Writer<W> for CustomWriter {
type Cli = cli::Empty; // we provide no CLI options
async fn handle_event(&mut self, ev: parser::Result<Event<event::Cucumber<W>>>, _: &Self::Cli) {
match ev {
Ok(Event { value, .. }) => match value {
event::Cucumber::Feature(_feature, ev) => match ev {
event::Feature::Started => {
print!(".")
}
event::Feature::Scenario(_scenario, ev) => match ev.event {
event::Scenario::Started => {
print!(".")
}
event::Scenario::Step(_step, ev) => match ev {
event::Step::Started => {
print!(".")
}
event::Step::Passed(..) => print!("."),
event::Step::Skipped => print!("-"),
event::Step::Failed(_, _, _, _err) => {
print!("x")
}
},
_ => {}
},
_ => {}
},
_ => {}
},
Err(e) => println!("Error: {e}"),
}
let _ = io::stdout().flush();
}
}
+1
View File
@@ -1,4 +1,5 @@
pub mod cli_arguments;
pub mod dot_writer;
pub mod f64_utils;
pub mod file_util;
pub mod hash_util;
+1 -2
View File
@@ -98,7 +98,7 @@ impl OSRMWorld {
}
pub fn get_location(&self, name: char) -> Point {
match name {
*match name {
// TODO: move lookup to world
'0'..='9' => self
.known_locations
@@ -110,7 +110,6 @@ impl OSRMWorld {
.expect("test case specifies unknown osm node: {name}"),
_ => unreachable!("nodes have to be name in [0-9][a-z]"),
}
.clone()
}
pub fn add_location(&mut self, name: char, location: Point) {