diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-13 17:07:24 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-13 17:07:24 +0200 |
commit | 289f8d53ee960d35c1f0c42e8753ad536737b875 (patch) | |
tree | ca1f0af1e041ff5779d39a79c486c331a88c0334 /tests/bug_test.go | |
parent | deff9e0a41eca43f832314219241c9a63cf8007e (diff) | |
download | git-bug-289f8d53ee960d35c1f0c42e8753ad536737b875.tar.gz |
little bit more tests
Diffstat (limited to 'tests/bug_test.go')
-rw-r--r-- | tests/bug_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/bug_test.go b/tests/bug_test.go new file mode 100644 index 00000000..dfb3ac09 --- /dev/null +++ b/tests/bug_test.go @@ -0,0 +1,46 @@ +package tests + +import ( + "github.com/MichaelMure/git-bug/bug" + "testing" +) + +func TestBugId(t *testing.T) { + bug1, err := bug.NewBug() + if err != nil { + t.Error(err) + } + + if len(bug1.HumanId()) == 0 { + t.Fatal("Bug doesn't have a human readable identifier") + } +} + +func TestBugValidity(t *testing.T) { + bug1, err := bug.NewBug() + if err != nil { + t.Error(err) + } + + if bug1.IsValid() { + t.Fatal("Empty bug should be invalid") + } + + bug1.Append(createOp) + + if !bug1.IsValid() { + t.Fatal("Bug with just a CREATE should be valid") + } + + bug1.Append(createOp) + + if bug1.IsValid() { + t.Fatal("Bug with multiple CREATE should be invalid") + } + + bug1.Commit() + + if bug1.IsValid() { + t.Fatal("Bug with multiple CREATE should be invalid") + } +} |