Debian Codegraph @

tests/tagfile.rs

raw symbols SCIP
1 mod tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/ {
2 use rust_aptrust-analyzer cargo rust-apt 0.8.0 crate/::tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/::{selfrust-analyzer cargo rust-apt 0.8.0 tagfile/, TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#};
3
4 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
5 fn correctrust-analyzer cargo rust-apt 0.8.0 tagfile/correct().() {
6 let control_file = include_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_str!!("files/tagfile/correct.control");
7 let dpkg_status = include_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_str!!("/var/lib/dpkg/status");
8 let control_sections: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str> = control_file.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("\n\n").collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
9 let control_section_one = TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#::newrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]new().(control_sections.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
10 let control_section_two = TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#::newrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]new().(control_sections.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
11
12 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/::parse_tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/parse_tagfile().(dpkg_status).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
13 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/::parse_tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/parse_tagfile().(control_file).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
14 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#::newrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]new().(control_file).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
15 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
16 TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#::newrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]new().("This-Is-Not-A-Valid-Control-File-Because-Its-Not-Colon-Separated")
17 .is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()
18 );
19
20 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_one.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Package").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "pkg1");
21 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_one.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Version").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "1.0.0");
22 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_one.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Description").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "pkgdesc1");
23 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
24 control_section_one.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Multi-Line").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
25 "Wow\n This is\n Multiple lines!"
26 );
27 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_one.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Back-To").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "Normal");
28 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
29 control_section_one
30 .getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Not-A-Key-In-The-Control-File")
31 .is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()
32 );
33
34 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_two.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Package").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "pkg2");
35 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_two.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Version").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "2.0.0");
36 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(control_section_two.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Description").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "pkgdesc2");
37 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
38 control_section_two.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Value-Starts-On-Newline").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
39 "\n Well that's interesting!\n It's nice that this isn't failing the test, isn't \
40 it??"
41 );
42 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
43 control_section_two.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Normal-Line").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
44 "Once again"
45 );
46 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
47 control_section_two.getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().("Tabbed-Indentation").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
48 "\n\tAll my homies know that tabs be superior.\n\t Why not just use both?"
49 );
50 }
51 }