Enable --styleCheck:usages
This commit is contained in:
parent
1b561a9e71
commit
1f62235d4f
9 changed files with 39 additions and 37 deletions
|
|
@ -78,7 +78,7 @@ proc base64decode*(i: InputStream, o: OutputStream) {.fsMultiSync.} =
|
|||
proc decodeSize(size: int): int =
|
||||
return (size * 3 div 4) + 6
|
||||
|
||||
proc raiseInvalidChar(c: byte, pos: int) {.noReturn.} =
|
||||
proc raiseInvalidChar(c: byte, pos: int) {.noreturn.} =
|
||||
raise newException(ValueError,
|
||||
"Invalid base64 format character `" & char(c) & "` at location " & $pos & ".")
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import
|
|||
|
||||
setCurrentDir getAppDir()
|
||||
|
||||
proc str(bytes: openarray[byte]): string =
|
||||
proc str(bytes: openArray[byte]): string =
|
||||
result = newStringOfCap(bytes.len)
|
||||
for b in items(bytes):
|
||||
result.add b.char
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ when fsAsyncSupport:
|
|||
let size = sp.totalUnconsumedBytes()
|
||||
if size > 0:
|
||||
var data = newSeq[byte](size)
|
||||
discard sp.readinto(data)
|
||||
discard sp.readInto(data)
|
||||
result = cast[string](data)
|
||||
|
||||
suite "pipelines":
|
||||
|
|
@ -73,17 +73,17 @@ when fsAsyncSupport:
|
|||
|
||||
let inputText = loremIpsum.repeat(5000)
|
||||
|
||||
timeIt times.stdFunctionCalls:
|
||||
timeit times.stdFunctionCalls:
|
||||
stdRes = base64.decode(base64.encode(toUpperAscii(inputText)))
|
||||
|
||||
timeIt times.fsPipeline:
|
||||
timeit times.fsPipeline:
|
||||
fsRes = executePipeline(unsafeMemoryInput(inputText),
|
||||
upcaseAllCharacters,
|
||||
base64encode,
|
||||
base64decode,
|
||||
getOutput string)
|
||||
|
||||
timeIt times.fsAsyncPipeline:
|
||||
timeit times.fsAsyncPipeline:
|
||||
fsAsyncRes = waitFor executePipeline(Async unsafeMemoryInput(inputText),
|
||||
upcaseAllCharacters,
|
||||
base64encode,
|
||||
|
|
@ -130,7 +130,7 @@ when fsAsyncSupport:
|
|||
|
||||
let fsAsyncres = await f
|
||||
|
||||
check fsAsyncRes == toUpperAscii(inputText)
|
||||
check fsAsyncres == toUpperAscii(inputText)
|
||||
else:
|
||||
test "pipelines":
|
||||
skip
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue