mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-28 03:16:32 +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:
11
tests/generics/mfriends.nim
Normal file
11
tests/generics/mfriends.nim
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
type
|
||||
TMyObj = object
|
||||
x: int
|
||||
|
||||
proc gen*[T](): T =
|
||||
var d: TMyObj
|
||||
# access private field here
|
||||
d.x = 3
|
||||
result = d.x
|
||||
|
||||
16
tests/generics/tconstraints.nim
Normal file
16
tests/generics/tconstraints.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
discard """
|
||||
errormsg: "type mismatch: got <int literal(232)>"
|
||||
line: 16
|
||||
"""
|
||||
|
||||
proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string =
|
||||
result = $x
|
||||
|
||||
type
|
||||
TMyObj = tuple[x, y: int]
|
||||
|
||||
var
|
||||
x: TMyObj
|
||||
|
||||
assert myGenericProc(x) == "(x: 0, y: 0)"
|
||||
assert myGenericProc(232) == "232"
|
||||
11
tests/generics/tfriends.nim
Normal file
11
tests/generics/tfriends.nim
Normal file
@@ -0,0 +1,11 @@
|
||||
discard """
|
||||
output: "3"
|
||||
"""
|
||||
|
||||
# Tests that a generic instantiation from a different module may access
|
||||
# private object fields:
|
||||
|
||||
import mfriends
|
||||
|
||||
echo gen[int]()
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
discard """
|
||||
exitcode: 0
|
||||
disabled: '''true'''
|
||||
"""
|
||||
import moverloading_typedesc
|
||||
import tables
|
||||
|
||||
@@ -9,7 +5,6 @@ type
|
||||
LFoo = object
|
||||
LBar = object
|
||||
|
||||
|
||||
when true:
|
||||
doAssert FBar.new() == 3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user