From 143bf622cb71c9f52a079abe124b2cfaa67f55e5 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Mon, 10 Apr 2023 15:38:21 +0200 Subject: [PATCH] bump coverage --- colormapping_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/colormapping_test.go b/colormapping_test.go index da85d40..f9141a8 100644 --- a/colormapping_test.go +++ b/colormapping_test.go @@ -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) @@ -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) +}