Browse Source

frame_test: add TestFrameTypeString

Matt Layher 10 years ago
parent
commit
6e36faf1da
1 changed files with 19 additions and 0 deletions
  1. 19 0
      frame_test.go

+ 19 - 0
frame_test.go

@@ -24,6 +24,25 @@ func TestFrameSizes(t *testing.T) {
 	}
 }
 
+func TestFrameTypeString(t *testing.T) {
+	tests := []struct {
+		ft   FrameType
+		want string
+	}{
+		{FrameData, "DATA"},
+		{FramePing, "PING"},
+		{FrameGoAway, "GOAWAY"},
+		{0xf, "UNKNOWN_FRAME_TYPE_15"},
+	}
+
+	for i, tt := range tests {
+		got := tt.ft.String()
+		if got != tt.want {
+			t.Errorf("%d. String(FrameType %d) = %q; want %q", i, int(tt.ft), got, tt.want)
+		}
+	}
+}
+
 func TestWriteRST(t *testing.T) {
 	fr, buf := testFramer()
 	var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4