diff options
author | Clyybber <darkmine956@gmail.com> | 2020-02-19 23:02:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-19 23:02:08 +0100 |
commit | 87dd19453b9a9aeded5f85714e90e12fc8bab0bf (patch) | |
tree | f8b75ccdfad7bf1b1ed2b821451804c02609b826 /lib/pure | |
parent | 8c22518d673cf792fa064d2d561d1c6f03b823bb (diff) | |
download | Nim-87dd19453b9a9aeded5f85714e90e12fc8bab0bf.tar.gz |
Remove testutils (#13435) [backport]
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/collections/tables.nim | 7 | ||||
-rw-r--r-- | lib/pure/testutils.nim | 15 |
2 files changed, 4 insertions, 18 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index bf08eaa92..2e3adc6fb 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -776,11 +776,12 @@ iterator allValues*[A, B](t: Table[A, B]; key: A): B = ## `add proc<#add,Table[A,B],A,B>`_). ## runnableExamples: - import testutils + import sequtils, algorithm + var a = {'a': 3, 'b': 5}.toTable for i in 1..3: a.add('z', 10*i) - doAssert a.sortedPairs == @[('a', 3), ('b', 5), ('z', 10), ('z', 20), ('z', 30)] - doAssert sortedItems(a.allValues('z')) == @[10, 20, 30] + doAssert toSeq(a.pairs).sorted == @[('a', 3), ('b', 5), ('z', 10), ('z', 20), ('z', 30)] + doAssert sorted(toSeq(a.allValues('z'))) == @[10, 20, 30] let hc = genHash(key) var h: Hash = hc and high(t.data) diff --git a/lib/pure/testutils.nim b/lib/pure/testutils.nim deleted file mode 100644 index bdf90b616..000000000 --- a/lib/pure/testutils.nim +++ /dev/null @@ -1,15 +0,0 @@ -## 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)) |