1
use crate::error::{
2
    AccountError, CommodityError, FinanceError, PriceError, SplitError, TransactionError,
3
};
4

            
5
#[test]
6
1
fn every_domain_error_shows_its_detail() {
7
1
    let cases = [
8
1
        (
9
1
            FinanceError::from(CommodityError::NoSymbol("c-1".into())),
10
1
            "Can't find symbol for the commodity c-1",
11
1
        ),
12
1
        (
13
1
            FinanceError::from(SplitError::Build("s-1".into())),
14
1
            "Can't build the split s-1",
15
1
        ),
16
1
        (
17
1
            FinanceError::from(PriceError::Build("p-1".into())),
18
1
            "Can't build the price p-1",
19
1
        ),
20
1
        (
21
1
            FinanceError::from(TransactionError::ZeroSum),
22
1
            "Transaction sum is not zero",
23
1
        ),
24
1
        (
25
1
            FinanceError::from(AccountError::Build("a-1".into())),
26
1
            "Can't build the account a-1",
27
1
        ),
28
1
    ];
29
1
    for (error, shown) in cases {
30
5
        assert_eq!(error.to_string(), shown);
31
    }
32
1
}