Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

aiooss-ledger/embedded_test_harness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedded test harness for Rust no_std

Only supports ARM Cortex-M semi-hosting for now.

How to use

Add embedded_test_harness and testmacro = { git = "https://github.com/yhql/testmacro"} to Cargo.toml dev-dependencies.

Then you may write tests following this template:

#![no_std]
#![cfg_attr(test, no_main)]
#![reexport_test_harness_main = "test_main"]
#![feature(custom_test_frameworks)]
#![test_runner(test_runner)]

use panic_semihosting as _;

#[cfg(test)]
use embedded_test_harness::test_runner;

#[cfg(test)]
mod tests {
    use testmacro::test_item as test;
    use embedded_test_harness::TestType;

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

/// _start is the entrypoint specified in the linker
#[no_mangle]
pub fn _start() -> ! {
    #[cfg(test)]
    test_main();

    loop {}
}

References

About

WIP Rust no_std test harness (supports only ARM Cortex-M for now)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages