Debian Codegraph @

tests/integration_test.rs

raw symbols SCIP
1 // spell-checker:ignore (API) nodename osname sysname
2
3 use platform_inforust-analyzer cargo platform-info 2.0.5 crate/::*;
4
5 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
6 fn platformrust-analyzer cargo platform-info 2.0.5 platform().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
7 let info = PlatformInforust-analyzer cargo platform-info 2.0.5 lib_impl/target/PlatformInfo#::newrust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][PlatformInfoAPI]new().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
8
9 let sysname = info.sysnamerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]sysname().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
10 let nodename = info.nodenamerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]nodename().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
11 let release = info.releaserust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]release().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
12 let version = info.versionrust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]version().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
13 let machine = info.machinerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]machine().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
14 let osname = info.osnamerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]osname().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
15
16 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().sysname.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().());
17 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().nodename.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().());
18 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().release.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().());
19 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().version.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().());
20 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().machine.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().());
21 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().osname.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().());
22
23 // assert!(false);
24 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
25 }
26
27 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
28 fn platform_no_invisible_contentsrust-analyzer cargo platform-info 2.0.5 platform_no_invisible_contents().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
29 let info = PlatformInforust-analyzer cargo platform-info 2.0.5 lib_impl/target/PlatformInfo#::newrust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][PlatformInfoAPI]new().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
30
31 let sysname = info.sysnamerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]sysname().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
32 let nodename = info.nodenamerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]nodename().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
33 let release = info.releaserust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]release().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
34 let version = info.versionrust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]version().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
35 let machine = info.machinerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]machine().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
36 let osname = info.osnamerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][UNameAPI]osname().().to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().();
37
38 let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("sysname='{sysname}';nodename='{nodename}';release='{release}';version='{version}';machine='{machine}';osname='{osname}'");
39 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("s = [{}]\"{}\"", s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(), s);
40
41 // let re = regex::Regex::new("[^[[:print:]]]").unwrap(); // matches invisible (and emojis)
42 let re = regexrust-analyzer cargo regex 1.10.6 crate/::Regexrust-analyzer cargo regex 1.10.6 regex/string/Regex#::newrust-analyzer cargo regex 1.10.6 regex/string/impl#[Regex]new().("[^[[:print:]]\\p{Other_Symbol}]").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); // matches invisible only (not emojis)
43 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(re.findrust-analyzer cargo regex 1.10.6 regex/string/impl#[Regex]find().(&s), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
44
45 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
46 }
47
48 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
49 fn platform_clonerust-analyzer cargo platform-info 2.0.5 platform_clone().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
50 let info = PlatformInforust-analyzer cargo platform-info 2.0.5 lib_impl/target/PlatformInfo#::newrust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][PlatformInfoAPI]new().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
51 #[allow(clippy::redundant_clone)] // ignore `clippy::redundant_clone` warning for direct testing
52 let info_copy = info.clonerust-analyzer cargo platform-info 2.0.5 lib_impl/target/impl#[PlatformInfo][Clone]clone().();
53 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{info:?}");
54 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(info_copy, info);
55 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
56 }