Debian Codegraph @

tests/iteratom.rs

raw symbols SCIP
1 // (c) 2017 Productize SPRL <[email protected]>
2
3 extern crate symbolic_expressionsrust-analyzer cargo symbolic_expressions 5.0.3 symbolic_expressions/;
4
5 use symbolic_expressionsrust-analyzer cargo symbolic_expressions 5.0.3 crate/::SexpErrorrust-analyzer cargo symbolic_expressions 5.0.3 error/SexpError#;
6 use symbolic_expressionsrust-analyzer cargo symbolic_expressions 5.0.3 crate/::iteratomrust-analyzer cargo symbolic_expressions 5.0.3 iteratom/::*;
7 use symbolic_expressionsrust-analyzer cargo symbolic_expressions 5.0.3 crate/::Sexprust-analyzer cargo symbolic_expressions 5.0.3 sexp/Sexp#;
8
9 struct Qqrust-analyzer cargo symbolic_expressions 5.0.3 Qq#(i64);
10
11 impl FromSexprust-analyzer cargo symbolic_expressions 5.0.3 iteratom/FromSexp# for Qqrust-analyzer cargo symbolic_expressions 5.0.3 Qq# {
12 fn from_sexprust-analyzer cargo symbolic_expressions 5.0.3 impl#[Qq][FromSexp]from_sexp().(s: &Sexprust-analyzer cargo symbolic_expressions 5.0.3 sexp/Sexp#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo symbolic_expressions 5.0.3 impl#[Qq][FromSexp], SexpErrorrust-analyzer cargo symbolic_expressions 5.0.3 error/SexpError#> {
13 let i = s.named_value_irust-analyzer cargo symbolic_expressions 5.0.3 sexp/impl#[Sexp]named_value_i().("d")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
14 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Qqrust-analyzer cargo symbolic_expressions 5.0.3 Qq#(i))
15 }
16 }
17
18
19 fn test_intrust-analyzer cargo symbolic_expressions 5.0.3 test_int().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), SexpErrorrust-analyzer cargo symbolic_expressions 5.0.3 error/SexpError#> {
20 let s = "(a (b c) (d 42))";
21 let s = symbolic_expressionsrust-analyzer cargo symbolic_expressions 5.0.3 crate/::parserrust-analyzer cargo symbolic_expressions 5.0.3 parser/::parse_strrust-analyzer cargo symbolic_expressions 5.0.3 parser/parse_str().(s)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
22 let mut i = IterAtomrust-analyzer cargo symbolic_expressions 5.0.3 iteratom/IterAtom#::newrust-analyzer cargo symbolic_expressions 5.0.3 iteratom/impl#[`IterAtom<'a>`]new().(&s, "a")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
23 let c = i.s_in_listrust-analyzer cargo symbolic_expressions 5.0.3 iteratom/impl#[`IterAtom<'a>`]s_in_list().("b")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
24 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&c, "c");
25 let e: Qqrust-analyzer cargo symbolic_expressions 5.0.3 Qq# = i.trust-analyzer cargo symbolic_expressions 5.0.3 iteratom/impl#[`IterAtom<'a>`]t().("d")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.0rust-analyzer cargo symbolic_expressions 5.0.3 Qq#0., 42);
27 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
28 }
29
30 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
31 fn test_iteratomrust-analyzer cargo symbolic_expressions 5.0.3 test_iteratom().() {
32 test_intrust-analyzer cargo symbolic_expressions 5.0.3 test_int().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
33 }