Merge tests into a larger file (part 1 of ∞) (#9318)
* merge actiontable tests * merge arithm tests * merge array tests * merge assign tests * merge bind tests * merge casestmt tests * merge closure tests * merge cnt seq tests * merge collections tests * merge concept issues tests * merge concept tests * fix failing tests * smaller outputs Use `doAssert` where possible. * fix wrong output * split `tcomputedgoto` * revert merging concepts * fix failing test
This commit is contained in:
parent
d2b04a8bc7
commit
7f18d7cbc1
103 changed files with 3736 additions and 3368 deletions
55
tests/closure/tissues.nim
Normal file
55
tests/closure/tissues.nim
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
discard """
|
||||
file: "tissues.nim"
|
||||
output: '''true'''
|
||||
"""
|
||||
|
||||
|
||||
block tissue600:
|
||||
for i in 1..1:
|
||||
var reported = false
|
||||
proc report() =
|
||||
reported = true
|
||||
|
||||
|
||||
|
||||
import sequtils
|
||||
block tissue1502def:
|
||||
let xs: seq[tuple[key: string, val: seq[string]]] = @[("foo", @["bar"])]
|
||||
|
||||
let maps = xs.map(
|
||||
proc(x: auto): tuple[typ: string, maps: seq[string]] =
|
||||
(x.key, x.val.map(proc(x: string): string = x)))
|
||||
|
||||
|
||||
|
||||
block tissue1642:
|
||||
var i = 0
|
||||
proc p() = inc(i)
|
||||
|
||||
|
||||
|
||||
block tissue1846:
|
||||
type
|
||||
TBinOp[T] = proc (x,y: T): bool
|
||||
THeap[T] = object
|
||||
cmp: TBinOp[T]
|
||||
|
||||
proc less[T](x,y: T): bool =
|
||||
x < y
|
||||
|
||||
proc initHeap[T](cmp: TBinOp[T]): THeap[T] =
|
||||
result.cmp = cmp
|
||||
|
||||
var h = initHeap[int](less[int])
|
||||
echo h.cmp(2,3)
|
||||
|
||||
|
||||
|
||||
block tissue1911:
|
||||
proc foo(x: int) : auto =
|
||||
|
||||
proc helper() : int = x
|
||||
proc bar() : int = helper()
|
||||
proc baz() : int = helper()
|
||||
|
||||
return (bar, baz)
|
||||
Loading…
Add table
Add a link
Reference in a new issue