github.com/simonmittag/ws@v1.1.0-rc.5.0.20210419231947-82b846128245/frame_test.go (about) 1 package ws 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestOpCodeIsControl(t *testing.T) { 9 for _, test := range []struct { 10 code OpCode 11 exp bool 12 }{ 13 {OpClose, true}, 14 {OpPing, true}, 15 {OpPong, true}, 16 {OpBinary, false}, 17 {OpText, false}, 18 {OpContinuation, false}, 19 } { 20 t.Run(fmt.Sprintf("0x%02x", test.code), func(t *testing.T) { 21 if act := test.code.IsControl(); act != test.exp { 22 t.Errorf("IsControl = %v; want %v", act, test.exp) 23 } 24 }) 25 } 26 }