mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +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:
2
tests/constructors/a.nim
Normal file
2
tests/constructors/a.nim
Normal file
@@ -0,0 +1,2 @@
|
||||
type A* = object
|
||||
a: uint8
|
||||
2
tests/constructors/b.nim
Normal file
2
tests/constructors/b.nim
Normal file
@@ -0,0 +1,2 @@
|
||||
type B* = object
|
||||
proc A*(a, b: float): B = discard
|
||||
3
tests/constructors/t18990.nim
Normal file
3
tests/constructors/t18990.nim
Normal file
@@ -0,0 +1,3 @@
|
||||
import a, b
|
||||
discard A(1f, 1f) # works
|
||||
proc x(b = A(1f, 1f)) = discard # doesn't work
|
||||
28
tests/constructors/tconstr1.nim
Normal file
28
tests/constructors/tconstr1.nim
Normal file
@@ -0,0 +1,28 @@
|
||||
discard """
|
||||
errormsg: "type mismatch"
|
||||
file: "tconstr1.nim"
|
||||
line: 25
|
||||
"""
|
||||
# Test array, record constructors
|
||||
|
||||
type
|
||||
TComplexRecord = tuple[
|
||||
s: string,
|
||||
x, y: int,
|
||||
z: float,
|
||||
chars: set[char]]
|
||||
|
||||
proc testSem =
|
||||
var
|
||||
things: array[0..1, TComplexRecord] = [
|
||||
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
|
||||
(s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})]
|
||||
write(stdout, things[0].x)
|
||||
|
||||
const
|
||||
things: array[0..1, TComplexRecord] = [
|
||||
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
|
||||
(s: "hi", x: 69, y: 45, z: 1.0)] #ERROR
|
||||
otherThings = [ # the same
|
||||
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
|
||||
(s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
|
||||
22
tests/constructors/tconstr2.nim
Normal file
22
tests/constructors/tconstr2.nim
Normal file
@@ -0,0 +1,22 @@
|
||||
discard """
|
||||
output: "69"
|
||||
"""
|
||||
# Test array, record constructors
|
||||
|
||||
type
|
||||
TComplexRecord = tuple[
|
||||
s: string,
|
||||
x, y: int,
|
||||
z: float,
|
||||
chars: set[char]]
|
||||
|
||||
const
|
||||
things: array[0..1, TComplexRecord] = [
|
||||
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
|
||||
(s: "hi", x: 69, y: 45, z: 1.0, chars: {})]
|
||||
otherThings = [ # the same
|
||||
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
|
||||
(s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
|
||||
|
||||
writeLine(stdout, things[0].x)
|
||||
#OUT 69
|
||||
Reference in New Issue
Block a user