diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2021-02-17 23:59:58 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-18 06:59:58 +0100 |
commit | 8873ec60843c4c0e8ff5aa1fc25b225dc5f24b43 (patch) | |
tree | 1040108e5fe060d2643b1b50f57afbfec64be56e /tests/sets | |
parent | 4c568734f426052a43693772cf12301d7b457060 (diff) | |
download | Nim-8873ec60843c4c0e8ff5aa1fc25b225dc5f24b43.tar.gz |
fix #17076 (#17081)
Diffstat (limited to 'tests/sets')
-rw-r--r-- | tests/sets/tsets_various.nim | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/sets/tsets_various.nim b/tests/sets/tsets_various.nim index 3e468c8f9..5f3b23436 100644 --- a/tests/sets/tsets_various.nim +++ b/tests/sets/tsets_various.nim @@ -1,14 +1,15 @@ discard """ + targets: "c cpp js" output: ''' set is empty ''' """ -import sets, hashes +import std/[sets, hashes] -from sequtils import toSeq -from algorithm import sorted +from std/sequtils import toSeq +from std/algorithm import sorted proc sortedPairs[T](t: T): auto = toSeq(t.pairs).sorted template sortedItems(t: untyped): untyped = sorted(toSeq(t)) @@ -254,3 +255,24 @@ block: # test correctness after a number of inserts/deletes testDel(): (var t: HashSet[int]) testDel(): (var t: OrderedSet[int]) + + +template main() = + block: + let a = {true, false} + doAssert $a == "{false, true}" + doAssert a.len == 2 + + block: + let a = {false .. true} + doAssert $a == "{false, true}" + doAssert a.len == 2 + + block: + let a = {false .. false} + doAssert $a == "{false}" + doAssert a.len == 1 + + +static: main() +main() |