INNER CODE UNIT · Rust

policy_collects_paths

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

    fn policy_collects_paths() {
        let mut policy = SandboxPolicy::new();
        policy
            .allow_read("/tmp/in")
            .allow_read_write("/tmp/out")
            .allow_remove_in("/tmp/spill")
            .allow_remove_dir_in("/tmp");

        assert_eq!(policy.read_paths(), &[PathBuf::from("/tmp/in")]);
        assert_eq!(policy.read_write_paths(), &[PathBuf::from("/tmp/out")]);
        assert_eq!(policy.remove_in_paths(), &[PathBuf::from("/tmp/spill")]);
        assert_eq!(policy.remove_dir_in_paths(), &[PathBuf::from("/tmp")]);
    }

    #[test]
    fn policy_disabled_default_false() {
        let policy = SandboxPolicy::new();
        assert!(!policy.disabled);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…