Skip to content

Commit

Permalink
new preset "ASCII_FULL_CONDENSED"
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Dec 30, 2022
1 parent 2c018c3 commit 307dc1d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/style/presets.rs
Expand Up @@ -11,7 +11,18 @@
/// ```
pub const ASCII_FULL: &str = "||--+==+|-+||++++++";

/// Default style without any borders.
/// Just like ASCII_FULL, but without dividers between rows.
///
/// ```text
/// +-------+-------+
/// | Hello | there |
/// +===============+
/// | a | b |
/// | c | d |
/// +-------+-------+
pub const ASCII_FULL_CONDENSED: &str = "||--+==+| ++++++";

/// Just like ASCII_FULL, but without any borders.
///
/// ```text
/// Hello | there
Expand Down Expand Up @@ -84,7 +95,7 @@ pub const ASCII_MARKDOWN: &str = "|| |-||| ";
/// ```
pub const UTF8_FULL: &str = "││──╞═╪╡┆╌┼├┤┬┴┌┐└┘";

/// Default UTF8 style, but without spacing between rows.
/// Default UTF8 style, but without dividers between rows.
///
/// ```text
/// ┌───────┬───────┐
Expand Down
18 changes: 17 additions & 1 deletion tests/all/presets_test.rs
Expand Up @@ -30,6 +30,22 @@ fn test_ascii_full() {
assert_eq!("\n".to_string() + &table.to_string(), expected);
}

#[test]
fn test_ascii_full_condensed() {
let mut table = get_preset_table();
table.load_preset(ASCII_FULL_CONDENSED);
println!("{table}");
let expected = "
+-------+-------+
| Hello | there |
+===============+
| a | b |
| c | d |
+-------+-------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.trim_fmt(), expected);
}

#[test]
fn test_ascii_no_borders() {
let mut table = get_preset_table();
Expand Down Expand Up @@ -127,7 +143,7 @@ fn test_utf8_full() {
}

#[test]
fn test_utf8_condensed() {
fn test_utf8_full_condensed() {
let mut table = get_preset_table();
table.load_preset(UTF8_FULL_CONDENSED);
println!("{table}");
Expand Down

0 comments on commit 307dc1d

Please sign in to comment.