Fix some compilation warnings.

This commit is contained in:
cheatfate 2019-10-24 16:01:57 +03:00
parent 5758d07c08
commit 29d9274e03
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
14 changed files with 34 additions and 3 deletions

View File

@ -362,13 +362,13 @@ when defined(windows) or defined(nimdoc):
## Creates a new Dispatcher instance.
new result
result.ioPort = createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 1)
when compiles(initHashSet):
when declared(initHashSet):
# After 0.20.0 Nim's stdlib version
result.handles = initHashSet[AsyncFD]()
else:
# Pre 0.20.0 Nim's stdlib version
result.handles = initSet[AsyncFD]()
when compiles(initHeapQueue):
when declared(initHeapQueue):
# After 0.20.0 Nim's stdlib version
result.timers = initHeapQueue[TimerCallback]()
else:
@ -510,7 +510,12 @@ elif unixPlatform:
## Create new dispatcher.
new result
result.selector = newSelector[SelectorData]()
result.timers.newHeapQueue()
when declared(initHeapQueue):
# After 0.20.0 Nim's stdlib version
result.timers = initHeapQueue()
else:
# Before 0.20.0 Nim's stdlib version
result.timers.newHeapQueue()
result.callbacks = initDeque[AsyncCallback](64)
result.keys = newSeq[ReadyKey](64)
result.trackers = initTable[string, TrackerBase]()

View File

@ -8,6 +8,8 @@
import strutils, unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "TransportAddress test suite":
test "initTAddress(string)":
check $initTAddress("0.0.0.0:1") == "0.0.0.0:1"

View File

@ -8,6 +8,8 @@
import strutils, unittest, os
import ../chronos, ../chronos/streams/tlsstream
when defined(nimHasUsed): {.used.}
const SelfSignedRsaKey = """
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDSXcKMR6zIIHSy

View File

@ -8,6 +8,8 @@
import unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "Asynchronous issues test suite":
const HELLO_PORT = 45679
const TEST_MSG = "testmsg"

View File

@ -8,6 +8,8 @@
import strutils, net, unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "Datagram Transport test suite":
const
TestsCount = 2000

View File

@ -8,6 +8,8 @@
import unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "Future[T] behavior test suite":
proc testFuture1(): Future[int] {.async.} =
await sleepAsync(0.milliseconds)

View File

@ -8,6 +8,8 @@
import unittest
import ../chronos
when defined(nimHasUsed): {.used.}
proc asyncRetValue(n: int): Future[int] {.async.} =
await sleepAsync(n.milliseconds)
result = n * 10

View File

@ -8,6 +8,8 @@
import unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "Network utilities test suite":
const MaskVectors = [

View File

@ -8,6 +8,8 @@
import strutils, unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "Server's test suite":
type
CustomServer = ref object of StreamServer

View File

@ -8,6 +8,8 @@
import unittest, strutils
import ../chronos
when defined(nimHasUsed): {.used.}
when not defined(windows):
import posix

View File

@ -8,6 +8,8 @@
import unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "callSoon() tests suite":
const CallSoonTests = 10
var soonTest1 = 0'u

View File

@ -8,6 +8,8 @@
import strutils, unittest, os
import ../chronos
when defined(nimHasUsed): {.used.}
when defined(windows):
import winlean
else:

View File

@ -8,6 +8,8 @@
import unittest
import ../chronos
when defined(nimHasUsed): {.used.}
suite "Asynchronous sync primitives test suite":
var testLockResult = ""
var testEventResult = ""

View File

@ -8,6 +8,8 @@
import os, unittest
import ../chronos, ../chronos/timer
when defined(nimHasUsed): {.used.}
suite "Asynchronous timers test suite":
const TimersCount = 10