diff options
-rw-r--r-- | tests/types/t1252.nim | 12 | ||||
-rw-r--r-- | tests/types/t5640.nim | 6 | ||||
-rw-r--r-- | tests/types/t5648.nim | 21 | ||||
-rw-r--r-- | tests/types/t7581.nim | 1 | ||||
-rw-r--r-- | tests/types/t7905.nim | 33 | ||||
-rw-r--r-- | tests/types/tissues.nim | 72 | ||||
-rw-r--r-- | tests/vm/t4952.nim | 17 | ||||
-rw-r--r-- | tests/vm/t9043.nim | 10 | ||||
-rw-r--r-- | tests/vm/tissues.nim | 30 |
9 files changed, 102 insertions, 100 deletions
diff --git a/tests/types/t1252.nim b/tests/types/t1252.nim deleted file mode 100644 index c6a12e9f7..000000000 --- a/tests/types/t1252.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - output: '''true -true -true -true -''' -""" - -echo float32 isnot float64 -echo float32 isnot float -echo int32 isnot int64 -echo int32 isnot int diff --git a/tests/types/t5640.nim b/tests/types/t5640.nim deleted file mode 100644 index 5e1c99c4d..000000000 --- a/tests/types/t5640.nim +++ /dev/null @@ -1,6 +0,0 @@ -type - vecBase[I: static[int]] = distinct array[I, float32] - vec2* = vecBase[2] - -var v = vec2([0.0'f32, 0.0'f32]) - diff --git a/tests/types/t5648.nim b/tests/types/t5648.nim deleted file mode 100644 index c230cc12c..000000000 --- a/tests/types/t5648.nim +++ /dev/null @@ -1,21 +0,0 @@ -discard """ -output: "ptr Foo" -""" - -import typetraits - -type Foo = object - bar*: int - -proc main() = - var f = create(Foo) - f.bar = 3 - echo f.type.name - - discard realloc(f, 0) - - var g = Foo() - g.bar = 3 - -main() - diff --git a/tests/types/t7581.nim b/tests/types/t7581.nim deleted file mode 100644 index 796f30271..000000000 --- a/tests/types/t7581.nim +++ /dev/null @@ -1 +0,0 @@ -discard int -1 \ No newline at end of file diff --git a/tests/types/t7905.nim b/tests/types/t7905.nim deleted file mode 100644 index ef75bb86c..000000000 --- a/tests/types/t7905.nim +++ /dev/null @@ -1,33 +0,0 @@ -discard """ - output: ''' -(member: "hello world") -(member: 123.456) -(member: "hello world", x: ...) -(member: 123.456, x: ...) -''' -""" - -template foobar(arg: typed): untyped = - type - MyType = object - member: type(arg) - - var myVar: MyType - myVar.member = arg - echo myVar - -foobar("hello world") -foobar(123.456'f64) - -template foobarRec(arg: typed): untyped = - type - MyType = object - member: type(arg) - x: ref MyType - - var myVar: MyType - myVar.member = arg - echo myVar - -foobarRec("hello world") -foobarRec(123.456'f64) diff --git a/tests/types/tissues.nim b/tests/types/tissues.nim new file mode 100644 index 000000000..97c796302 --- /dev/null +++ b/tests/types/tissues.nim @@ -0,0 +1,72 @@ +discard """ + output: '''true +true +true +true +ptr Foo +(member: "hello world") +(member: 123.456) +(member: "hello world", x: ...) +(member: 123.456, x: ...) +''' +""" + +import typetraits + +block t1252: + echo float32 isnot float64 + echo float32 isnot float + echo int32 isnot int64 + echo int32 isnot int + +block t5640: + type + vecBase[I: static[int]] = distinct array[I, float32] + vec2 = vecBase[2] + + var v = vec2([0.0'f32, 0.0'f32]) + +block t5648: + type Foo = object + bar: int + + proc main() = + var f = create(Foo) + f.bar = 3 + echo f.type.name + + discard realloc(f, 0) + + var g = Foo() + g.bar = 3 + + main() + +block t7581: + discard int -1 + +block t7905: + template foobar(arg: typed): untyped = + type + MyType = object + member: type(arg) + + var myVar: MyType + myVar.member = arg + echo myVar + + foobar("hello world") + foobar(123.456'f64) + + template foobarRec(arg: typed): untyped = + type + MyType = object + member: type(arg) + x: ref MyType + + var myVar: MyType + myVar.member = arg + echo myVar + + foobarRec("hello world") + foobarRec(123.456'f64) diff --git a/tests/vm/t4952.nim b/tests/vm/t4952.nim deleted file mode 100644 index fc76fa4df..000000000 --- a/tests/vm/t4952.nim +++ /dev/null @@ -1,17 +0,0 @@ -import macros - -proc doCheck(tree: NimNode) = - let res: tuple[n: NimNode] = (n: tree) - assert: tree.kind == res.n.kind - for sub in tree: - doCheck(sub) - -macro id(body: untyped): untyped = - doCheck(body) - -id(foo((i: int))) - -static: - let tree = newTree(nnkExprColonExpr) - let t = (n: tree) - assert: t.n.kind == tree.kind diff --git a/tests/vm/t9043.nim b/tests/vm/t9043.nim deleted file mode 100644 index 1ae2e383c..000000000 --- a/tests/vm/t9043.nim +++ /dev/null @@ -1,10 +0,0 @@ -discard """ - nimout: "(Field0: 2, Field1: 2, Field2: 2, Field3: 2)" -""" - -proc foo[N: static[int]](dims: array[N, int])= - const N1 = N - const N2 = dims.len - static: echo (N, dims.len, N1, N2) - -foo([1, 2]) diff --git a/tests/vm/tissues.nim b/tests/vm/tissues.nim new file mode 100644 index 000000000..021b902ad --- /dev/null +++ b/tests/vm/tissues.nim @@ -0,0 +1,30 @@ +discard """ + nimout: "(Field0: 2, Field1: 2, Field2: 2, Field3: 2)" +""" + +import macros + +block t9043: + proc foo[N: static[int]](dims: array[N, int])= + const N1 = N + const N2 = dims.len + static: echo (N, dims.len, N1, N2) + + foo([1, 2]) + +block t4952: + proc doCheck(tree: NimNode) = + let res: tuple[n: NimNode] = (n: tree) + assert: tree.kind == res.n.kind + for sub in tree: + doCheck(sub) + + macro id(body: untyped): untyped = + doCheck(body) + + id(foo((i: int))) + + static: + let tree = newTree(nnkExprColonExpr) + let t = (n: tree) + assert: t.n.kind == tree.kind |