oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package personapi
2
3import (
4 "strings"
5 "testing"
6)
7
8func TestPersonAPIValidate(t *testing.T) {
9 for _, raw := range []string{`{"body":"a","body":"b"}`, `{"body":"a","actor":"owner"}`, `{"body":"a"} {}`, `null`, `{"body":"a","BODY":"b"}`, `{"body":"` + strings.Repeat("x", 65536) + `"}`} {
10 var in MessageInput
11 if Decode(strings.NewReader(raw), &in) == nil {
12 t.Fatalf("accepted invalid input %q", raw[:min(len(raw), 80)])
13 }
14 }
15 var in MessageInput
16 if err := Decode(strings.NewReader(`{"body":"hello"}`), &in); err != nil || in.Body != "hello" {
17 t.Fatal(in, err)
18 }
19}
20