From c4e004bdf8ee19c4e5945628255851d5498dd400 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 19 Feb 2022 02:23:38 +0100 Subject: [PATCH] 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] * Update `tabled` format; add test Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthias --- Cargo.lock | 8 ++++---- lychee-bin/Cargo.toml | 2 +- lychee-bin/src/writer/markdown.rs | 26 ++++++++++++++++++++++++-- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13ff4cf..ee09247 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/lychee-bin/Cargo.toml b/lychee-bin/Cargo.toml index ef324fc..e67758e 100644 --- a/lychee-bin/Cargo.toml +++ b/lychee-bin/Cargo.toml @@ -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" diff --git a/lychee-bin/src/writer/markdown.rs b/lychee-bin/src/writer/markdown.rs index 5c56e4e..958c040 100644 --- a/lychee-bin/src/writer/markdown.rs +++ b/lychee-bin/src/writer/markdown.rs @@ -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()); + } +}