forked from jrtorres042/git_microsoft-powershell_achived-android_agreements_covid-19_github-go_diff-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_test.go
More file actions
31 lines (26 loc) · 655 Bytes
/
event_test.go
File metadata and controls
31 lines (26 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2020 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"encoding/json"
"testing"
)
func TestPayload_Panic(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("Payload did not panic but should have")
}
}()
name := "UserEvent"
body := json.RawMessage("[") // bogus JSON
e := &Event{Type: &name, RawPayload: &body}
e.Payload()
}
func TestPayload_NoPanic(t *testing.T) {
name := "UserEvent"
body := json.RawMessage("{}")
e := &Event{Type: &name, RawPayload: &body}
e.Payload()
}