-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from BugFixes/lotsOFix
lots of various fixes
- Loading branch information
Showing
15 changed files
with
469 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,23 @@ jobs: | |
fetch-depth: 1 | ||
- name: test | ||
run: go test -v -race -bench=./... -benchmem -timeout=120s -bench=./... ./... | ||
qodana: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
checks: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit | ||
fetch-depth: 0 # a full history is required for pull request analysis | ||
- name: 'Qodana Scan' | ||
uses: JetBrains/[email protected] | ||
env: | ||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} | ||
automerge: | ||
needs: | ||
- test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package logs_test | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"github.com/bugfixes/go-bugfixes/logs" | ||
"testing" | ||
) | ||
|
||
func TestUnwrap(t *testing.T) { | ||
err := fmt.Errorf("%w error", errors.New("error")) | ||
wrappedError := logs.BugFixes{ | ||
Err: err, | ||
} | ||
unwrappedError := wrappedError.UnwrapIt(err) | ||
|
||
if unwrappedError.Error() != "error" { | ||
t.Fatalf("Expected unwrapped error message to be 'error' instead got %v", unwrappedError.Error()) | ||
} | ||
} | ||
|
||
func TestNewBugFixes(t *testing.T) { | ||
err := errors.New("error") | ||
bugFixesError := logs.NewBugFixes(err) | ||
|
||
if bugFixesError == nil { | ||
t.Fatal("Expected BugFixes error to be 'error'") | ||
} | ||
} | ||
|
||
func TestConvertLevelFromString(t *testing.T) { | ||
tests := []struct { | ||
input string | ||
output int | ||
}{ | ||
{"log", 1}, | ||
{"debug", 1}, | ||
{"info", 2}, | ||
{"warn", 3}, | ||
{"error", 4}, | ||
{"crash", 5}, | ||
{"panic", 5}, | ||
{"fatal", 5}, | ||
{"unknown", 9}, | ||
{"10", 9}, | ||
{"unrecognized", 9}, | ||
} | ||
|
||
for _, test := range tests { | ||
converted := logs.ConvertLevelFromString(test.input) | ||
|
||
if converted != test.output { | ||
t.Fatalf("Expected '%v' to convert to %d, got %d", test.input, test.output, converted) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.