Crate boxworks_testing

Crate boxworks_testing 

Source
Expand description

Testing utilities for Boxworks-based code.

This crate makes writing tests for Boxworks code easier. It provides the assert_box_eq macro, which validates that two Boxworks data structures are the same. The data structures can be provided as Rust values from [boxworks::ds], or as Boxworks language strings. If there is a mismatch, the diff is printed nicely.

§Example

let v_box = ds::VBox {
    list: vec![ds::HBox {
        list: vec![
            ds::Char { char: 'A', font: 33 }.into(),
            ds::Char { char: 'Z', font: 33 }.into(),
        ],
        ..Default::default()
    }.into()],
    ..Default::default()
};
assert_box_eq!(
    v_box,
    r#"
    vbox(
      content=[
        hbox(
          content=[
            chars("AZ", 33)
          ]
        )
      ]
    )
    "#,
);

Macros§

assert_box_eq

Enums§

Value

Functions§

assert_eq