mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 06:20:38 +00:00
Merge branch 'devel' into araq-misc
This commit is contained in:
8
tests/ccgbugs/topenarraycast.nim
Normal file
8
tests/ccgbugs/topenarraycast.nim
Normal file
@@ -0,0 +1,8 @@
|
||||
proc foo[T](s: var openArray[T]): T =
|
||||
for x in s: result += x
|
||||
|
||||
proc bar(xyz: var seq[int]) =
|
||||
doAssert 6 == (seq[int](xyz)).foo()
|
||||
|
||||
var t = @[1,2,3]
|
||||
bar(t)
|
||||
13
tests/compiles/t8630.nim
Normal file
13
tests/compiles/t8630.nim
Normal file
@@ -0,0 +1,13 @@
|
||||
discard """
|
||||
output: '''
|
||||
foo
|
||||
bar
|
||||
'''
|
||||
"""
|
||||
|
||||
proc test(strings: seq[string]) =
|
||||
for s in strings:
|
||||
var p3 = unsafeAddr(s)
|
||||
echo p3[]
|
||||
|
||||
test(@["foo", "bar"])
|
||||
@@ -28,9 +28,12 @@ if paramCount() == 0:
|
||||
# windows kill happens using TerminateProcess(h, 0), so we should get a
|
||||
# 0 here
|
||||
echo p.waitForExit() == 0
|
||||
elif defined(haiku):
|
||||
# on Haiku, the program main thread receive SIGKILLTHR
|
||||
echo p.waitForExit() == 128 + SIGKILLTHR
|
||||
else:
|
||||
# on posix (non-windows), kill sends SIGKILL
|
||||
echo p.waitForExit() == 128 + SIGKILL
|
||||
|
||||
else:
|
||||
sleep(5000) # should get killed before this
|
||||
sleep(5000) # should get killed before this
|
||||
|
||||
@@ -12,6 +12,8 @@ else:
|
||||
var process: Process
|
||||
when defined(android):
|
||||
process = startProcess("/system/bin/env", "/system/bin", ["true"])
|
||||
elif defined(haiku):
|
||||
process = startProcess("/bin/env", "/bin", ["true"])
|
||||
else:
|
||||
process = startProcess("/usr/bin/env", "/usr/bin", ["true"])
|
||||
let dir2 = getCurrentDir()
|
||||
|
||||
@@ -109,10 +109,14 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
|
||||
safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)
|
||||
else:
|
||||
# posix relies on crappy LD_LIBRARY_PATH (ugh!):
|
||||
var libpath = getEnv"LD_LIBRARY_PATH".string
|
||||
const libpathenv = when defined(haiku):
|
||||
"LIBRARY_PATH"
|
||||
else:
|
||||
"LD_LIBRARY_PATH"
|
||||
var libpath = getEnv(libpathenv).string
|
||||
# Temporarily add the lib directory to LD_LIBRARY_PATH:
|
||||
putEnv("LD_LIBRARY_PATH", "tests/dll" & (if libpath.len > 0: ":" & libpath else: ""))
|
||||
defer: putEnv("LD_LIBRARY_PATH", libpath)
|
||||
putEnv(libpathenv, "tests/dll" & (if libpath.len > 0: ":" & libpath else: ""))
|
||||
defer: putEnv(libpathenv, libpath)
|
||||
var nimrtlDll = DynlibFormat % "nimrtl"
|
||||
safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user