start of tests refactoring; sqlite3 new wrapper fixes
This commit is contained in:
parent
6bc16904ed
commit
d913fdb280
173 changed files with 206 additions and 238 deletions
20
tests/reject/tinvalidnewseq.nim
Normal file
20
tests/reject/tinvalidnewseq.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import regexprs, strutils
|
||||
|
||||
type
|
||||
TURL = tuple[protocol, subdomain, domain, port: string, path: seq[string]]
|
||||
|
||||
proc parseURL(url: string): TURL =
|
||||
#([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)?
|
||||
var pattern: string = r"([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)?"
|
||||
var m: array[0..6, string] #Array with the matches
|
||||
newSeq(m, 7) #ERROR
|
||||
discard regexprs.match(url, pattern, m)
|
||||
|
||||
result = (protocol: m[1], subdomain: m[2], domain: m[3] & m[4],
|
||||
port: m[5], path: m[6].split('/'))
|
||||
|
||||
var r: TUrl
|
||||
|
||||
r = parseUrl(r"http://google.com/search?var=bleahdhsad")
|
||||
echo(r.domain)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue