diff options
Diffstat (limited to 'tests/misc')
-rw-r--r-- | tests/misc/mjsondoc.nim | 3 | ||||
-rw-r--r-- | tests/misc/t12869.nim | 2 | ||||
-rw-r--r-- | tests/misc/t20883.nim | 7 | ||||
-rw-r--r-- | tests/misc/t23240.nim | 6 | ||||
-rw-r--r-- | tests/misc/t8545.nim | 3 | ||||
-rw-r--r-- | tests/misc/taddr.nim | 10 | ||||
-rw-r--r-- | tests/misc/tcast.nim | 7 | ||||
-rw-r--r-- | tests/misc/tconv.nim | 7 | ||||
-rw-r--r-- | tests/misc/trunner.nim | 6 | ||||
-rw-r--r-- | tests/misc/trunner_special.nim | 7 | ||||
-rw-r--r-- | tests/misc/tsizeof.nim | 8 |
11 files changed, 57 insertions, 9 deletions
diff --git a/tests/misc/mjsondoc.nim b/tests/misc/mjsondoc.nim index e4642f0b4..016c8522d 100644 --- a/tests/misc/mjsondoc.nim +++ b/tests/misc/mjsondoc.nim @@ -9,3 +9,6 @@ const type MyEnum* = enum foo, bar + +proc foo2*[T: int, M: string, U](x: T, y: U, z: M) = + echo 1 diff --git a/tests/misc/t12869.nim b/tests/misc/t12869.nim index 731a4e95e..054e28a03 100644 --- a/tests/misc/t12869.nim +++ b/tests/misc/t12869.nim @@ -1,5 +1,5 @@ discard """ - errormsg: "type mismatch: got <bool> but expected 'int'" + errormsg: "type mismatch: got <openArray[int], proc (x: GenericParam, y: GenericParam): auto, SortOrder>" line: 12 """ diff --git a/tests/misc/t20883.nim b/tests/misc/t20883.nim index d98feaa14..92e7929f4 100644 --- a/tests/misc/t20883.nim +++ b/tests/misc/t20883.nim @@ -1,8 +1,9 @@ discard """ action: reject - errormsg: "type mismatch: got <float64> but expected 'typeof(U(0.000001))'" - line: 8 - column: 22 +nimout: ''' +t20883.nim(13, 4) template/generic instantiation of `foo` from here +t20883.nim(9, 11) Error: cannot instantiate: 'U' +''' """ proc foo*[U](x: U = U(1e-6)) = diff --git a/tests/misc/t23240.nim b/tests/misc/t23240.nim new file mode 100644 index 000000000..d5edcefe8 --- /dev/null +++ b/tests/misc/t23240.nim @@ -0,0 +1,6 @@ +discard """ + cmd: "nim c foo/bar.nim" + action: "reject" + errormsg: "cannot open 'foo/'" + file: "" +""" diff --git a/tests/misc/t8545.nim b/tests/misc/t8545.nim index 89957e1d3..48b886cb8 100644 --- a/tests/misc/t8545.nim +++ b/tests/misc/t8545.nim @@ -1,5 +1,6 @@ discard """ - targets: "c cpp js" + # just tests that this doesn't crash the compiler + errormsg: "cannot instantiate: 'a:type'" """ # bug #8545 diff --git a/tests/misc/taddr.nim b/tests/misc/taddr.nim index 48d4928ac..64f95c7e3 100644 --- a/tests/misc/taddr.nim +++ b/tests/misc/taddr.nim @@ -273,6 +273,16 @@ proc test15939() = # bug #15939 (v2) else: # can't take address of cstring element in js when not defined(js): cstringTest() +block: # bug #23499 + template volatileStore[T](dest: ptr T, val: T) = + dest[] = val + + proc foo = + var ctr = 0 + volatileStore(addr ctr, 0) + + foo() + template main = # xxx wrap all other tests here like that so they're also tested in VM test14420() diff --git a/tests/misc/tcast.nim b/tests/misc/tcast.nim index 6d67b1c52..73196e76c 100644 --- a/tests/misc/tcast.nim +++ b/tests/misc/tcast.nim @@ -1,6 +1,7 @@ discard """ output: ''' Hello World +Hello World Hello World''' joinable: false """ @@ -8,7 +9,7 @@ type MyProc = proc() {.cdecl.} type MyProc2 = proc() {.nimcall.} type MyProc3 = proc() #{.closure.} is implicit -proc testProc() = echo "Hello World" +proc testProc() {.exportc:"foo".} = echo "Hello World" template reject(x) = doAssert(not compiles(x)) @@ -23,6 +24,10 @@ proc callPointer(p: pointer) = ffunc0() ffunc1() + # bug #5901 + proc foo() {.importc.} + (cast[proc(a: int) {.cdecl.}](foo))(5) + callPointer(cast[pointer](testProc)) reject: discard cast[enum](0) diff --git a/tests/misc/tconv.nim b/tests/misc/tconv.nim index e4a99344a..90fae868b 100644 --- a/tests/misc/tconv.nim +++ b/tests/misc/tconv.nim @@ -88,6 +88,13 @@ block: # https://github.com/nim-lang/RFCs/issues/294 reject: Goo(k2) reject: k2.Goo + type KooRange = range[k2..k2] + accept: KooRange(k2) + accept: k2.KooRange + let k2ranged: KooRange = k2 + accept: Koo(k2ranged) + accept: k2ranged.Koo + reject: # bug #18550 proc f(c: char): cstring = diff --git a/tests/misc/trunner.nim b/tests/misc/trunner.nim index f0262f528..6e5487d1b 100644 --- a/tests/misc/trunner.nim +++ b/tests/misc/trunner.nim @@ -224,13 +224,15 @@ sub/mmain.idx""", context doAssert exitCode == 0, msg let data = parseJson(readFile(output))["entries"] - doAssert data.len == 4 + doAssert data.len == 5 let doSomething = data[0] doAssert doSomething["name"].getStr == "doSomething" doAssert doSomething["type"].getStr == "skProc" doAssert doSomething["line"].getInt == 1 doAssert doSomething["col"].getInt == 0 doAssert doSomething["code"].getStr == "proc doSomething(x, y: int): int {.raises: [], tags: [], forbids: [].}" + let foo2 = data[4] + doAssert $foo2["signature"] == """{"arguments":[{"name":"x","type":"T"},{"name":"y","type":"U"},{"name":"z","type":"M"}],"genericParams":[{"name":"T","types":"int"},{"name":"M","types":"string"},{"name":"U"}]}""" block: # nim jsondoc # bug #11953 let file = testsDir / "misc/mjsondoc.nim" @@ -241,7 +243,7 @@ sub/mmain.idx""", context doAssert exitCode == 0, msg let data = parseJson(readFile(destDir / "mjsondoc.json"))["entries"] - doAssert data.len == 4 + doAssert data.len == 5 let doSomething = data[0] doAssert doSomething["name"].getStr == "doSomething" doAssert doSomething["type"].getStr == "skProc" diff --git a/tests/misc/trunner_special.nim b/tests/misc/trunner_special.nim index e13810722..e08b419b0 100644 --- a/tests/misc/trunner_special.nim +++ b/tests/misc/trunner_special.nim @@ -14,6 +14,10 @@ xxx test all tests/untestable/* here, possibly with adjustments to make running import std/[strformat,os,unittest,compilesettings] import stdtest/specialpaths + +from stdtest/testutils import disableSSLTesting + + const nim = getCurrentCompilerExe() mode = querySetting(backend) @@ -29,4 +33,5 @@ proc main = block: # SSL certificate check integration tests runCmd fmt"{nim} r {options} -d:ssl --threads:on --mm:refc {testsDir}/untestable/thttpclient_ssl_remotenetwork.nim" -main() +when not disableSSLTesting(): + main() diff --git a/tests/misc/tsizeof.nim b/tests/misc/tsizeof.nim index 0d96a5e04..ce5334664 100644 --- a/tests/misc/tsizeof.nim +++ b/tests/misc/tsizeof.nim @@ -732,3 +732,11 @@ type doAssert sizeof(PackedUnion) == 11 doAssert alignof(PackedUnion) == 1 + +# bug #22553 +type + ChunkObj = object + data: UncheckedArray[byte] + +doAssert sizeof(ChunkObj) == 1 +doAssert offsetOf(ChunkObj, data) == 1 |