Merge branch 'master' into 10979-cancelled-job-nodes
[arvados.git] / sdk / go / arvados / resource_list_test.go
1 package arvados
2
3 import (
4         "bytes"
5         "encoding/json"
6         "testing"
7         "time"
8 )
9
10 func TestMarshalFiltersWithNanoseconds(t *testing.T) {
11         t0 := time.Now()
12         t0str := t0.Format(time.RFC3339Nano)
13         buf, err := json.Marshal([]Filter{
14                 {Attr: "modified_at", Operator: "=", Operand: t0}})
15         if err != nil {
16                 t.Fatal(err)
17         }
18         if expect := []byte(`[["modified_at","=","` + t0str + `"]]`); 0 != bytes.Compare(buf, expect) {
19                 t.Errorf("Encoded as %q, expected %q", buf, expect)
20         }
21 }