mirror of
https://github.com/containers/youki
synced 2024-06-02 04:46:13 +02:00
5cbbba0621
format cargo comments comment cargo files
31 lines
759 B
Rust
31 lines
759 B
Rust
#[cfg(test)]
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn serialize_and_deserialize_spec() {
|
|
let spec: Spec = Default::default();
|
|
let json_string = serde_json::to_string(&spec).unwrap();
|
|
let new_spec = serde_json::from_str(&json_string).unwrap();
|
|
assert_eq!(spec, new_spec);
|
|
}
|
|
|
|
#[test]
|
|
fn test_linux_device_cgroup_to_string() {
|
|
let ldc = LinuxDeviceCgroup {
|
|
allow: true,
|
|
typ: LinuxDeviceType::A,
|
|
major: None,
|
|
minor: None,
|
|
access: "rwm".into(),
|
|
};
|
|
assert_eq!(ldc.to_string(), "a *:* rwm");
|
|
let ldc = LinuxDeviceCgroup {
|
|
allow: true,
|
|
typ: LinuxDeviceType::A,
|
|
major: Some(1),
|
|
minor: Some(9),
|
|
access: "rwm".into(),
|
|
};
|
|
assert_eq!(ldc.to_string(), "a 1:9 rwm");
|
|
}
|