#pretty-table #assert

no-std testing_table

An easy to use library for pretty print tables of Rust structs and enums

4 releases (2 breaking)

0.3.0 Apr 24, 2025
0.2.0 Nov 22, 2024
0.1.1 Aug 5, 2024
0.1.0 Aug 5, 2024

#368 in Testing

Download history 214/week @ 2025-03-12 363/week @ 2025-03-19 21/week @ 2025-03-26 70/week @ 2025-04-02 112/week @ 2025-04-09 202/week @ 2025-04-16 6323/week @ 2025-04-23 9924/week @ 2025-04-30 12783/week @ 2025-05-07 22872/week @ 2025-05-14 29439/week @ 2025-05-21 33698/week @ 2025-05-28 31810/week @ 2025-06-04 42787/week @ 2025-06-11 34567/week @ 2025-06-18 41053/week @ 2025-06-25

155,792 downloads per month
Used in 33 crates (2 directly)

MIT license

8KB
91 lines

Crate provides a convinient functions for work with tables.

use testing_table::test_table;

test_table!(
    test_tabled,
    tabled::Table::new([[1, 2, 3]]),
    "+---+---+---+"
    "| 0 | 1 | 2 |"
    "+---+---+---+"
    "| 1 | 2 | 3 |"
    "+---+---+---+"
);
use testing_table::assert_table;

assert_table!(
    tabled::Table::new([[1, 2, 3]]),
    "+---+---+---+"
    "| 0 | 1 | 2 |"
    "+---+---+---+"
    "| 1 | 2 | 3 |"
    "+---+---+---+"
);
use testing_table::static_table;

static_table!(
    "+---+---+---+"
    "| 0 | 1 | 2 |"
    "+---+---+---+"
    "| 1 | 2 | 3 |"
    "+---+---+---+"
);

It was developed as a sub-project of tabled.


testing_table

A library which provides handy macros for table testing.

Includes

  • test_table!
  • static_table!
  • assert_table!
  • assert_width!
use testing_table::{test_table, assert_table, static_table};

test_table!(
    test_tabled,
    tabled::Table::new([[1, 2, 3]]),
    "+---+---+---+"
    "| 0 | 1 | 2 |"
    "+---+---+---+"
    "| 1 | 2 | 3 |"
    "+---+---+---+"
);

assert_table!(
    tabled::Table::new([[1, 2, 3]]),
    "+---+---+---+"
    "| 0 | 1 | 2 |"
    "+---+---+---+"
    "| 1 | 2 | 3 |"
    "+---+---+---+"
);

static_table!(
    "+---+---+---+"
    "| 0 | 1 | 2 |"
    "+---+---+---+"
    "| 1 | 2 | 3 |"
    "+---+---+---+"
);

Dependencies

~2MB
~26K SLoC