make tests green again

This commit is contained in:
Andreas Rumpf 2016-11-24 11:48:23 +01:00
commit bc9015df50
5 changed files with 23 additions and 12 deletions

View file

@ -149,14 +149,25 @@ proc closePassesCached(a: var TPassContextArray) =
m = gPasses[i].close(a[i], m) m = gPasses[i].close(a[i], m)
a[i] = nil # free the memory here a[i] = nil # free the memory here
proc resolveMod(module, relativeTo: string): int32 =
let fullPath = findModule(module, relativeTo)
if fullPath.len == 0:
result = InvalidFileIDX
else:
result = fullPath.fileInfoIdx
proc processImplicits(implicits: seq[string], nodeKind: TNodeKind, proc processImplicits(implicits: seq[string], nodeKind: TNodeKind,
a: var TPassContextArray) = a: var TPassContextArray; m: PSym) =
# XXX fixme this should actually be relative to the config file!
let relativeTo = m.info.toFullPath
for module in items(implicits): for module in items(implicits):
var importStmt = newNodeI(nodeKind, gCmdLineInfo) # implicit imports should not lead to a module importing itself
var str = newStrNode(nkStrLit, module) if m.position != resolveMod(module, relativeTo):
str.info = gCmdLineInfo var importStmt = newNodeI(nodeKind, gCmdLineInfo)
importStmt.addSon str var str = newStrNode(nkStrLit, module)
if not processTopLevelStmt(importStmt, a): break str.info = gCmdLineInfo
importStmt.addSon str
if not processTopLevelStmt(importStmt, a): break
proc processModule*(graph: ModuleGraph; module: PSym, stream: PLLStream, proc processModule*(graph: ModuleGraph; module: PSym, stream: PLLStream,
rd: PRodReader; cache: IdentCache): bool {.discardable.} = rd: PRodReader; cache: IdentCache): bool {.discardable.} =
@ -183,8 +194,8 @@ proc processModule*(graph: ModuleGraph; module: PSym, stream: PLLStream,
# modules to include between compilation runs? we'd need to track that # modules to include between compilation runs? we'd need to track that
# in ROD files. I think we should enable this feature only # in ROD files. I think we should enable this feature only
# for the interactive mode. # for the interactive mode.
processImplicits implicitImports, nkImportStmt, a processImplicits implicitImports, nkImportStmt, a, module
processImplicits implicitIncludes, nkIncludeStmt, a processImplicits implicitIncludes, nkIncludeStmt, a, module
while true: while true:
var n = parseTopLevelStmt(p) var n = parseTopLevelStmt(p)

View file

@ -3,7 +3,7 @@ discard """
WARNING: false first assertion from bar WARNING: false first assertion from bar
ERROR: false second assertion from bar ERROR: false second assertion from bar
-1 -1
tests/assert/tfailedassert.nim:27 false assertion from foo tfailedassert.nim:27 false assertion from foo
''' '''
""" """

View file

@ -40,7 +40,7 @@ type
trailDelay*: float trailDelay*: float
body: chipmunk.PBody body: chipmunk.PBody
shape: chipmunk.PShape shape: chipmunk.PShape
import vehicles include vehicles
const const
LGrabbable* = (1 shl 0).TLayers LGrabbable* = (1 shl 0).TLayers
LBorders* = (1 shl 1).TLayers LBorders* = (1 shl 1).TLayers

View file

@ -1,6 +1,6 @@
import import
sfml, chipmunk, sfml, chipmunk,
sg_assets, sfml_stuff, "../keineschweine" sg_assets, sfml_stuff#, "../keineschweine"
proc accel*(obj: PVehicle, dt: float) = proc accel*(obj: PVehicle, dt: float) =

View file

@ -1,5 +1,5 @@
discard """ discard """
errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tests/method/tmapper.nim(22,7)" errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22,7)"
line: 25 line: 25
""" """