new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
40
tests/notnil/tnotnil1.nim
Normal file
40
tests/notnil/tnotnil1.nim
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
discard """
|
||||
errormsg: "'y' is provably nil"
|
||||
line:38
|
||||
"""
|
||||
|
||||
import strutils
|
||||
|
||||
|
||||
type
|
||||
TObj = object
|
||||
x, y: int
|
||||
|
||||
type
|
||||
superstring = string not nil
|
||||
|
||||
|
||||
proc q(s: superstring) =
|
||||
echo s
|
||||
|
||||
proc p2() =
|
||||
var a: string = "I am not nil"
|
||||
q(a) # but this should and does not
|
||||
|
||||
p2()
|
||||
|
||||
proc q(x: pointer not nil) =
|
||||
nil
|
||||
|
||||
proc p() =
|
||||
var x: pointer
|
||||
if not x.isNil:
|
||||
q(x)
|
||||
|
||||
let y = x
|
||||
if not y.isNil:
|
||||
q(y)
|
||||
else:
|
||||
q(y)
|
||||
|
||||
p()
|
||||
Loading…
Add table
Add a link
Reference in a new issue