first implementation of segfaults stdlib module
This commit is contained in:
parent
e22c36dfc2
commit
7ff80cc8b2
2 changed files with 79 additions and 0 deletions
25
tests/stdlib/tsegfaults.nim
Normal file
25
tests/stdlib/tsegfaults.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
discard """
|
||||
output: '''caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!
|
||||
caught a crash!'''
|
||||
"""
|
||||
|
||||
import segfaults
|
||||
|
||||
proc main =
|
||||
try:
|
||||
var x: ptr int
|
||||
echo x[]
|
||||
except NilAccessError:
|
||||
echo "caught a crash!"
|
||||
|
||||
for i in 0..10:
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue