mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-30 20:28:00 +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:
48
tests/overflow/trangechecks.nim
Normal file
48
tests/overflow/trangechecks.nim
Normal file
@@ -0,0 +1,48 @@
|
||||
discard """
|
||||
output: '''10
|
||||
10
|
||||
1
|
||||
1
|
||||
true'''
|
||||
"""
|
||||
|
||||
# bug #1344
|
||||
|
||||
var expected: int
|
||||
var x: range[1..10] = 10
|
||||
|
||||
try:
|
||||
x += 1
|
||||
echo x
|
||||
except OverflowDefect, RangeDefect:
|
||||
expected += 1
|
||||
echo x
|
||||
|
||||
try:
|
||||
inc x
|
||||
echo x
|
||||
except OverflowDefect, RangeDefect:
|
||||
expected += 1
|
||||
echo x
|
||||
|
||||
x = 1
|
||||
try:
|
||||
x -= 1
|
||||
echo x
|
||||
except OverflowDefect, RangeDefect:
|
||||
expected += 1
|
||||
echo x
|
||||
|
||||
try:
|
||||
dec x
|
||||
echo x
|
||||
except OverflowDefect, RangeDefect:
|
||||
expected += 1
|
||||
echo x
|
||||
|
||||
echo expected == 4
|
||||
|
||||
# bug #13698
|
||||
var
|
||||
x45 = "hello".cstring
|
||||
p = x45.len.int32
|
||||
Reference in New Issue
Block a user