Merge pull request #2 from Snider/feature-github-workflow

Add test coverage to workflow
This commit is contained in:
Snider 2025-10-30 18:30:17 +00:00 committed by GitHub
commit eebca47b27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View file

@ -10,7 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
@ -24,4 +24,10 @@ jobs:
run: go build -v ./...
- name: Test
run: go test -v ./...
run: go test -v -coverprofile=coverage.out ./...
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.out

View file

@ -56,6 +56,6 @@ func createSalt(input string) string {
}
// Verify checks if an input string matches a given hash.
func Verifyf(input string, hash string) bool {
func Verify(input string, hash string) bool {
return Hash(input) == hash
}

View file

@ -13,6 +13,6 @@ func TestHash(t *testing.T) {
func TestVerify(t *testing.T) {
hash := Hash("hello")
assert.True(t, Verifyf("hello", hash))
assert.False(t, Verifyf("world", hash))
assert.True(t, Verify("hello", hash))
assert.False(t, Verify("world", hash))
}