Skip to content

Commit 1ed239d

Browse files
committed
Tidy up internal package
1 parent 395c4ff commit 1ed239d

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

internal/http.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func MakeRequest(method string, url string, input io.Reader, headersIncluded boo
3535
return nil, err
3636
}
3737

38-
body, err := ioutil.ReadAll(inputReader)
39-
38+
var body []byte
39+
body, err = ioutil.ReadAll(inputReader)
4040
if err != nil {
4141
return nil, err
4242
}
@@ -46,6 +46,10 @@ func MakeRequest(method string, url string, input io.Reader, headersIncluded boo
4646
req.Header = headers
4747
}
4848

49+
if err != nil {
50+
return nil, err
51+
}
52+
4953
//return http.DefaultClient.Do(req)
5054

5155
return http.DefaultTransport.RoundTrip(req)

internal/map_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
package internal
1+
package internal_test
22

33
import (
44
"reflect"
55
"testing"
6+
7+
"github.com/stilvoid/please/internal"
68
)
79

810
func TestForceStringKeys(t *testing.T) {
@@ -36,7 +38,7 @@ func TestForceStringKeys(t *testing.T) {
3638
"null": "derf",
3739
}
3840

39-
actual := ForceStringKeys(input)
41+
actual := internal.ForceStringKeys(input)
4042

4143
if !reflect.DeepEqual(actual, expected) {
4244
t.Errorf("unexpected result:\n%#v\nvs\n%#v\n", actual, expected)
@@ -63,7 +65,7 @@ func TestArraysToMaps(t *testing.T) {
6365
},
6466
}
6567

66-
actual := ArraysToMaps(input)
68+
actual := internal.ArraysToMaps(input)
6769

6870
if !reflect.DeepEqual(actual, expected) {
6971
t.Errorf("unexpected:\n%#v\nwant:\n%#v", actual, expected)
@@ -97,7 +99,7 @@ func TestSortedKeys(t *testing.T) {
9799
}
98100

99101
for i, input := range inputs {
100-
actual := SortedKeys(input)
102+
actual := internal.SortedKeys(input)
101103

102104
expected := expecteds[i]
103105

internal/munge_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
package internal
1+
package internal_test
22

33
import (
44
"reflect"
55
"testing"
6+
7+
"github.com/stilvoid/please/internal"
68
)
79

810
type mungeCase struct {
@@ -64,7 +66,7 @@ func TestMunge(t *testing.T) {
6466
}
6567

6668
for _, testCase := range cases {
67-
actual := Munge(testCase.left, testCase.right)
69+
actual := internal.Munge(testCase.left, testCase.right)
6870

6971
if !reflect.DeepEqual(actual, testCase.expected) {
7072
t.Errorf("Falsely munged %T '%v' and %T '%v' into %T '%v'",
@@ -104,7 +106,7 @@ func TestFilteredMunge(t *testing.T) {
104106
}
105107

106108
for _, testCase := range cases {
107-
actual := MungeWithFilter(testCase.left, testCase.right, myFilter)
109+
actual := internal.MungeWithFilter(testCase.left, testCase.right, myFilter)
108110

109111
if !reflect.DeepEqual(actual, testCase.expected) {
110112
t.Errorf("Falsely munged %T '%v' and %T '%v' into %T '%v'",

0 commit comments

Comments
 (0)