Ensure tests are correct way around

This commit is contained in:
Tobie Morgan Hitchcock 2019-11-15 13:22:51 +00:00
parent ccce5ae2a1
commit 3c0192c00c

View file

@ -33,7 +33,7 @@ func TestMain(t *testing.T) {
var item interface{} var item interface{}
item = nil item = nil
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
} }
@ -43,31 +43,31 @@ func TestSimple(t *testing.T) {
Convey("Can copy bool", t, func() { Convey("Can copy bool", t, func() {
item := true item := true
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy int64", t, func() { Convey("Can copy int64", t, func() {
item := int64(1) item := int64(1)
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy float64", t, func() { Convey("Can copy float64", t, func() {
item := float64(1) item := float64(1)
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy string", t, func() { Convey("Can copy string", t, func() {
item := "string" item := "string"
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy time.Time", t, func() { Convey("Can copy time.Time", t, func() {
item := time.Now() item := time.Now()
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
} }
@ -80,7 +80,7 @@ func TestSlices(t *testing.T) {
false, false,
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy slice of int64s", t, func() { Convey("Can copy slice of int64s", t, func() {
@ -90,7 +90,7 @@ func TestSlices(t *testing.T) {
3, 3,
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy slice of float64s", t, func() { Convey("Can copy slice of float64s", t, func() {
@ -100,7 +100,7 @@ func TestSlices(t *testing.T) {
3, 3,
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy slice of strings", t, func() { Convey("Can copy slice of strings", t, func() {
@ -110,7 +110,7 @@ func TestSlices(t *testing.T) {
"str", "str",
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy slice of time.Times", t, func() { Convey("Can copy slice of time.Times", t, func() {
@ -120,7 +120,7 @@ func TestSlices(t *testing.T) {
time.Now(), time.Now(),
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy slice of interfaces", t, func() { Convey("Can copy slice of interfaces", t, func() {
@ -132,7 +132,7 @@ func TestSlices(t *testing.T) {
time.Now(), time.Now(),
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
} }
@ -145,7 +145,7 @@ func TestObjects(t *testing.T) {
"b": false, "b": false,
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy map of int64s", t, func() { Convey("Can copy map of int64s", t, func() {
@ -155,7 +155,7 @@ func TestObjects(t *testing.T) {
"c": 3, "c": 3,
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy map of float64s", t, func() { Convey("Can copy map of float64s", t, func() {
@ -165,7 +165,7 @@ func TestObjects(t *testing.T) {
"c": 3, "c": 3,
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy map of strings", t, func() { Convey("Can copy map of strings", t, func() {
@ -175,7 +175,7 @@ func TestObjects(t *testing.T) {
"c": "str", "c": "str",
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy map of time.Times", t, func() { Convey("Can copy map of time.Times", t, func() {
@ -185,7 +185,7 @@ func TestObjects(t *testing.T) {
"c": time.Now(), "c": time.Now(),
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
Convey("Can copy map of interfaces", t, func() { Convey("Can copy map of interfaces", t, func() {
@ -197,7 +197,7 @@ func TestObjects(t *testing.T) {
"e": time.Now(), "e": time.Now(),
} }
done := Copy(item) done := Copy(item)
So(item, ShouldResemble, done) So(done, ShouldResemble, item)
}) })
} }
@ -241,25 +241,25 @@ func TestStructs(t *testing.T) {
Convey("Can copy struct", t, func() { Convey("Can copy struct", t, func() {
item := full item := full
done := Copy(item) done := Copy(item)
So(done, ShouldResemble, show) So(show, ShouldResemble, done)
}) })
Convey("Can copy pointer", t, func() { Convey("Can copy pointer", t, func() {
item := &full item := &full
done := Copy(item) done := Copy(item)
So(done, ShouldResemble, &show) So(&show, ShouldResemble, done)
}) })
Convey("Can copy slice of structs", t, func() { Convey("Can copy slice of structs", t, func() {
item := []interface{}{full, full} item := []interface{}{full, full}
done := Copy(item) done := Copy(item)
So(done, ShouldResemble, []interface{}{show, show}) So([]interface{}{show, show}, ShouldResemble, done)
}) })
Convey("Can copy slice of pointers", t, func() { Convey("Can copy slice of pointers", t, func() {
item := []interface{}{&full, &full} item := []interface{}{&full, &full}
done := Copy(item) done := Copy(item)
So(done, ShouldResemble, []interface{}{&show, &show}) So([]interface{}{&show, &show}, ShouldResemble, done)
}) })
} }