Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
smoynes committed Feb 13, 2024
1 parent 7fb9cc4 commit 87cca66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/monitor/traps.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/smoynes/elsie/internal/vm"
)

var defaultImageTraps = []Routine{
var DefaultImageRoutines = []Routine{
TrapHalt,
TrapOut,
TrapPuts,
Expand Down Expand Up @@ -52,7 +52,7 @@ var TrapGetc = Routine{
&asm.LEA{DR: "R1", SYMBOL: "PROMPT"},

/*LOOP:0x04a2*/
&asm.LDR{DR: "R2", SR: "R1", OFFSET: 0}, // Get next prompt character.
&asm.LDR{DR: "R2", SR: "R1", OFFSET: 0}, // Get next prompt character.
&asm.BR{NZP: asm.CondNZ, SYMBOL: "INPUT"},
&asm.JSR{SYMBOL: "WRITECHAR"}, // Echo prompt character.
&asm.ADD{DR: "R1", SR1: "R1", LITERAL: 1}, // Increment prompt pointer.
Expand Down
11 changes: 6 additions & 5 deletions internal/monitor/traps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (*fakeKeyboard) InterruptRequested() bool { return true }
func (fakeKeyboard) String() string { return "FakeKEY" }

func (k *fakeKeyboard) Read(addr vm.Word) (vm.Word, error) {
switch addr {
switch addr { //nolint:exhaustive
case vm.KBSRAddr:
return 0x8000, nil
case vm.KBDRAddr:
Expand All @@ -60,7 +60,7 @@ func WithTestKeyboardDriver(key rune) vm.OptionFn {
vm.KBDRAddr: dev,
vm.KBSRAddr: dev,
}
machine.Mem.Devices.Map(deviceMap)
_ = machine.Mem.Devices.Map(deviceMap)
}
}
}
Expand Down Expand Up @@ -106,9 +106,9 @@ func TestTrap_Getc(tt *testing.T) {
break
} else if !machine.MCR.Running() {
break
} else if err == context.DeadlineExceeded {
} else if errors.Is(err, context.DeadlineExceeded) {
break
} else if err == context.Canceled {
} else if errors.Is(err, context.Canceled) {
break
} else if err != nil {
t.Error(err)
Expand All @@ -122,10 +122,11 @@ func TestTrap_Getc(tt *testing.T) {

<-ctx.Done()

if err := ctx.Err(); err == context.DeadlineExceeded {
if err := ctx.Err(); errors.Is(err, context.DeadlineExceeded) {
t.Error("Deadline exceeded")
t.Log(machine.String())
t.Log(machine.REG.String())

return
}
}
Expand Down

0 comments on commit 87cca66

Please sign in to comment.