test: fix broken testing code in libs

After commit a3f973db3b merged, protection::GuestProtection::[Snp,Sev]
have changed to tuple variants, and can no longer be used in assert_eq
marco without tuple values, or some errors will raised:

```
assert_eq!(actual.unwrap(), GuestProtection::Snp);
    |                                     ^^^^^^^^^^^^^^^^^^^^ expected  \
				`GuestProtection`, found enum constructor
```

Signed-off-by: Lei Liu <liulei.pt@bytedance.com>
This commit is contained in:
Lei Liu 2025-06-17 12:36:27 +08:00
parent a00f39e272
commit 71d1cdf40a
No known key found for this signature in database
GPG Key ID: 0FCDE83978586CAB

View File

@ -225,7 +225,7 @@ mod tests {
let actual = arch_guest_protection("/xyz/tmp", path.to_str().unwrap()); let actual = arch_guest_protection("/xyz/tmp", path.to_str().unwrap());
assert!(actual.is_ok()); assert!(actual.is_ok());
assert_eq!(actual.unwrap(), GuestProtection::Snp); assert!(matches!(actual.unwrap(), GuestProtection::Snp(_)));
writeln!(snp_file, "N").unwrap(); writeln!(snp_file, "N").unwrap();
let actual = arch_guest_protection("/xyz/tmp", path.to_str().unwrap()); let actual = arch_guest_protection("/xyz/tmp", path.to_str().unwrap());
@ -244,7 +244,7 @@ mod tests {
let actual = arch_guest_protection(sev_path.to_str().unwrap(), "/xyz/tmp"); let actual = arch_guest_protection(sev_path.to_str().unwrap(), "/xyz/tmp");
assert!(actual.is_ok()); assert!(actual.is_ok());
assert_eq!(actual.unwrap(), GuestProtection::Sev); assert!(matches!(actual.unwrap(), GuestProtection::Sev(_)));
writeln!(sev_file, "N").unwrap(); writeln!(sev_file, "N").unwrap();
let actual = arch_guest_protection(sev_path.to_str().unwrap(), "/xyz/tmp"); let actual = arch_guest_protection(sev_path.to_str().unwrap(), "/xyz/tmp");