diff --git a/src/device/input/wrap/refresh_test.go b/src/device/input/wrap/refresh_test.go index a2a6b73..85b37d5 100644 --- a/src/device/input/wrap/refresh_test.go +++ b/src/device/input/wrap/refresh_test.go @@ -1,7 +1,6 @@ package wrap import ( - "mayhem-party/src/device/input/raw" "os" "syscall" "testing" @@ -12,7 +11,7 @@ func TestRefresh(t *testing.T) { b := byte('a') generator := func() Wrap { b += byte(1) - return explicit{src: raw.NewRandom(func() byte { return b })} + return dummyParser{Char: b} } ch := make(chan os.Signal, 1) defer close(ch) diff --git a/src/device/input/wrap/wrap.go b/src/device/input/wrap/wrap.go index b2e132f..3d1c82f 100644 --- a/src/device/input/wrap/wrap.go +++ b/src/device/input/wrap/wrap.go @@ -3,7 +3,6 @@ package wrap import ( "context" "mayhem-party/src/device/input/button" - "mayhem-party/src/device/input/raw" "os" "syscall" ) @@ -13,14 +12,9 @@ type Wrap interface { Close() } -func New(ctx context.Context, src raw.Raw) Wrap { +func New(ctx context.Context, src button.Parser) Wrap { maker := func() Wrap { - return explicit{src: src} - } - if os.Getenv("WRAP_PROTOCOL") == "true" { - maker = func() Wrap { - return NewProtocol(src) - } + return src } if os.Getenv("WRAP_BUFFERED") == "true" { oldMaker := maker @@ -43,13 +37,3 @@ func New(ctx context.Context, src raw.Raw) Wrap { } return maker() } - -type explicit struct { - src raw.Raw -} - -func (e explicit) Close() { - e.src.Close() -} - -func (e explicit) Read() []button.Button { diff --git a/src/device/input/wrap/wrap_test.go b/src/device/input/wrap/wrap_test.go index 4cab6b4..d6c060a 100644 --- a/src/device/input/wrap/wrap_test.go +++ b/src/device/input/wrap/wrap_test.go @@ -1,11 +1,21 @@ package wrap -import "testing" +import ( + "mayhem-party/src/device/input/button" + "testing" +) func TestWrap(t *testing.T) { - var _ Wrap = explicit{} + var _ Wrap = dummyParser{} var _ Wrap = &Refresh{} var _ Wrap = &Buffered{} var _ Wrap = &Remap{} var _ Wrap = Protocol{} } + +type dummyParser button.Button + +func (d dummyParser) Close() {} +func (d dummyParser) Read() []button.Button { + return []button.Button{button.Button(d)} +}