Using anchoring

Last, operators can directly be anchored in litterals, still using the td.T type, avoiding the use of the Struct operator:

import (


func TestCreateRecord(tt *testing.T) {
  t := td.NewT(tt)

  before := time.Now().Truncate(time.Second)
  record, err := CreateRecord()

  if t.CmpNoError(err) {
    t.RootName("RECORD"). // Use RECORD instead of DATA in failure reports
          Name:      "Bob",
          Age:       23,
          Id:        t.Anchor(td.NotZero(), uint64(0)).(uint64),
          CreatedAt: t.Anchor(td.Between(before, time.Now())).(time.Time),
        "Newly created record")

See the Anchor method documentation for details. Note that A method is also a synonym for Anchor.

          Id:        t.A(td.NotZero(), uint64(0)).(uint64),
          CreatedAt: t.A(td.Between(before, time.Now())).(time.Time),