Bump tabled from 0.4.2 to 0.5.0 (#505)

* Bump tabled from 0.4.2 to 0.5.0

Bumps [tabled](https://github.com/zhiburt/tabled) from 0.4.2 to 0.5.0.
- [Release notes](https://github.com/zhiburt/tabled/releases)
- [Changelog](https://github.com/zhiburt/tabled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zhiburt/tabled/compare/v0.4.2...v0.5.0)

---
updated-dependencies:
- dependency-name: tabled
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update `tabled` format; add test

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias <matthias-endler@gmx.net>
This commit is contained in:
dependabot[bot] 2022-02-19 02:23:38 +01:00 committed by GitHub
parent ba276cd51b
commit c4e004bdf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 7 deletions

8
Cargo.lock generated
View file

@ -2130,9 +2130,9 @@ dependencies = [
[[package]]
name = "papergrid"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daff3d017ba874371c984a4eb5662e446362f13d11ee6bdb7fadbe1e3c223333"
checksum = "2c2b5b9ea36abb56e4f8a29889e67f878ebc4ab43c918abe32e85a012d27b819"
dependencies = [
"unicode-width",
]
@ -3082,9 +3082,9 @@ dependencies = [
[[package]]
name = "tabled"
version = "0.4.2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a0dca82254bf1031c194833992b10c8a8148a8f4966ae2d3b0afdabcb1bb4c8"
checksum = "85fda0a52a50c85604747c6584cc79cfe6c7b6ee2349ffed082f965bdbef77ef"
dependencies = [
"papergrid",
"tabled_derive",

View file

@ -36,7 +36,7 @@ ring = "0.16.20"
serde = { version = "1.0.133", features = ["derive"] }
serde_json = "1.0.79"
structopt = "0.3.26"
tabled = "0.4.2"
tabled = "0.5.0"
tokio = { version = "1.16.1", features = ["full"] }
toml = "0.5.8"
futures = "0.3.21"

View file

@ -2,7 +2,7 @@ use std::fmt::{self, Display};
use super::StatsWriter;
use anyhow::Result;
use tabled::{style::Line, Alignment, Full, Modify, Table, Tabled};
use tabled::{Alignment, Full, Modify, Table, Tabled};
use crate::stats::ResponseStats;
@ -45,7 +45,7 @@ fn stats_table(stats: &ResponseStats) -> String {
count: stats.errors + stats.failures,
},
];
let style = tabled::Style::GITHUB_MARKDOWN.header(Some(Line::bordered('-', '|', '|', '|')));
let style = tabled::Style::github_markdown().header_intersection('|');
Table::new(stats)
.with(Modify::new(Full).with(Alignment::left()))
@ -99,3 +99,25 @@ impl StatsWriter for Markdown {
Ok(markdown.to_string())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_render_markdown_table() {
let stats = ResponseStats::new();
let table = stats_table(&stats);
let expected = r#"| Status | Count |
|---------------|-------|
| 🔍 Total | 0 |
| Successful | 0 |
| Timeouts | 0 |
| 🔀 Redirected | 0 |
| 👻 Excluded | 0 |
| Unknown | 0 |
| 🚫 Errors | 0 |
"#;
assert_eq!(table, expected.to_string());
}
}