skip DoJSON test on plan9

This commit is contained in:
Aaron Bieber 2020-10-21 01:05:09 +00:00
parent e27cc689d4
commit 70917abd74

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"runtime"
"testing" "testing"
) )
@ -33,27 +34,29 @@ type testResp struct {
} }
func TestHTTPRequestDoJSON(t *testing.T) { func TestHTTPRequestDoJSON(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if runtime.GOOS != "plan9" {
_, err := fmt.Fprintln(w, `{"test":"success"}`) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, err := fmt.Fprintln(w, `{"test":"success"}`)
if err != nil {
t.Error(err)
}
}))
defer ts.Close()
var tr = &testResp{}
req := HTTPRequest{
ResBody: tr,
URL: ts.URL,
}
err := req.DoJSON()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
}))
defer ts.Close()
var tr = &testResp{} if tr.Name != "success" {
t.Errorf("Expected 'test'; got '%s'\n", tr.Name)
req := HTTPRequest{ }
ResBody: tr,
URL: ts.URL,
}
err := req.DoJSON()
if err != nil {
t.Error(err)
}
if tr.Name != "success" {
t.Errorf("Expected 'test'; got '%s'\n", tr.Name)
} }
} }