Allow specifiying path to use for stdin error messages (#24595)

Implements #24569

Adds `--stdinfile` flag for specifying the file to use in place of
`stdinfile.nim` in error messages. Will enable easier integration of
tooling with nim check

(cherry picked from commit 0cba752c8a)
This commit is contained in:
Jake Leahy
2025-04-12 16:40:25 +10:00
committed by narimiran
parent 20ff258a08
commit ec1d68fc64
6 changed files with 27 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
discard """
action: "compile"
cmd: "cat $file | $nim check --stdinfile:$file -"
# Don't believe cat and pipes works on windows
disabled: "win"
"""
import std/[assertions, paths]
# Test the nimscript config is loaded
assert defined(nimscriptConfigLoaded)
assert currentSourcePath() == $(getCurrentDir()/Path"tloadstdin.nim")
{.warning: "Hello".} #[tt.Warning
^ Hello]#

View File

@@ -0,0 +1 @@
--d:nimscriptConfigLoaded