42 lines · 1.1 KB · Rust
RawDownload
mod is_absolute {    #[test]    fn absolute_linux_path_is_true() {        assert!(git_path::is_absolute("/"));        assert!(git_path::is_absolute("/abs/path"));    }     #[test]    fn relative_linux_path_is_false() {        assert!(!git_path::is_absolute("./relative/path"));        assert!(!git_path::is_absolute("relative/path"));    }     #[cfg(not(windows))]    mod not_on_windows {        #[test]        fn drive_prefixes_are_false() {            assert!(!git_path::is_absolute("c:\\abs/path"));            assert!(!git_path::is_absolute("c:\\abs\\path"));        }    }     #[cfg(windows)]    mod on_windows {        #[test]        fn drive_prefixes_are_true() {            assert!(git_path::is_absolute("c:\\abs/path"));            assert!(git_path::is_absolute("c:\\abs\\path"));        }         #[test]        fn relative_paths_with_backslashes_are_false() {            assert!(!git_path::is_absolute(".\\rel/path"));            assert!(!git_path::is_absolute("rel\\path"));        }         #[test]        fn path_starting_with_backslash_is_false() {            assert!(!git_path::is_absolute("\\rel\\path"));        }    }}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t