diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-05-28 11:24:37 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-05-28 11:24:37 +0200 |
commit | 5db01f7abe960da9430a0440c2b579ad0f2d05bd (patch) | |
tree | 1bd502e59e13cf15d0f17d97affa751f5d7dc2b2 /lib | |
parent | 3221ac094398492e09ea618638204793b0990eca (diff) | |
parent | b6b6382e0b4f86759d07a1be150a826b9e0fe054 (diff) | |
download | Nim-5db01f7abe960da9430a0440c2b579ad0f2d05bd.tar.gz |
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/net.nim | 1 | ||||
-rw-r--r-- | lib/pure/os.nim | 3 | ||||
-rw-r--r-- | lib/pure/unittest.nim | 10 |
3 files changed, 10 insertions, 4 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim index fc04ef1af..bf5f3f57e 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -803,6 +803,7 @@ proc acceptAddr*(server: Socket, client: var Socket, address: var string, else: address = ret[1] client.fd = sock + client.domain = getSockDomain(sock) client.isBuffered = server.isBuffered # Handle SSL. diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 370420d37..3ff608cfc 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -70,7 +70,8 @@ when defined(windows): proc existsFile*(filename: string): bool {.rtl, extern: "nos$1", tags: [ReadDirEffect].} = - ## Returns true if the file exists, false otherwise. + ## Returns true if `filename` exists and is a regular file or symlink. + ## (directories, device files, named pipes and sockets return false) when defined(windows): when useWinUnicode: wrapUnary(a, getFileAttributesW, filename) diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 917251a6c..d804ba7c8 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -462,6 +462,8 @@ template suite*(name, body) {.dirty.} = finally: suiteEnded() +template exceptionTypeName(e: typed): string = $e.name + template test*(name, body) {.dirty.} = ## Define a single test case identified by `name`. ## @@ -476,7 +478,7 @@ template test*(name, body) {.dirty.} = ## .. code-block:: ## ## [OK] roses are red - bind shouldRun, checkpoints, formatters, ensureInitialized, testEnded + bind shouldRun, checkpoints, formatters, ensureInitialized, testEnded, exceptionTypeName ensureInitialized() @@ -495,8 +497,10 @@ template test*(name, body) {.dirty.} = except: when not defined(js): - checkpoint("Unhandled exception: " & getCurrentExceptionMsg()) - var stackTrace {.inject.} = getCurrentException().getStackTrace() + let e = getCurrentException() + let eTypeDesc = "[" & exceptionTypeName(e) & "]" + checkpoint("Unhandled exception: " & getCurrentExceptionMsg() & " " & eTypeDesc) + var stackTrace {.inject.} = e.getStackTrace() fail() finally: |