mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Fix broken unit tests
This commit is contained in:
parent
ffb8f86a9c
commit
b1084c1362
@ -260,8 +260,10 @@ func (t *VT) DriverVersion() (uint16, uint16, uint16) {
|
||||
// DriverInit initializes this driver.
|
||||
func (t *VT) DriverInit() *kernel.Error { return nil }
|
||||
|
||||
func init() {
|
||||
ProbeFuncs = append(ProbeFuncs, func() device.Driver {
|
||||
return NewVT(DefaultTabWidth, DefaultScrollback)
|
||||
})
|
||||
func probeForVT() device.Driver {
|
||||
return NewVT(DefaultTabWidth, DefaultScrollback)
|
||||
}
|
||||
|
||||
func init() {
|
||||
ProbeFuncs = append(ProbeFuncs, probeForVT)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"gopheros/device/video/console"
|
||||
"image/color"
|
||||
"io"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -339,22 +338,6 @@ func TestVTDriverInterface(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestVTProbe(t *testing.T) {
|
||||
var (
|
||||
expProbePtr = reflect.ValueOf(probeForVT).Pointer()
|
||||
foundProbe bool
|
||||
)
|
||||
|
||||
for _, probeFn := range HWProbes() {
|
||||
if reflect.ValueOf(probeFn).Pointer() == expProbePtr {
|
||||
foundProbe = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !foundProbe {
|
||||
t.Fatal("expected probeForVT to be part of the probes returned by HWProbes")
|
||||
}
|
||||
|
||||
if drv := probeForVT(); drv == nil {
|
||||
t.Fatal("expected probeForVT to return a driver")
|
||||
}
|
||||
|
@ -199,15 +199,17 @@ func (cons *VgaTextConsole) DriverVersion() (uint16, uint16, uint16) {
|
||||
// DriverInit initializes this driver.
|
||||
func (cons *VgaTextConsole) DriverInit() *kernel.Error { return nil }
|
||||
|
||||
func init() {
|
||||
ProbeFuncs = append(ProbeFuncs, func() device.Driver {
|
||||
var drv device.Driver
|
||||
// probeForVgaTextConsole checks for the presence of a vga text console.
|
||||
func probeForVgaTextConsole() device.Driver {
|
||||
var drv device.Driver
|
||||
fbInfo := getFramebufferInfoFn()
|
||||
if fbInfo.Type == multiboot.FramebufferTypeEGA {
|
||||
drv = NewVgaTextConsole(fbInfo.Width, fbInfo.Height, uintptr(fbInfo.PhysAddr))
|
||||
}
|
||||
|
||||
fbInfo := getFramebufferInfoFn()
|
||||
if fbInfo.Type == multiboot.FramebufferTypeEGA {
|
||||
drv = NewVgaTextConsole(fbInfo.Width, fbInfo.Height, uintptr(fbInfo.PhysAddr))
|
||||
}
|
||||
|
||||
return drv
|
||||
})
|
||||
return drv
|
||||
}
|
||||
|
||||
func init() {
|
||||
ProbeFuncs = append(ProbeFuncs, probeForVgaTextConsole)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"gopheros/kernel/cpu"
|
||||
"gopheros/kernel/hal/multiboot"
|
||||
"image/color"
|
||||
"reflect"
|
||||
"testing"
|
||||
"unsafe"
|
||||
)
|
||||
@ -330,22 +329,6 @@ func TestVgaTextProbe(t *testing.T) {
|
||||
getFramebufferInfoFn = multiboot.GetFramebufferInfo
|
||||
}()
|
||||
|
||||
var (
|
||||
expProbePtr = reflect.ValueOf(probeForVgaTextConsole).Pointer()
|
||||
foundProbe bool
|
||||
)
|
||||
|
||||
for _, probeFn := range HWProbes() {
|
||||
if reflect.ValueOf(probeFn).Pointer() == expProbePtr {
|
||||
foundProbe = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !foundProbe {
|
||||
t.Fatal("expected probeForVgaTextConsole to be part of the probes returned by HWProbes")
|
||||
}
|
||||
|
||||
getFramebufferInfoFn = func() *multiboot.FramebufferInfo {
|
||||
return &multiboot.FramebufferInfo{
|
||||
Width: 80,
|
||||
|
Loading…
x
Reference in New Issue
Block a user