Skip to content

Commit

Permalink
Added tarpaulin job to bacon.toml and bacon jobs to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
RRArny committed Nov 2, 2024
1 parent 9604a3f commit b0a65bd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ For wxfetch to work you will need a free account on https://avwx.rest/. Once you
# Building from source

Wxfetch is written in Rust. In order to build it, run `cargo build` for a debug build, for a production build run `cargo build --release`. This will generate a binary file within the `target` directory in the `debug` and `release` subdirectories respectively.

For working on Wxfetch this repository includes a bacon configuration. Run `bacon` to have a variety of jobs at your disposal. `bacon clippy` (or using the 'c' key) will run the clippy linter at a pedantic level. `bacon test` (or 't') will run the unit tests. `bacon tarpaulin` (or 'alt-t') will calculate the code coverage using the `tarpaulin` plugin. You can install bacon using `cargo install bacon`.
7 changes: 6 additions & 1 deletion bacon.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# You can also check bacon's own bacon.toml file
# as an example: https://github.com/Canop/bacon/blob/main/bacon.toml

default_job = "check"
default_job = "clippy"

[jobs.check]
command = ["cargo", "check", "--color", "always"]
Expand All @@ -24,6 +24,10 @@ command = [
]
need_stdout = false

[jobs.tarpaulin]
command = ["cargo", "tarpaulin", "--color", "always"]
need_stdout = true

[jobs.clippy-all]
command = [
"cargo", "clippy",
Expand Down Expand Up @@ -87,3 +91,4 @@ allow_warnings = true
[keybindings]
# alt-m = "job:my-job"
c = "job:clippy" # comment this to have 'c' run clippy on only the default target
alt-t = "job:tarpaulin"
24 changes: 24 additions & 0 deletions src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,27 @@ async fn get_geoip() -> Option<LatLong> {

Some(LatLong(lat, long))
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn test_display_latlong() {
let latlon = LatLong(51.4, 8.5);
let expected = "51.4,8.5";
let actual = latlon.to_string();
// let actual = format!("{latlon}");
assert!(expected == actual);
}

// #[test]
// async fn test_locstr_icao() {
// let icao = Position::Airfield("EDDF".to_string());
// let expected = "EDDF";
// let actual = icao.get_location_str().await;
// assert!(expected == actual);
// }
// #[test]
// fn test_locstr_latlon() {}
}

0 comments on commit b0a65bd

Please sign in to comment.