made tests green again

This commit is contained in:
Araq
2012-08-16 19:05:38 +02:00
parent e4c432387e
commit 0cac8d9b6f
7 changed files with 20 additions and 20 deletions

View File

@@ -183,7 +183,7 @@ proc readData*(allowedMethods: set[TRequestMethod] =
for name, value in decodeData(allowedMethods):
result[name.string] = value.string
proc validateData*(data: PStringTable, validKeys: openarray[string]) =
proc validateData*(data: PStringTable, validKeys: varargs[string]) =
## validates data; raises `ECgi` if this fails. This checks that each variable
## name of the CGI `data` occurs in the `validKeys` array.
for key, val in pairs(data):
@@ -318,7 +318,7 @@ proc getServerSoftware*(): string =
## returns contents of the ``SERVER_SOFTWARE`` environment variable
return getenv("SERVER_SOFTWARE").string
proc setTestData*(keysvalues: openarray[string]) =
proc setTestData*(keysvalues: varargs[string]) =
## fills the appropriate environment variables to test your CGI application.
## This can only simulate the 'GET' request method. `keysvalues` should
## provide embedded (name, value)-pairs. Example:

View File

@@ -15,7 +15,7 @@
## **Note**: This interface will change as soon as the compiler supports
## closures and proper coroutines.
proc concat*[T](seqs: openarray[seq[T]]): seq[T] =
proc concat*[T](seqs: varargs[seq[T]]): seq[T] =
## Takes several sequences' items and returns them inside of one sequence.
var L = 0
for seqitm in items(seqs): inc(L, len(seqitm))

View File

@@ -113,7 +113,7 @@ proc parseMultiBulk(r: TRedis): TRedisList =
for i in 1..numElems:
result.add(r.parseBulk())
proc sendCommand(r: TRedis, cmd: string, args: openarray[string]) =
proc sendCommand(r: TRedis, cmd: string, args: varargs[string]) =
var request = "*" & $(1 + args.len()) & "\c\L"
request.add("$" & $cmd.len() & "\c\L")
request.add(cmd & "\c\L")
@@ -123,7 +123,7 @@ proc sendCommand(r: TRedis, cmd: string, args: openarray[string]) =
r.socket.send(request)
proc sendCommand(r: TRedis, cmd: string, arg1: string,
args: openarray[string]) =
args: varargs[string]) =
var request = "*" & $(2 + args.len()) & "\c\L"
request.add("$" & $cmd.len() & "\c\L")
request.add(cmd & "\c\L")
@@ -136,7 +136,7 @@ proc sendCommand(r: TRedis, cmd: string, arg1: string,
# Keys
proc del*(r: TRedis, keys: openArray[string]): TRedisInteger =
proc del*(r: TRedis, keys: varargs[string]): TRedisInteger =
## Delete a key or multiple keys
r.sendCommand("DEL", keys)
return r.parseInteger()
@@ -323,7 +323,7 @@ proc hLen*(r: TRedis, key: string): TRedisInteger =
r.sendCommand("HLEN", key)
return r.parseInteger()
proc hMGet*(r: TRedis, key: string, fields: openarray[string]): TRedisList =
proc hMGet*(r: TRedis, key: string, fields: varargs[string]): TRedisList =
## Get the values of all the given hash fields
r.sendCommand("HMGET", key, fields)
return r.parseMultiBulk()
@@ -355,7 +355,7 @@ proc hVals*(r: TRedis, key: string): TRedisList =
# Lists
proc bLPop*(r: TRedis, keys: openarray[string], timeout: int): TRedisList =
proc bLPop*(r: TRedis, keys: varargs[string], timeout: int): TRedisList =
## Remove and get the *first* element in a list, or block until
## one is available
var args: seq[string] = @[]
@@ -364,7 +364,7 @@ proc bLPop*(r: TRedis, keys: openarray[string], timeout: int): TRedisList =
r.sendCommand("BLPOP", args)
return r.parseMultiBulk()
proc bRPop*(r: TRedis, keys: openarray[string], timeout: int): TRedisList =
proc bRPop*(r: TRedis, keys: varargs[string], timeout: int): TRedisList =
## Remove and get the *last* element in a list, or block until one
## is available.
var args: seq[string] = @[]
@@ -470,24 +470,24 @@ proc scard*(r: TRedis, key: string): TRedisInteger =
r.sendCommand("SCARD", key)
return r.parseInteger()
proc sdiff*(r: TRedis, keys: openarray[string]): TRedisList =
proc sdiff*(r: TRedis, keys: varargs[string]): TRedisList =
## Subtract multiple sets
r.sendCommand("SDIFF", keys)
return r.parseMultiBulk()
proc sdiffstore*(r: TRedis, destination: string,
keys: openarray[string]): TRedisInteger =
keys: varargs[string]): TRedisInteger =
## Subtract multiple sets and store the resulting set in a key
r.sendCommand("SDIFFSTORE", destination, keys)
return r.parseInteger()
proc sinter*(r: TRedis, keys: openarray[string]): TRedisList =
proc sinter*(r: TRedis, keys: varargs[string]): TRedisList =
## Intersect multiple sets
r.sendCommand("SINTER", keys)
return r.parseMultiBulk()
proc sinterstore*(r: TRedis, destination: string,
keys: openarray[string]): TRedisInteger =
keys: varargs[string]): TRedisInteger =
## Intersect multiple sets and store the resulting set in a key
r.sendCommand("SINTERSTORE", destination, keys)
return r.parseInteger()
@@ -523,13 +523,13 @@ proc srem*(r: TRedis, key: string, member: string): TRedisInteger =
r.sendCommand("SREM", key, member)
return r.parseInteger()
proc sunion*(r: TRedis, keys: openarray[string]): TRedisList =
proc sunion*(r: TRedis, keys: varargs[string]): TRedisList =
## Add multiple sets
r.sendCommand("SUNION", keys)
return r.parseMultiBulk()
proc sunionstore*(r: TRedis, destination: string,
key: openarray[string]): TRedisInteger =
key: varargs[string]): TRedisInteger =
## Add multiple sets and store the resulting set in a key
r.sendCommand("SUNIONSTORE", destination, key)
return r.parseInteger()
@@ -730,7 +730,7 @@ proc unwatch*(r: TRedis) =
r.sendCommand("UNWATCH")
raiseNoOK(r.parseStatus())
proc watch*(r: TRedis, key: openarray[string]) =
proc watch*(r: TRedis, key: varargs[string]) =
## Watch the given keys to determine execution of the MULTI/EXEC block
r.sendCommand("WATCH", key)
raiseNoOK(r.parseStatus())

View File

@@ -1,6 +1,6 @@
discard """
file: "system.nim"
line: 641
line: 643
errormsg: "type mismatch"
"""

View File

@@ -1,6 +1,6 @@
discard """
line: 10
errormsg: "illegal capture: 'A'"
errormsg: "illegal capture 'A'"
"""
proc outer() =

View File

@@ -7,5 +7,5 @@ discard """
# shouldn't compile since it doesn't do what you think it does without
# importing strutils:
let x = "abc" in "abcdef"
let x = "abcdef".contains("abc")
echo x

View File

@@ -5,7 +5,7 @@ discard """
import macros, parseutils, strutils
proc concat(strings: openarray[string]): string =
proc concat(strings: varargs[string]): string =
result = newString(0)
for s in items(strings): result.add(s)