mirror of
https://github.com/zerotier/DesktopUI.git
synced 2026-09-23 00:28:30 -07:00
21 lines
433 B
Rust
21 lines
433 B
Rust
#[macro_use]
|
|
extern crate failure;
|
|
|
|
use failure::Fail;
|
|
|
|
#[test]
|
|
fn test_name() {
|
|
#[derive(Fail, Debug)]
|
|
#[fail(display = "my error")]
|
|
struct MyError;
|
|
|
|
let err = MyError;
|
|
|
|
assert_eq!(err.to_string(), "my error");
|
|
assert_eq!(err.name(), Some("basic_fail::MyError"));
|
|
|
|
let ctx = err.context("whatever");
|
|
|
|
assert_eq!(ctx.to_string(), "whatever");
|
|
assert_eq!(ctx.name(), Some("basic_fail::MyError"));
|
|
} |