mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 19:04:46 +00:00
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:
@@ -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
18
tests/init/tproveinit.nim
Normal 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
|
||||
Reference in New Issue
Block a user