#attributes #gba #macro #test-macro #test #no-alloc

macro no-std gba_test_macros

#[test] attribute for writing tests to be run on the Game Boy Advance

2 releases

0.1.1 Jun 6, 2024
0.1.0 Jun 6, 2024

#20 in #gba


Used in gba_test

MIT/Apache

10KB
72 lines

gba_test_macros

GitHub Workflow Status crates.io docs.rs License

Provides the #[test] attribute for annotating tests that should be run on the Game Boy Advance.

Installation

This crate is meant to be used with the gba_test crate. In most cases, it is easiest to simply use gba_test with the macros feature enabled by specifying the following in your Cargo.toml:

[dependencies]
gba_test = {version = "0.1.0", features = ["macros"]}

gba_test's macros feature is enabled by default.

Usage

You can use the provided #[test] attribute to write tests in the same way you would normally write tests in Rust:

#![feature(custom_test_frameworks)]

#[cfg(test)]
mod tests {
    use gba_test_runner::test;

    #[test]
    fn it_works() {
        let result = 2 + 2;
        assert_eq!(result, 4);
    }
}

Note that you should use the #[test] attribute provided by this crate, not the default #[test] attribute.

Also note that use of this macro currently depends on the custom_test_frameworks unstable Rust feature. As such, you will need to enable it in any crate that writes tests using this crate.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~240–690KB
~16K SLoC