Debian Codegraph @

src/tests.rs

raw symbols SCIP
1 use superrust-analyzer cargo home-dir 0.1.0 crate/::{getentrust-analyzer cargo home-dir 0.1.0 getent()., Errorrust-analyzer cargo home-dir 0.1.0 Error#};
2 use craterust-analyzer cargo home-dir 0.1.0 crate/::HomeDirExtrust-analyzer cargo home-dir 0.1.0 HomeDirExt#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
4
5 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
6 fn test_rootrust-analyzer cargo home-dir 0.1.0 tests/test_root().() {
7 #[cfg(target_os = "macos")]
8 const ROOT_DIR: &'static str = "/var/root";
9
10 #[cfg(target_os = "linux")]
11 const ROOT_DIRrust-analyzer cargo home-dir 0.1.0 tests/ROOT_DIR.: &'static str = "/root";
12
13 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(getentrust-analyzer cargo home-dir 0.1.0 getent().("root").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().(ROOT_DIRrust-analyzer cargo home-dir 0.1.0 tests/ROOT_DIR.));
14 }
15
16 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
17 fn test_expand_rootrust-analyzer cargo home-dir 0.1.0 tests/test_expand_root().() {
18 #[cfg(target_os = "macos")]
19 const ROOT_DIR: &'static str = "/var/root/foobar";
20
21 #[cfg(target_os = "linux")]
22 const ROOT_DIRrust-analyzer cargo home-dir 0.1.0 tests/ROOT_DIR.: &'static str = "/root/foobar";
23
24 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
25 "~root/foobar".expand_homerust-analyzer cargo home-dir 0.1.0 impl#[T][HomeDirExt]expand_home().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
26 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().(ROOT_DIRrust-analyzer cargo home-dir 0.1.0 tests/ROOT_DIR.)
27 );
28 }
29
30 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
31 fn test_expand_nonexpansionrust-analyzer cargo home-dir 0.1.0 tests/test_expand_nonexpansion().() {
32 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
33 "/etc/some.conf".expand_homerust-analyzer cargo home-dir 0.1.0 impl#[T][HomeDirExt]expand_home().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
34 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/etc/some.conf")
35 );
36 }
37
38 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
39 fn test_missingrust-analyzer cargo home-dir 0.1.0 tests/test_missing().() {
40 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(
41 getentrust-analyzer cargo home-dir 0.1.0 getent().("_foobar_").unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(),
42 Errorrust-analyzer cargo home-dir 0.1.0 Error#::MissingEntryrust-analyzer cargo home-dir 0.1.0 Error#MissingEntry#
43 ));
44 }