MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_status_in_subdirectory

Function test_status_in_subdirectory

atomic-cli/src/commands/status.rs:1970–2002  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1968 #[test]
1969 #[file_serial]
1970 fn test_status_in_subdirectory() {
1971 let _guard = DirGuard::new();
1972
1973 let temp_dir = tempfile::tempdir().unwrap();
1974 let repo_path = temp_dir.path();
1975
1976 // Initialize a repository and drop handle to release lock
1977 {
1978 let repo_result = Repository::init(repo_path);
1979 assert!(
1980 repo_result.is_ok(),
1981 "Failed to init repository: {:?}",
1982 repo_result.err()
1983 );
1984 }
1985
1986 // Create subdirectory
1987 let subdir = repo_path.join("subdir");
1988 std::fs::create_dir(&subdir).unwrap();
1989
1990 // Change to subdirectory
1991 std::env::set_current_dir(&subdir).unwrap();
1992
1993 let status = Status::new();
1994 let result = status.run();
1995
1996 // Should find repo by walking up to parent
1997 assert!(
1998 result.is_ok(),
1999 "Status in subdirectory failed: {:?}",
2000 result.err()
2001 );
2002 }
2003
2004 #[test]
2005 #[file_serial]

Callers

nothing calls this directly

Calls 4

initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected