mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:52:22 +00:00
fix(bls): keep the Sprout name and version fields outside strict mode
This commit is contained in:
1 parent
cb9f05f199
commit
47020c7b92
2 files changed
+35
-12
No files matched your search
+16
-6
@@ -817,20 +817,30 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uki_title_and_version_use_every_systemd_fallback() {
|
||||
fn uki_title_and_version_use_every_systemd_fallback_in_strict_mode() {
|
||||
let sections = uki_sections(&[(
|
||||
".osrel",
|
||||
"IMAGE_ID=img\nNAME=N\nID=i\nVERSION=7.1\nVERSION_ID=7\n",
|
||||
)]);
|
||||
let entry = BlsEntry::from_uki(§ions, "/a.efi");
|
||||
let entry = BlsEntry::from_uki_with(§ions, "/a.efi", true);
|
||||
assert_eq!(entry.title.as_deref(), Some("img"));
|
||||
assert_eq!(entry.version.as_deref(), Some("7.1"));
|
||||
|
||||
let sections = uki_sections(&[(".osrel", "NAME=N\nID=i\n")]);
|
||||
assert_eq!(
|
||||
BlsEntry::from_uki(§ions, "/a.efi").title.as_deref(),
|
||||
Some("N")
|
||||
);
|
||||
let entry = BlsEntry::from_uki_with(§ions, "/a.efi", true);
|
||||
assert_eq!(entry.title.as_deref(), Some("N"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uki_title_and_version_keep_the_sprout_fallbacks_outside_strict_mode() {
|
||||
// The long VERSION would be added to the title, so it is not used.
|
||||
let sections = uki_sections(&[(
|
||||
".osrel",
|
||||
"IMAGE_ID=img\nNAME=N\nID=i\nVERSION=\"24.04 LTS (Noble)\"\nVERSION_ID=7\n",
|
||||
)]);
|
||||
let entry = BlsEntry::from_uki(§ions, "/a.efi");
|
||||
assert_eq!(entry.title.as_deref(), Some("i"));
|
||||
assert_eq!(entry.version.as_deref(), Some("7"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user