Files
Nim/tests/effects/tstrict_funcs.nim
ee7 14c61ecf24 strictFuncs+views: add test that imports stdlib modules (#16878)
This commit attempts to improve testing of strictFuncs and views, and
prevent regressions like #16873 (resolved by 0b01eddace).

We previously only explicitly tested strictFuncs and views with a
smaller number of stdlib modules, mostly in:
- tests/effects/tstrict_funcs.nim
- tests/views/tcan_compile_nim.nim

Note that this commit leaves the `pegs` module commented out; it
cannot currently be compiled with `--experimental:views` (see #16892).

Note also that this commit is not sufficient to test strictFuncs and
views, but it does detect a subset of problems.
2021-02-03 16:00:29 +01:00

30 lines
775 B
Nim

discard """
cmd: "nim c --experimental:strictFuncs --experimental:views $file"
"""
import tables, streams, parsecsv
type
Contig2Reads = TableRef[string, seq[string]]
proc get_Contig2Reads(sin: Stream, fn: string, contig2len: TableRef[string, int]): Contig2Reads =
result = newTable[string, seq[string]]()
var parser: CsvParser
open(parser, sin, filename = fn, separator = ' ', skipInitialSpace = true)
while readRow(parser, 2):
if contig2len.haskey(parser.row[1]):
mgetOrPut(result, parser.row[1], @[]).add(parser.row[0])
block:
# issue #15756
func `&&&`[T](x: var seq[T], y: sink T): seq[T] =
newSeq(result, x.len + 1)
for i in 0..x.len-1:
result[i] = move(x[i])
result[x.len] = move(y)
var x = @[0, 1]
let z = x &&& 2