Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 74ab186

Browse files
committed
Improved test coverage percentage
1 parent e83a8b5 commit 74ab186

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

cpm/cpm_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,5 +365,52 @@ func TestAutoExec(t *testing.T) {
365365
if out != "SUBMIT AUTOEXEC" {
366366
t.Fatalf("strange input read: '%s'\n", out)
367367
}
368+
}
369+
370+
func TestHostExec(t *testing.T) {
371+
372+
// Create a new CP/M helper
373+
obj, err := New(WithOutputDriver("null"), WithHostExec("!#!"))
374+
if err != nil {
375+
t.Fatalf("failed to create CPM")
376+
}
377+
378+
if obj.input.GetSystemCommandPrefix() != "!#!" {
379+
t.Fatalf("WithHostExec didn't work as expected")
380+
}
381+
}
382+
383+
func TestAddressOveride(t *testing.T) {
384+
385+
// Create a new CP/M helper - default
386+
obj, err := New(WithOutputDriver("null"))
387+
if err != nil {
388+
t.Fatalf("failed to create CPM")
389+
}
390+
391+
if obj.bdosAddress != 0xC000 {
392+
t.Fatalf("default BDOS address is wrong")
393+
}
394+
395+
// Create a new CP/M helper - with env set
396+
t.Setenv("BDOS_ADDRESS", "0x1234")
397+
obj, err = New(WithOutputDriver("null"))
398+
if err != nil {
399+
t.Fatalf("failed to create CPM")
400+
}
401+
402+
if obj.bdosAddress != 0x1234 {
403+
t.Fatalf("updated BDOS address is wrong")
404+
}
405+
406+
// Create a new CP/M helper - with bogus env set
407+
t.Setenv("BDOS_ADDRESS", "steve")
408+
obj, err = New(WithOutputDriver("null"))
409+
if err != nil {
410+
t.Fatalf("failed to create CPM")
411+
}
412+
if obj.bdosAddress != 0xC000 {
413+
t.Fatalf("updated BDOS address is wrong")
414+
}
368415

369416
}

0 commit comments

Comments
 (0)