Merge pull request #2 from Snider/feature-github-workflow
Add test coverage to workflow
This commit is contained in:
commit
eebca47b27
3 changed files with 11 additions and 5 deletions
10
.github/workflows/go.yml
vendored
10
.github/workflows/go.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue