From bf22b44b1fff3109f637f205b7d0fca855db9bbd Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Thu, 30 Jan 2020 01:54:50 -0800 Subject: [PATCH] miscellaneous bug fixes (#13291) * fix for emscripten etc * add testcase for #13290 * replace deprecated isNilOrWhitespace --- lib/pure/includes/osenv.nim | 2 +- lib/system/timers.nim | 2 +- testament/htmlgen.nim | 2 +- tests/system/tsystem_misc.nim | 9 +++++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/pure/includes/osenv.nim b/lib/pure/includes/osenv.nim index 30904c68849bc..c4c6669f9569e 100644 --- a/lib/pure/includes/osenv.nim +++ b/lib/pure/includes/osenv.nim @@ -68,7 +68,7 @@ when defined(windows) and not defined(nimscript): else: const - useNSGetEnviron = (defined(macosx) and not defined(ios)) or defined(nimscript) + useNSGetEnviron = (defined(macosx) and not defined(ios) and not defined(emscripten)) or defined(nimscript) when useNSGetEnviron: # From the manual: diff --git a/lib/system/timers.nim b/lib/system/timers.nim index 56575abb130de..ffb0f7716dec1 100644 --- a/lib/system/timers.nim +++ b/lib/system/timers.nim @@ -31,7 +31,7 @@ when defined(windows): result = Nanos(float64(a.int64 - b.int64) * performanceCounterRate) -elif defined(macosx): +elif defined(macosx) and not defined(emscripten): type MachTimebaseInfoData {.pure, final, importc: "mach_timebase_info_data_t", diff --git a/testament/htmlgen.nim b/testament/htmlgen.nim index ee3f3bad7f746..8e58dd95e4037 100644 --- a/testament/htmlgen.nim +++ b/testament/htmlgen.nim @@ -52,7 +52,7 @@ proc generateTestResultPanelPartial(outfile: File, testResultRow: JsonNode) = trId, name, target, category, action, resultDescription, timestamp, result, resultSign, panelCtxClass, textCtxClass, bgCtxClass ) - if expected.isNilOrWhitespace() and gotten.isNilOrWhitespace(): + if expected.isEmptyOrWhitespace() and gotten.isEmptyOrWhitespace(): outfile.generateHtmlTestresultOutputNone() else: outfile.generateHtmlTestresultOutputDetails( diff --git a/tests/system/tsystem_misc.nim b/tests/system/tsystem_misc.nim index 38be01a13ceec..56af97f36c52f 100644 --- a/tests/system/tsystem_misc.nim +++ b/tests/system/tsystem_misc.nim @@ -184,3 +184,12 @@ proc testMinMax(a,b: float32) = testMinMax(0.0, NaN) testMinMax(NaN, 0.0) + + +block: + type Foo = enum + k1, k2 + var + a = {k1} + b = {k1,k2} + doAssert a < b