summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-08-07 09:52:55 -0700
committerAndreas Rumpf <rumpf_a@web.de>2018-08-07 18:52:55 +0200
commitc3523297143d730b1714f4987b5622d31c5f0c07 (patch)
tree60ccd9db1f541bdd0a5bf4bad69df6108f0d753f
parentba5e2d6fcb4d1dd5fde523076dafeed77360dba5 (diff)
downloadNim-c3523297143d730b1714f4987b5622d31c5f0c07.tar.gz
runnableExamples: keep (gitignored) generated foo_examples.nim for inspection even on success (#8544)
-rw-r--r--compiler/lineinfos.nim6
-rw-r--r--compiler/sem.nim3
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim
index 261dcb44e..4f0c3a778 100644
--- a/compiler/lineinfos.nim
+++ b/compiler/lineinfos.nim
@@ -92,7 +92,7 @@ const
     warnResultShadowed: "Special variable 'result' is shadowed.",
     warnInconsistentSpacing: "Number of spaces around '$#' is not consistent",
     warnUser: "$1",
-    hintSuccess: "operation successful",
+    hintSuccess: "operation successful: $#",
     hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#; $#)",
     hintCC: "CC: \'$1\'", # unused
     hintLineTooLong: "line too long",
@@ -169,8 +169,8 @@ proc computeNotesVerbosity(): array[0..3, TNoteKinds] =
     result[1] = result[2] - {warnShadowIdent, warnProveField, warnProveIndex,
       warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd,
       hintSource, hintGlobalVar, hintGCStats}
-    result[0] = result[1] - {hintSuccessX, hintConf, hintProcessing,
-      hintPattern, hintExecuting, hintLinking}
+    result[0] = result[1] - {hintSuccessX, hintSuccess, hintConf,
+      hintProcessing, hintPattern, hintExecuting, hintLinking}
 
 const
   NotesVerbosity* = computeNotesVerbosity()
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 2c3fab5a5..5d6e54604 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -621,7 +621,8 @@ proc testExamples(c: PContext) =
   if os.execShellCmd(os.getAppFilename() & " " & backend & " --nimcache:" & nimcache & " -r " & outp) != 0:
     quit "[Examples] failed: see " & outp
   else:
-    removeFile(outp)
+    # keep generated source file `outp` to allow inspection.
+    rawMessage(c.config, hintSuccess, ["runnableExamples: " & outp])
     removeFile(outp.changeFileExt(ExeExt))
     try:
       removeDir(nimcache)