diff options
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r-- | tests/ccgbugs/t8964.nim | 10 | ||||
-rw-r--r-- | tests/ccgbugs/t8967.nim | 10 | ||||
-rw-r--r-- | tests/ccgbugs/tborrowmagic.nim | 8 | ||||
-rw-r--r-- | tests/ccgbugs/tcodegendecllambda.nim | 13 | ||||
-rw-r--r-- | tests/ccgbugs/thtiobj.nim | 8 |
5 files changed, 49 insertions, 0 deletions
diff --git a/tests/ccgbugs/t8964.nim b/tests/ccgbugs/t8964.nim new file mode 100644 index 000000000..5b41e8bdb --- /dev/null +++ b/tests/ccgbugs/t8964.nim @@ -0,0 +1,10 @@ +discard """ + targets: "c cpp" +""" + +from json import JsonParsingError +import marshal + +const nothing = "" +doAssertRaises(JsonParsingError): + var bar = marshal.to[int](nothing) diff --git a/tests/ccgbugs/t8967.nim b/tests/ccgbugs/t8967.nim new file mode 100644 index 000000000..e342b7eae --- /dev/null +++ b/tests/ccgbugs/t8967.nim @@ -0,0 +1,10 @@ +discard """ + targets: "c cpp" +""" + +import marshal + +let orig: set[char] = {'A'..'Z'} +let m = $$orig +let old = to[set[char]](m) +doAssert orig - old == {} diff --git a/tests/ccgbugs/tborrowmagic.nim b/tests/ccgbugs/tborrowmagic.nim new file mode 100644 index 000000000..8d42ddcd8 --- /dev/null +++ b/tests/ccgbugs/tborrowmagic.nim @@ -0,0 +1,8 @@ +type + Bytes = distinct seq[byte] + +proc add(x: var Bytes; b: byte) {.borrow.} +var x = @[].Bytes +x.add(42) +let base = cast[seq[byte]](x) +doAssert base.len == 1 and base[0] == 42 diff --git a/tests/ccgbugs/tcodegendecllambda.nim b/tests/ccgbugs/tcodegendecllambda.nim new file mode 100644 index 000000000..6dce68db5 --- /dev/null +++ b/tests/ccgbugs/tcodegendecllambda.nim @@ -0,0 +1,13 @@ +discard """ + targets: "c cpp js" + ccodecheck: "'HELLO'" +""" + +when defined(JS): + var foo = proc(): void{.codegenDecl: "/*HELLO*/function $2($3)".} = + echo "baa" +else: + var foo = proc(): void{.codegenDecl: "/*HELLO*/$1 $2 $3".} = + echo "baa" + +foo() diff --git a/tests/ccgbugs/thtiobj.nim b/tests/ccgbugs/thtiobj.nim new file mode 100644 index 000000000..7a656905f --- /dev/null +++ b/tests/ccgbugs/thtiobj.nim @@ -0,0 +1,8 @@ +discard """ + targets: "c cpp" +""" + +import typeinfo + +var x = "" +discard (getPointer(toAny(x))) |