zng/tests
Samuel 6b9bdf355b
Fix config errors (#115)
First, the errors are only logged, enabled test_log so now config tests fail for log errors.

The issue was caused by conversions of number types between TomlValue and YamlValue. Serde JSON does not implicit cast
floats to integers, and we converted to float first. Changing the order of conversion fixed the issue.
2024-04-17 19:02:37 -03:00
..
macro-tests Reorganize project (#111) 2024-04-17 13:19:59 -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 Add retries for Windows tests. 2024-04-08 20:05:31 -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.