diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim index 76f90938c3..676e8eb1dc 100644 --- a/lib/pure/strtabs.nim +++ b/lib/pure/strtabs.nim @@ -302,7 +302,7 @@ proc getValue(t: StringTableRef, flags: set[FormatFlag], key: string): string = when defined(js) or defined(nimscript): result = "" else: - if useEnvironment in flags: result = os.getEnv(key).string + if useEnvironment in flags: result = getEnv(key).string else: result = "" if result.len == 0: if useKey in flags: result = '$' & key diff --git a/tests/stdlib/tstrtabs.nims b/tests/stdlib/tstrtabs.nims new file mode 100644 index 0000000000..c8ed4ac406 --- /dev/null +++ b/tests/stdlib/tstrtabs.nims @@ -0,0 +1,5 @@ +import strtabs + +static: + let t = {"name": "John", "city": "Monaco"}.newStringTable + doAssert "${name} lives in ${city}" % t == "John lives in Monaco"