summary refs log tree commit diff stats
path: root/nimpretty
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-04-30 02:00:33 -0700
committerGitHub <noreply@github.com>2021-04-30 11:00:33 +0200
commit20248a68fd867ce64822698b316f1a8b6300d7ca (patch)
tree73e601d34f14150a7a3cef76a24df185a36267c2 /nimpretty
parent16405083485967a395b8d677833bc26040881b21 (diff)
downloadNim-20248a68fd867ce64822698b316f1a8b6300d7ca.tar.gz
gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten (#17892)
* gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten
* refactor with createTempDir
* cleanup
* refacotr
* PRTEMP fake test spec changes to show effect of diffStrings
* add runnableExamples for experimental/diff + cross-reference with gitutils
* Revert "PRTEMP fake test spec changes to show effect of diffStrings"

This reverts commit 57dc8d642dce6c1127c98b7cbc9edbfe747d4047.
Diffstat (limited to 'nimpretty')
-rw-r--r--nimpretty/tester.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/nimpretty/tester.nim b/nimpretty/tester.nim
index 0a60ce693..b1f15aee6 100644
--- a/nimpretty/tester.nim
+++ b/nimpretty/tester.nim
@@ -1,6 +1,7 @@
 # Small program that runs the test cases
 
 import strutils, os, sequtils
+from std/private/gitutils import diffFiles
 
 const
   dir = "nimpretty/tests"
@@ -26,7 +27,7 @@ proc test(infile, ext: string) =
   let produced = dir / nimFile.changeFileExt(ext)
   if readFile(expected) != readFile(produced):
     echo "FAILURE: files differ: ", nimFile
-    discard execShellCmd("diff -uNdr " & expected & " " & produced)
+    echo diffFiles(expected, produced).output
     failures += 1
   else:
     echo "SUCCESS: files identical: ", nimFile
@@ -43,7 +44,7 @@ proc testTogether(infiles: seq[string]) =
     let produced = dir / "outputdir" / infile
     if readFile(expected) != readFile(produced):
       echo "FAILURE: files differ: ", nimFile
-      discard execShellCmd("diff -uNdr " & expected & " " & produced)
+      echo diffFiles(expected, produced).output
       failures += 1
     else:
       echo "SUCCESS: files identical: ", nimFile