Skip to content

v1.8.0

Compare
Choose a tag to compare
@maxatome maxatome released this 17 Dec 08:00
· 216 commits to master since this release
c62e308

New features:

  • add new JSONPointer operator following RFC 6901;
  • when 2 types differ but have the same short name, use full pkg name in error report;
  • add Cmp and Smuggle hooks feature;
  • new td.Tuple type added and its td.TupleFrom() builder. Useful to quickly test functions returning several values as in:
    price := func(p float64) (float64, string, error) {
      if p < 0 {
        return 0, "", errors.New("negative price not supported")
      }
      return p * 1.2, "€", nil
    }
    
    td.Cmp(t,
      td.TupleFrom(price(10)),
      td.TupleFrom(float64(12), "€", nil),
    )
    
    td.Cmp(t,
      td.TupleFrom(price(-10)),
      td.TupleFrom(float64(0), "", td.Not(nil)),
    )
  • when calling tdhttp.NewRequest() (and all other request builder methods) headers can be flattened with td.Flatten().

Fixes:

Enjoy!