Merge branch '13493-document-federation' refs #13493
[arvados.git] / sdk / go / arvados / resource_list_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 import (
8         "bytes"
9         "encoding/json"
10         "testing"
11         "time"
12 )
13
14 func TestMarshalFiltersWithNanoseconds(t *testing.T) {
15         t0 := time.Now()
16         t0str := t0.Format(time.RFC3339Nano)
17         buf, err := json.Marshal([]Filter{
18                 {Attr: "modified_at", Operator: "=", Operand: t0}})
19         if err != nil {
20                 t.Fatal(err)
21         }
22         if expect := []byte(`[["modified_at","=","` + t0str + `"]]`); 0 != bytes.Compare(buf, expect) {
23                 t.Errorf("Encoded as %q, expected %q", buf, expect)
24         }
25 }