summary refs log tree commit diff stats
path: root/nimdoc/rsttester.nim
diff options
context:
space:
mode:
authorDaniel Belmes <3631206+DanielBelmes@users.noreply.github.com>2023-08-05 11:50:47 -0700
committerGitHub <noreply@github.com>2023-08-06 02:50:47 +0800
commit7bf7496557d939331193069f56c3faa91d81d9d3 (patch)
treeeb93a498f4f2e567154ea95afcc595a377872214 /nimdoc/rsttester.nim
parente0396900ed74eb821641d026a68415199fc4a257 (diff)
downloadNim-7bf7496557d939331193069f56c3faa91d81d9d3.tar.gz
fix server caching issue causing Theme failures (#22378)
* fix server caching issue causing Theme failures

* Fix tester to ignore version cache param

* fix case of people using -d:nimTestsNimdocFixup

* rsttester needed the same fix
Diffstat (limited to 'nimdoc/rsttester.nim')
-rw-r--r--nimdoc/rsttester.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/nimdoc/rsttester.nim b/nimdoc/rsttester.nim
index a0bdfca1e..be2b56c67 100644
--- a/nimdoc/rsttester.nim
+++ b/nimdoc/rsttester.nim
@@ -24,11 +24,13 @@ proc testRst2Html(fixup = false) =
     let sourceFile = expectedHtml.replace('\\', '/').replace("/expected/", "/source/").replace(".html", ".rst")
     exec("$1 rst2html $2" % [nimExe, sourceFile])
     let producedHtml = expectedHtml.replace('\\', '/').replace("/expected/", "/source/htmldocs/")
-    if readFile(expectedHtml) != readFile(producedHtml):
+    let versionCacheParam = "?v=" & $NimMajor & "." & $NimMinor & "." & $NimPatch
+    let producedFile = readFile(producedHtml).replace(versionCacheParam,"") #remove version cache param used for cache invalidation
+    if readFile(expectedHtml) != producedFile:
       echo diffFiles(expectedHtml, producedHtml).output
       inc failures
       if fixup:
-        copyFile(producedHtml, expectedHtml)
+        writeFile(expectedHtml, producedFile)
     else:
       echo "SUCCESS: files identical: ", producedHtml
     if failures == 0: