Debian Codegraph @

tests/test_chain.rs

raw symbols SCIP
1 use anyhowrust-analyzer cargo anyhow 1.0.103 crate/::{anyhowrust-analyzer cargo anyhow 1.0.103 macros/anyhow!, Chainrust-analyzer cargo anyhow 1.0.103 Chain#, Errorrust-analyzer cargo anyhow 1.0.103 Error#};
2
3 fn errorrust-analyzer cargo anyhow 1.0.103 error().() -> Errorrust-analyzer cargo anyhow 1.0.103 Error# {
4 anyhowrust-analyzer cargo anyhow 1.0.103 macros/anyhow!!({ 0 }).contextrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]context().(1).contextrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]context().(2).contextrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]context().(3)
5 }
6
7 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
8 fn test_iterrust-analyzer cargo anyhow 1.0.103 test_iter().() {
9 let e = errorrust-analyzer cargo anyhow 1.0.103 error().();
10 let mut chain = e.chainrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]chain().();
11 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("3", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
12 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("2", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
13 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("1", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
14 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("0", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
15 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
16 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.next_backrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][DoubleEndedIterator]next_back().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
17 }
18
19 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
20 fn test_revrust-analyzer cargo anyhow 1.0.103 test_rev().() {
21 let e = errorrust-analyzer cargo anyhow 1.0.103 error().();
22 let mut chain = e.chainrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]chain().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().();
23 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("0", chain.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/rev/impl#[`Rev<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
24 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("1", chain.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/rev/impl#[`Rev<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
25 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("2", chain.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/rev/impl#[`Rev<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("3", chain.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/rev/impl#[`Rev<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
27 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/rev/impl#[`Rev<I>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
28 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/rev/impl#[`Rev<I>`][DoubleEndedIterator]next_back().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
29 }
30
31 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
32 fn test_lenrust-analyzer cargo anyhow 1.0.103 test_len().() {
33 let e = errorrust-analyzer cargo anyhow 1.0.103 error().();
34 let mut chain = e.chainrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]chain().();
35 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(4, chain.lenrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][ExactSizeIterator]len().());
36 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((4, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4)), chain.size_hintrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]size_hint().());
37 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("3", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
38 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(3, chain.lenrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][ExactSizeIterator]len().());
39 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((3, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(3)), chain.size_hintrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]size_hint().());
40 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("0", chain.next_backrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][DoubleEndedIterator]next_back().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
41 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(2, chain.lenrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][ExactSizeIterator]len().());
42 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((2, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(2)), chain.size_hintrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]size_hint().());
43 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("2", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
44 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1, chain.lenrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][ExactSizeIterator]len().());
45 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((1, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)), chain.size_hintrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]size_hint().());
46 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("1", chain.next_backrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][DoubleEndedIterator]next_back().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
47 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(0, chain.lenrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][ExactSizeIterator]len().());
48 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)), chain.size_hintrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]size_hint().());
49 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
50 }
51
52 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
53 fn test_defaultrust-analyzer cargo anyhow 1.0.103 test_default().() {
54 let mut c = Chainrust-analyzer cargo anyhow 1.0.103 Chain#::defaultrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][Default]default().();
55 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(c.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
56 }
57
58 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
59 #[allow(clippy::redundant_clone)]
60 fn test_clonerust-analyzer cargo anyhow 1.0.103 test_clone().() {
61 let e = errorrust-analyzer cargo anyhow 1.0.103 error().();
62 let mut chain = e.chainrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]chain().().clonerust-analyzer cargo anyhow 1.0.103 impl#[`Chain<'a>`][Clone]clone().();
63 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("3", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
64 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("2", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
65 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("1", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
66 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("0", chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
67 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.nextrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
68 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(chain.next_backrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'_>`][DoubleEndedIterator]next_back().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
69 }