INNER CODE UNIT · Rust

canonicalize_existing_path_resolves

ouch-org/ouch · src/sandbox/mod.rs:169

    fn canonicalize_existing_path_resolves() {
        let dir = tempfile::tempdir().unwrap();
        let canon = canonicalize_for_sandbox(dir.path());
        assert!(canon.is_absolute());
        assert!(canon.exists());
    }

    #[test]
    fn canonicalize_missing_path_falls_back_to_parent() {
        let dir = tempfile::tempdir().unwrap();
        let missing = dir.path().join("does-not-exist-yet.txt");
        let canon = canonicalize_for_sandbox(&missing);
        assert!(canon.is_absolute());
        assert_eq!(canon.file_name().unwrap(), "does-not-exist-yet.txt");
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…