forked from Plemya-x/ALR
tests: add TestRemoveDuplicatesSources
This commit is contained in:
parent
db244204c7
commit
86940e8962
@ -11,7 +11,7 @@
|
|||||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||||
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
||||||
<text x="33.5" y="14">coverage</text>
|
<text x="33.5" y="14">coverage</text>
|
||||||
<text x="86" y="15" fill="#010101" fill-opacity=".3">19.4%</text>
|
<text x="86" y="15" fill="#010101" fill-opacity=".3">19.8%</text>
|
||||||
<text x="86" y="14">19.4%</text>
|
<text x="86" y="14">19.8%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
47
pkg/build/utils_internal_test.go
Normal file
47
pkg/build/utils_internal_test.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// ALR - Any Linux Repository
|
||||||
|
// Copyright (C) 2025 Евгений Храмов
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package build
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRemoveDuplicatesSources(t *testing.T) {
|
||||||
|
type testCase struct {
|
||||||
|
Name string
|
||||||
|
Sources []string
|
||||||
|
Checksums []string
|
||||||
|
NewSources []string
|
||||||
|
NewChecksums []string
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range []testCase{{
|
||||||
|
Name: "prefer non-skip values",
|
||||||
|
Sources: []string{"a", "b", "c", "a"},
|
||||||
|
Checksums: []string{"skip", "skip", "skip", "1"},
|
||||||
|
NewSources: []string{"a", "b", "c"},
|
||||||
|
NewChecksums: []string{"1", "skip", "skip"},
|
||||||
|
}} {
|
||||||
|
t.Run(tc.Name, func(t *testing.T) {
|
||||||
|
s, c := removeDuplicatesSources(tc.Sources, tc.Checksums)
|
||||||
|
assert.Equal(t, s, tc.NewSources)
|
||||||
|
assert.Equal(t, c, tc.NewChecksums)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user