From acf9e32fabae46bed4ac62b65c731ae8852eae7f Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Mon, 6 Feb 2017 21:41:43 +0100 Subject: [PATCH] Finally fixed travis build * Insulting comment on Travis and the universe in general here. --- test/tquickstart.nim | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/tquickstart.nim b/test/tquickstart.nim index 17ff18c..1be224b 100644 --- a/test/tquickstart.nim +++ b/test/tquickstart.nim @@ -1,6 +1,13 @@ import unittest, os, osproc, macros, strutils, streams -proc inputTest(basePath, path, nimPath: string): bool = +const baseDir = parentDir(staticExec("pwd")) +let (nimPathRaw, nimPathRet) = + execCmdEx("which nim", {poStdErrToStdOut, poUsePath}) +if nimPathRet != 0: quit "could not locate nim executable:\n" & nimPathRaw +let nimPath = + if nimPathRaw[0] == '/': nimPathRaw.strip else: baseDir / nimPathRaw.strip + +proc inputTest(basePath, path: string): bool = let absolutePath = basePath / path inFileOrig = absolutePath / "01-in.yaml" @@ -35,7 +42,7 @@ proc inputTest(basePath, path, nimPath: string): bool = result = false else: result = true -proc outputTest(basePath, path, nimPath: string): bool = +proc outputTest(basePath, path: string): bool = let absolutePath = basePath / path codeFileOrig = absolutePath / "00-code.nim" @@ -103,18 +110,15 @@ proc testsFor(path: string, root: bool = true, titlePrefix: string = ""): NimNode {.compileTime.} = result = newStmtList() let - baseDir = parentDir(staticExec("pwd")) - nimPathRaw = staticExec("which nim") - nimPath = if nimPathRaw[0] == '/': nimPathRaw else: baseDir / nimPathRaw title = titlePrefix & slurp(baseDir / path / "title").splitLines()[0] if fileExists(path / "00-code.nim"): var test = newCall("test", newLit(title)) if fileExists(path / "01-in.yaml"): test.add(newCall("doAssert", newCall("inputTest", newLit(baseDir), - newLit(path), newLit(nimPath)))) + newLit(path)))) elif fileExists(path / "01-out.yaml"): test.add(newCall("doAssert", newCall("outputTest", newLit(baseDir), - newLit(path), newLit(nimPath)))) + newLit(path)))) else: echo "Error: neither 01-in.yaml nor 01-out.yaml exists in " & path & '!' quit 1