File: runtime.rs

package info (click to toggle)
rust-caps 0.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208 kB
  • sloc: makefile: 2
file content (37 lines) | stat: -rw-r--r-- 892 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use caps::runtime;

#[test]
fn test_ambient_supported() {
    runtime::ambient_set_supported().unwrap();
}

#[test]
fn test_thread_all_supported() {
    assert!(runtime::thread_all_supported().len() > 0);
    assert!(runtime::thread_all_supported().len() <= caps::all().len());
}

#[test]
fn test_procfs_all_supported() {
    use std::path::PathBuf;

    let p1 = runtime::procfs_all_supported(None).unwrap();
    let p2 = runtime::procfs_all_supported(Some(PathBuf::from("/proc"))).unwrap();
    let thread = runtime::thread_all_supported();
    let all = caps::all();

    assert!(thread.len() > 0);
    assert!(thread.len() <= all.len());
    assert_eq!(
        p1,
        p2,
        "{:?}",
        p1.symmetric_difference(&p2).collect::<Vec<_>>()
    );
    assert_eq!(
        p1,
        thread,
        "{:?}",
        p1.symmetric_difference(&thread).collect::<Vec<_>>()
    );
}