Skip to content

Commit

Permalink
Add test for multiple matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
acomagu authored and soheilhy committed Jan 23, 2018
1 parent cfc68f9 commit 444ce56
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions cmux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,35 @@ func TestErrorHandler(t *testing.T) {
}
}

func TestMultipleMatchers(t *testing.T) {
defer leakCheck(t)()
errCh := make(chan error)
defer func() {
select {
case err := <-errCh:
t.Fatal(err)
default:
}
}()
l, cleanup := testListener(t)
defer cleanup()

matcher := func(r io.Reader) bool {
return true
}
unmatcher := func(r io.Reader) bool {
return false
}

muxl := New(l)
lis := muxl.Match(unmatcher, matcher, unmatcher)

go runTestHTTPServer(errCh, lis)
go safeServe(errCh, muxl)

runTestHTTP1Client(t, l.Addr())
}

func TestClose(t *testing.T) {
defer leakCheck(t)()
errCh := make(chan error)
Expand Down

0 comments on commit 444ce56

Please sign in to comment.