[FIX] strtabs interpolation in nimscript (#15172)

* [FIX] strtabs interpolation in nimscript

* [TEST] Use `static` in strtabs test
This commit is contained in:
haxscramper 2020-08-09 15:12:53 +03:00 • committed by GitHub
commit e5dbdc1d37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -302,7 +302,7 @@ proc getValue(t: StringTableRef, flags: set[FormatFlag], key: string): string =
when defined(js) or defined(nimscript): when defined(js) or defined(nimscript):
result = "" result = ""
else: else:
if useEnvironment in flags: result = os.getEnv(key).string if useEnvironment in flags: result = getEnv(key).string
else: result = "" else: result = ""
if result.len == 0: if result.len == 0:
if useKey in flags: result = '$' & key if useKey in flags: result = '$' & key

View file

@ -0,0 +1,5 @@
import strtabs
static:
let t = {"name": "John", "city": "Monaco"}.newStringTable
doAssert "${name} lives in ${city}" % t == "John lives in Monaco"