summary refs log tree commit diff stats
path: root/lib/pure/testutils.nim
blob: bdf90b61635e263be820273ad4e90e3fe852dadf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## Utilities to help writing tests
##
## Unstable, experimental API.

import std/[sequtils, algorithm]

proc sortedPairs*[T](t: T): auto =
  ## helps when writing tests involving tables in a way that's robust to
  ## changes in hashing functions / table implementation.
  toSeq(t.pairs).sorted

template sortedItems*(t: untyped): untyped =
  ## helps when writing tests involving tables in a way that's robust to
  ## changes in hashing functions / table implementation.
  sorted(toSeq(t))