mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-15 09:32:40 +02:00
Add negative conditions to search queries + tests + better error messages by including filename:line in error messages
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@ -98,12 +99,14 @@ func RunTestServer(t *testing.T) func() {
|
||||
|
||||
func Check(t *testing.T, err error) {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
_, filename, line, _ := runtime.Caller(1)
|
||||
t.Fatalf("Unexpected error at %s:%d: %v", filename, line, err)
|
||||
}
|
||||
}
|
||||
|
||||
func CheckWithInfo(t *testing.T, err error, additionalInfo string) {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v! Additional info: %v", err, additionalInfo)
|
||||
_, filename, line, _ := runtime.Caller(1)
|
||||
t.Fatalf("Unexpected error: %v at %s:%d! Additional info: %v", err, filename, line, additionalInfo)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user