Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c492c80881
|
|||
26dd16d021
|
|||
b0b43de8ca
|
@@ -224,3 +224,22 @@ func TestListener(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLongStdout(t *testing.T) {
|
||||
|
||||
res1, err := Runner("python").
|
||||
Arg("-c").
|
||||
Arg("import sys; import time; print(\"1234\" * 10000 + \"\\n\"); print(\"1234\" * 10000 + \"\\n\"); print(\"1234\" * 10000 + \"\\n\");").
|
||||
Timeout(100 * time.Millisecond).
|
||||
Run()
|
||||
if err != nil {
|
||||
t.Errorf("%v", err)
|
||||
}
|
||||
if res1.StdErr != "" {
|
||||
t.Errorf("res1.StdErr == '%v'", res1.StdErr)
|
||||
}
|
||||
if len(res1.StdOut) != 120006 {
|
||||
t.Errorf("len(res1.StdOut) == '%v'", len(res1.StdOut))
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ func init() {
|
||||
}
|
||||
|
||||
func TestResultCache1(t *testing.T) {
|
||||
cache := NewLRUMap[string](8)
|
||||
cache := NewLRUMap[string, string](8)
|
||||
verifyLRUList(cache, t)
|
||||
|
||||
key := randomKey()
|
||||
@@ -50,7 +50,7 @@ func TestResultCache1(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResultCache2(t *testing.T) {
|
||||
cache := NewLRUMap[string](8)
|
||||
cache := NewLRUMap[string, string](8)
|
||||
verifyLRUList(cache, t)
|
||||
|
||||
key1 := "key1"
|
||||
@@ -150,7 +150,7 @@ func TestResultCache2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResultCache3(t *testing.T) {
|
||||
cache := NewLRUMap[string](8)
|
||||
cache := NewLRUMap[string, string](8)
|
||||
verifyLRUList(cache, t)
|
||||
|
||||
key1 := "key1"
|
||||
@@ -173,7 +173,7 @@ func TestResultCache3(t *testing.T) {
|
||||
}
|
||||
|
||||
// does a basic consistency check over the internal cache representation
|
||||
func verifyLRUList[TData any](cache *LRUMap[TData], t *testing.T) {
|
||||
func verifyLRUList[TKey comparable, TData any](cache *LRUMap[TKey, TData], t *testing.T) {
|
||||
size := 0
|
||||
|
||||
tailFound := false
|
||||
|
@@ -70,7 +70,7 @@ func (t *RFC3339NanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) erro
|
||||
return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339NanoTime", bt))
|
||||
}
|
||||
var tt time.Time
|
||||
err := bson.Unmarshal(data, &tt)
|
||||
err := bson.RawValue{Type: bt, Value: data}.Unmarshal(&tt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ func TestRoundtrip(t *testing.T) {
|
||||
Value RFC3339NanoTime `json:"v"`
|
||||
}
|
||||
|
||||
val1 := NewRFC3339Nano(time.Now())
|
||||
val1 := NewRFC3339Nano(time.Unix(0, 1675951556820915171))
|
||||
w1 := Wrap{val1}
|
||||
|
||||
jstr1, err := json.Marshal(w1)
|
||||
@@ -20,7 +20,8 @@ func TestRoundtrip(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if string(jstr1) != "{\"v\":\"2023-01-29T20:32:36.149692117+01:00\"}" {
|
||||
if string(jstr1) != "{\"v\":\"2023-02-09T15:05:56.820915171+01:00\"}" {
|
||||
t.Errorf(string(jstr1))
|
||||
t.Errorf("repr differs")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user