diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-29 20:41:19 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-29 20:41:19 +0200 |
commit | c46d01f8c10e6363b680fa6876e91bd8eaf3bb3e (patch) | |
tree | dde41c1253534bf4ff36e39454f2bdbdf4b9590f /bug/op_create_test.go | |
parent | 41e61a67b63e4d6c517005cf6f427115a664bdb5 (diff) | |
download | git-bug-c46d01f8c10e6363b680fa6876e91bd8eaf3bb3e.tar.gz |
bug: implement comment edition
- add a new operation
- add a new "timeline" in the snapshot that hold a processed version of the operations
Diffstat (limited to 'bug/op_create_test.go')
-rw-r--r-- | bug/op_create_test.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/bug/op_create_test.go b/bug/op_create_test.go index 2c5ae35b..e9a36cf8 100644 --- a/bug/op_create_test.go +++ b/bug/op_create_test.go @@ -1,9 +1,10 @@ package bug import ( - "reflect" "testing" "time" + + "github.com/go-test/deep" ) func TestCreate(t *testing.T) { @@ -20,16 +21,27 @@ func TestCreate(t *testing.T) { create.Apply(&snapshot) + hash, err := create.Hash() + if err != nil { + t.Fatal(err) + } + + comment := Comment{Author: rene, Message: "message", UnixTime: create.UnixTime} + expected := Snapshot{ Title: "title", Comments: []Comment{ - {Author: rene, Message: "message", UnixTime: create.UnixTime}, + comment, }, Author: rene, CreatedAt: create.Time(), + Timeline: []TimelineItem{ + NewCreateTimelineItem(hash, comment), + }, } - if !reflect.DeepEqual(snapshot, expected) { - t.Fatalf("%v different than %v", snapshot, expected) + deep.CompareUnexportedFields = true + if diff := deep.Equal(snapshot, expected); diff != nil { + t.Fatal(diff) } } |