mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 15:10:12 +00:00
bybit: assortment of updates (#1192)
* bybit: cherry-pickable * bybit: implement fee fetching v5 * bybit: update to use nullable type * bybit: fix some tests * bybit: spell check fix * remove redunant asset dec, and rm output * rm comment code * linter: fixerinos woooo * bybit: constrict rate limit on public spot to v5 * exchanges/bybit/limits: update (CHERRY PICK ME) * glorious: nIIIIIIIIIIIIIIITS * glorious: nits continued * updated comment * update even more * RM LINE! * glorious: nits * Update exchanges/sharedtestvalues/sharedtestvalues.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * fix --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package sharedtestvalues
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -103,3 +108,42 @@ func SkipTestIfCannotManipulateOrders(t *testing.T, exch exchange.IBotExchange,
|
||||
func AreAPICredentialsSet(exch exchange.IBotExchange) bool {
|
||||
return exch.VerifyAPICredentials(exch.GetDefaultCredentials()) == nil
|
||||
}
|
||||
|
||||
// EmptyStringPotentialPattern is a regular expression pattern for a potential
|
||||
// empty string into float64
|
||||
var EmptyStringPotentialPattern = `.*float64.*json:"[^"]*,string".*`
|
||||
|
||||
// ForceFileStandard will check all files in the current directory for a regular
|
||||
// expression pattern. If the pattern is found the test will fail.
|
||||
func ForceFileStandard(t *testing.T, pattern string) error {
|
||||
t.Helper()
|
||||
|
||||
r := regexp.MustCompile(pattern)
|
||||
|
||||
root := "." // Specify the root directory to start walking from
|
||||
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !info.IsDir() && strings.HasSuffix(path, ".go") {
|
||||
fileContents, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to read file: %v", err)
|
||||
}
|
||||
|
||||
lines := bytes.Split(fileContents, []byte("\n"))
|
||||
for x, line := range lines {
|
||||
if r.Match(line) {
|
||||
t.Errorf("File: %s line contains pattern [%s] match with [%s] at line %d", path, pattern, string(line), x+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to walk directory: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user