package host import "testing" func TestParseCtlLine(t *testing.T) { // Formats from reims_util.rs:480-488 and its test at :777-786. u, _ := ParseCtlLine("downloading the macOS Tahoe 26 recovery image: 45% of 2.0 GB") if u.Kind != KindProgress || u.Step != "downloading the macOS Tahoe 26 recovery image" || u.Percent != 45 || u.Total != 2_000_000_000 { t.Fatalf("percent line = %+v", u) } u, _ = ParseCtlLine("macos-tahoe: downloading OpenCore 1.0.8: 5% of 11 MB") if u.Step != "macos-tahoe: downloading OpenCore 1.0.8" || u.Total != 11_000_000 { t.Fatalf("ctl-prefixed line = %+v", u) } u, _ = ParseCtlLine("downloading the installer: 300 MB") if u.Kind != KindProgress || u.Percent != -1 || u.Done != 300_000_000 { t.Fatalf("size line = %+v", u) } u, _ = ParseCtlLine("creating the disk") if u.Kind != KindNote || u.Message != "creating the disk" { t.Fatalf("note = %+v", u) } if _, ok := ParseCtlLine(" "); ok { t.Fatal("blank line") } }