Merge branch 'devel' of gh:/Araq/Nimrod into devel
This commit is contained in:
commit
f701ee086a
30 changed files with 240 additions and 76 deletions
|
|
@ -19,5 +19,18 @@ var
|
|||
new(a)
|
||||
q(a)
|
||||
|
||||
# bug #914
|
||||
var x = newWideCString("Hello")
|
||||
|
||||
echo "success"
|
||||
|
||||
|
||||
# bug #833
|
||||
|
||||
type
|
||||
PFuture*[T] = ref object
|
||||
value*: T
|
||||
finished*: bool
|
||||
cb: proc (future: PFuture[T]) {.closure.}
|
||||
|
||||
var k = PFuture[void]()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ type
|
|||
PMenuItem = ref object
|
||||
|
||||
proc createMenuItem*(menu: PMenu, label: string,
|
||||
action: proc (i: PMenuItem, p: pointer) {.cdecl.}) = nil
|
||||
action: proc (i: PMenuItem, p: pointer) {.cdecl.}) = discard
|
||||
|
||||
var s: PMenu
|
||||
createMenuItem(s, "Go to definition...",
|
||||
|
|
|
|||
20
tests/exprs/tifexpr_typeinference.nim
Normal file
20
tests/exprs/tifexpr_typeinference.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#bug #712
|
||||
|
||||
import tables
|
||||
|
||||
proc test(): TTable[string, string] =
|
||||
discard
|
||||
|
||||
proc test2(): TTable[string, string] =
|
||||
discard
|
||||
|
||||
var x = 5
|
||||
let blah =
|
||||
case x
|
||||
of 5:
|
||||
test2()
|
||||
of 2:
|
||||
test()
|
||||
else: test()
|
||||
|
||||
echo blah.len
|
||||
35
tests/notnil/tnotnil3.nim
Normal file
35
tests/notnil/tnotnil3.nim
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
discard """
|
||||
errormsg: "cannot prove 'variable' is not nil"
|
||||
line: 31
|
||||
"""
|
||||
|
||||
# bug #584
|
||||
# Testprogram for 'not nil' check
|
||||
|
||||
const testWithResult = true
|
||||
|
||||
type
|
||||
A = object
|
||||
B = object
|
||||
C = object
|
||||
a: ref A
|
||||
b: ref B
|
||||
|
||||
|
||||
proc testNotNil(c: ref C not nil) =
|
||||
discard
|
||||
|
||||
|
||||
when testWithResult:
|
||||
proc testNotNilOnResult(): ref C =
|
||||
new(result)
|
||||
#result.testNotNil() # Here 'not nil' can't be proved
|
||||
|
||||
|
||||
var variable: ref C
|
||||
new(variable)
|
||||
variable.testNotNil() # Here 'not nil' is proved
|
||||
|
||||
when testWithResult:
|
||||
discard testNotNilOnResult()
|
||||
|
||||
|
|
@ -3,3 +3,16 @@ import mtempl5
|
|||
|
||||
echo templ()
|
||||
|
||||
#bug #892
|
||||
|
||||
proc parse_to_close(value: string, index: int, open='(', close=')'): int =
|
||||
discard
|
||||
|
||||
# Call parse_to_close
|
||||
template get_next_ident: stmt =
|
||||
discard "{something}".parse_to_close(0, open = '{', close = '}')
|
||||
|
||||
get_next_ident()
|
||||
|
||||
|
||||
#identifier expected, but found '(open|open|open)'
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
## HTML generator for the tester.
|
||||
|
||||
import db_sqlite, cgi, backend, strutils
|
||||
import db_sqlite, cgi, backend, strutils, json
|
||||
|
||||
const
|
||||
TableHeader = """<table border="1">
|
||||
|
|
@ -114,8 +114,6 @@ proc getCommit(db: TDbConn, c: int): string =
|
|||
for thisCommit in db.rows(sql"select id from [Commit] order by id desc"):
|
||||
if commit == 0: result = thisCommit[0]
|
||||
inc commit
|
||||
if result.isNil:
|
||||
quit "cannot determine commit " & $c
|
||||
|
||||
proc generateHtml*(filename: string, commit: int) =
|
||||
const selRow = """select name, category, target, action,
|
||||
|
|
@ -161,20 +159,48 @@ proc generateHtml*(filename: string, commit: int) =
|
|||
close(outfile)
|
||||
|
||||
proc generateJson*(filename: string, commit: int) =
|
||||
const selRow = """select count(*),
|
||||
const
|
||||
selRow = """select count(*),
|
||||
sum(result = 'reSuccess'),
|
||||
sum(result = 'reIgnored')
|
||||
from TestResult
|
||||
where [commit] = ? and machine = ?
|
||||
order by category"""
|
||||
from TestResult
|
||||
where [commit] = ? and machine = ?
|
||||
order by category"""
|
||||
selDiff = """select A.category || '/' || A.target || '/' || A.name,
|
||||
A.result,
|
||||
B.result
|
||||
from TestResult A
|
||||
inner join TestResult B
|
||||
on A.name = B.name and A.category = B.category
|
||||
where A.[commit] = ? and B.[commit] = ? and A.machine = ?
|
||||
and A.result != B.result"""
|
||||
var db = open(connection="testament.db", user="testament", password="",
|
||||
database="testament")
|
||||
let lastCommit = db.getCommit(commit)
|
||||
if lastCommit.isNil:
|
||||
quit "cannot determine commit " & $commit
|
||||
|
||||
let previousCommit = db.getCommit(commit-1)
|
||||
|
||||
var outfile = open(filename, fmWrite)
|
||||
|
||||
let data = db.getRow(sql(selRow), lastCommit, $backend.getMachine(db))
|
||||
let machine = $backend.getMachine(db)
|
||||
let data = db.getRow(sql(selRow), lastCommit, machine)
|
||||
|
||||
outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#}""" % data)
|
||||
outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#""" % data)
|
||||
|
||||
if not previousCommit.isNil:
|
||||
let diff = newJArray()
|
||||
|
||||
for row in db.rows(sql(selDiff), previousCommit, lastCommit, machine):
|
||||
var obj = newJObject()
|
||||
obj["name"] = %row[0]
|
||||
obj["old"] = %row[1]
|
||||
obj["new"] = %row[2]
|
||||
diff.add obj
|
||||
outfile.writeln(""", "diff": """)
|
||||
outfile.writeln(diff.pretty)
|
||||
|
||||
outfile.writeln "}"
|
||||
close(db)
|
||||
close(outfile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue