zng/tests
Samuel e4afb24484
Implement custom cursors. (#178)
2024-05-01 17:09:29 -03:00
..
macro-tests Implement custom cursors. (#178) 2024-05-01 17:09:29 -03:00
Cargo.toml Reorganize project (#111) 2024-04-17 13:19:59 -03:00
README.md Reorganize project (#111) 2024-04-17 13:19:59 -03:00
command.rs Changed instances of 'zero_ui' to 'zng'. 2024-03-26 21:12:13 -03:00
config.rs Fix config errors (#115) 2024-04-17 19:02:37 -03:00
focus.rs Fix many typos. (#87) 2024-04-11 01:27:49 -03:00
image.rs Add issue and pull request templates. 2024-04-10 15:20:05 -03:00
text.rs Changed instances of 'zero_ui' to 'zng'. 2024-03-26 21:12:13 -03:00
var.rs Rename `VarCapabilities` to `VarCapability` (#155) 2024-04-28 12:19:07 -03:00

README.md

Tests

This directory contains integration and macro tests or any test that is not a unit test.

Running

Use cargo do test -t command to run tests in the ./command.rs file.

Use cargo do test -m * to run all macro tests.

Use cargo do test -m property/* to run build test cases that match the path relative to ./macro-tests/cases.

Adding an Integration Test

To add an integration test, create a file then add it in ./Cargo.toml as a [[bin]].

In ./foo.rs:

use zng::prelude::*;

#[test]
fn foo() {
    assert!(true);
}

Then add in ./Cargo.toml:

[[test]]
name = "foo"
path = "foo.rs"

Then run from the project root using cargo do test -t foo.

Adding a Macro Test

Macro tests verify the write output of compile time error messages. To add a test simply add a file in ./macro-tests/cases/<category>/<test>.rs and then call do test -m <category>/<test>. The first run will generate a <test>.stderr file that you can review.