Skip to content

Commit

Permalink
bump coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Apr 10, 2023
1 parent 261bca9 commit 143bf62
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions colormapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ func TestNewMapping(t *testing.T) {
err := m.LoadDefaults()
assert.NoError(t, err)

assert.NotNil(t, m.GetColors())

c := m.GetColor("scifi_nodes:blacktile2", 0)
assert.NotNil(t, c)
assert.Equal(t, uint8(20), c.R)
Expand All @@ -25,3 +27,28 @@ func TestNewMapping(t *testing.T) {
assert.NotNil(t, c)

}

func TestNewMappingErrors(t *testing.T) {
m := colormapping.NewColorMapping()
count, err := m.LoadBytes([]byte("stuff"))
assert.Error(t, err)
assert.Equal(t, 0, count)

count, err = m.LoadBytes([]byte("my:node invalid_r 0 0"))
assert.Error(t, err)
assert.Equal(t, 0, count)

count, err = m.LoadBytes([]byte("my:node 0 invalid_g 0"))
assert.Error(t, err)
assert.Equal(t, 0, count)

count, err = m.LoadBytes([]byte("my:node 0 0 invalid_b"))
assert.Error(t, err)
assert.Equal(t, 0, count)
}

func TestLoadErrors(t *testing.T) {
m := colormapping.NewColorMapping()
_, err := m.LoadVFSColors("bogus.txt")
assert.Error(t, err)
}

0 comments on commit 143bf62

Please sign in to comment.