Skip to content

Provides soft, non-panicking assertions for Rust.

Notifications You must be signed in to change notification settings

fabianboesiger/soft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soft Assertions

This library provides soft, non-panicking assertions. Instead, the assertions provided by this crate return a Result. To use this crate, simply replace assert!(...) by soft::assert!(...)?.

Example

fn main() {
    soft::panic!(false).unwrap_err();

    soft::assert!(true).unwrap();
    soft::assert!(false).unwrap_err();

    soft::assert_eq!(2, 2).unwrap();
    soft::assert_eq!(2, 3).unwrap_err();
    
    soft::assert_ne!(2, 3).unwrap();
    soft::assert_ne!(2, 2).unwrap_err();
}

About

Provides soft, non-panicking assertions for Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages