• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cdprice02 / ferrish / #4

29 Mar 2026 06:36PM UTC coverage: 54.264% (+11.0%) from 43.243%
#4

push

cdprice02
Add comprehensive test infrastructure and fix clippy warnings

- Add lightweight ShellTest harness for integration tests
- Add environment isolation tests (env_handling.rs)
- Add additional integration tests for error handling and builtins
- Refactor existing tests to use new harness
- Remove legacy tests/common/mod.rs
- Add unit tests to shell.rs module
- Fix all clippy warnings (needless borrows, len_zero, dead_code)
- Add Default impl for ShellTest
- All 73 tests passing (46 unit + 27 integration)
- Clippy clean with -D warnings

140 of 258 relevant lines covered (54.26%)

0.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/src/command/executable.rs
1
use std::path::PathBuf;
2

3
#[derive(Debug, Clone)]
4
pub struct ExecutableCommand {
5
    file_path: PathBuf,
6
}
7

8
impl std::fmt::Display for ExecutableCommand {
9
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
×
10
        write!(f, "{}", self.name())
×
11
    }
12
}
13

14
impl ExecutableCommand {
15
    pub fn new(file_path: PathBuf) -> Self {
2✔
16
        Self { file_path }
17
    }
18

19
    pub fn file_path(&self) -> &PathBuf {
1✔
20
        &self.file_path
21
    }
22

23
    pub fn name(&self) -> &str {
1✔
24
        self.file_path
1✔
25
            .file_stem()
26
            .and_then(|s| s.to_str())
3✔
27
            .unwrap_or("")
28
    }
29
}
30

31
#[cfg(test)]
32
mod tests {
33
    use super::*;
34

35
    #[test]
36
    fn test_executable_name_extracts_file_stem() {
37
        let cmd = ExecutableCommand::new(PathBuf::from("/usr/bin/ls"));
38
        assert_eq!(cmd.name(), "ls");
39

40
        let cmd = ExecutableCommand::new(PathBuf::from("./cargo"));
41
        assert_eq!(cmd.name(), "cargo");
42
    }
43

44
    #[test]
45
    fn test_executable_file_path_getter() {
46
        let path = PathBuf::from("/usr/local/bin/rustc");
47
        let cmd = ExecutableCommand::new(path.clone());
48
        assert_eq!(cmd.file_path(), &path);
49
    }
50

51
    #[test]
52
    #[ignore]
53
    fn test_executable_display() {
54
        let cmd = ExecutableCommand::new(PathBuf::from("/bin/bash"));
55
        assert_eq!(cmd.to_string(), "bash");
56
    }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc