some test cleanups & category reorganization (#22010)

* clean up some test categories

* mention exact slice issue

* magics into system

* move trangechecks into overflow

* move tmemory to system

* try fix CI

* try fix CI

* final CI fix
This commit is contained in:
metagn
2023-06-06 07:54:07 +03:00
committed by GitHub
parent 2ab948ce53
commit b97d603cd0
134 changed files with 189 additions and 374 deletions

View File

@@ -57,3 +57,27 @@ proc currentlyValid(x: out int; y: out string; cond: bool) =
y = "abc" # <-- error: not every path initializes 'y'
currentlyValid gl, gs, false
block: # previously effects/toutparam
proc gah[T](x: out T) =
x = 3
proc arr1 =
var a: array[2, int]
var x: int
gah(x)
a[0] = 3
a[x] = 3
echo x
arr1()
proc arr2 =
var a: array[2, int]
var x: int
a[0] = 3
a[x] = 3 #[tt.Warning
^ use explicit initialization of 'x' for clarity [Uninit] ]#
echo x
arr2()

18
tests/init/tproveinit.nim Normal file
View File

@@ -0,0 +1,18 @@
discard """
joinable: false
"""
{.warningAsError[ProveInit]:on.}
template main() =
proc fn(): var int =
discard
discard fn()
doAssert not compiles(main())
# bug #9901
import std/[sequtils, times]
proc parseMyDates(line: string): DateTime =
result = parse(line, "yyyy-MM-dd")
var dateStrings = @["2018-12-01", "2018-12-02", "2018-12-03"]
var parsed = dateStrings.map(parseMyDates)
discard parsed