add nim c -r nimsuggest/tester to travis (#8805)
This commit is contained in:
parent
9ad17091cc
commit
01211ced1d
10 changed files with 27 additions and 3 deletions
|
|
@ -50,4 +50,4 @@ script:
|
||||||
- ./koch web
|
- ./koch web
|
||||||
- ./koch csource
|
- ./koch csource
|
||||||
- ./koch nimsuggest
|
- ./koch nimsuggest
|
||||||
# - nim c -r nimsuggest/tester
|
- nim c -r nimsuggest/tester
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@ import os, osproc, strutils, streams, re, sexp, net
|
||||||
|
|
||||||
type
|
type
|
||||||
Test = object
|
Test = object
|
||||||
cmd, dest: string
|
filename, cmd, dest: string
|
||||||
startup: seq[string]
|
startup: seq[string]
|
||||||
script: seq[(string, string)]
|
script: seq[(string, string)]
|
||||||
|
disabled: bool
|
||||||
|
|
||||||
const
|
const
|
||||||
curDir = when defined(windows): "" else: ""
|
curDir = when defined(windows): "" else: ""
|
||||||
|
|
@ -21,6 +22,7 @@ proc parseTest(filename: string; epcMode=false): Test =
|
||||||
const cursorMarker = "#[!]#"
|
const cursorMarker = "#[!]#"
|
||||||
let nimsug = curDir & addFileExt("nimsuggest", ExeExt)
|
let nimsug = curDir & addFileExt("nimsuggest", ExeExt)
|
||||||
let libpath = findExe("nim").splitFile().dir /../ "lib"
|
let libpath = findExe("nim").splitFile().dir /../ "lib"
|
||||||
|
result.filename = filename
|
||||||
result.dest = getTempDir() / extractFilename(filename)
|
result.dest = getTempDir() / extractFilename(filename)
|
||||||
result.cmd = nimsug & " --tester " & result.dest
|
result.cmd = nimsug & " --tester " & result.dest
|
||||||
result.script = @[]
|
result.script = @[]
|
||||||
|
|
@ -42,7 +44,14 @@ proc parseTest(filename: string; epcMode=false): Test =
|
||||||
if x.contains("""""""""):
|
if x.contains("""""""""):
|
||||||
inc specSection
|
inc specSection
|
||||||
elif specSection == 1:
|
elif specSection == 1:
|
||||||
if x.startsWith("$nimsuggest"):
|
if x.startsWith("disabled:"):
|
||||||
|
if x.startsWith("disabled:true"):
|
||||||
|
result.disabled = true
|
||||||
|
else:
|
||||||
|
# be strict about format
|
||||||
|
doAssert x.startsWith("disabled:false")
|
||||||
|
result.disabled = false
|
||||||
|
elif x.startsWith("$nimsuggest"):
|
||||||
result.cmd = x % ["nimsuggest", nimsug, "file", filename, "lib", libpath]
|
result.cmd = x % ["nimsuggest", nimsug, "file", filename, "lib", libpath]
|
||||||
elif x.startsWith("!"):
|
elif x.startsWith("!"):
|
||||||
if result.cmd.len == 0:
|
if result.cmd.len == 0:
|
||||||
|
|
@ -223,8 +232,14 @@ proc doReport(filename, answer, resp: string; report: var string) =
|
||||||
report.add "\n Expected: " & resp
|
report.add "\n Expected: " & resp
|
||||||
report.add "\n But got: " & answer
|
report.add "\n But got: " & answer
|
||||||
|
|
||||||
|
proc skipDisabledTest(test: Test): bool =
|
||||||
|
if test.disabled:
|
||||||
|
echo "disabled: " & test.filename
|
||||||
|
result = test.disabled
|
||||||
|
|
||||||
proc runEpcTest(filename: string): int =
|
proc runEpcTest(filename: string): int =
|
||||||
let s = parseTest(filename, true)
|
let s = parseTest(filename, true)
|
||||||
|
if s.skipDisabledTest: return 0
|
||||||
for cmd in s.startup:
|
for cmd in s.startup:
|
||||||
if not runCmd(cmd, s.dest):
|
if not runCmd(cmd, s.dest):
|
||||||
quit "invalid command: " & cmd
|
quit "invalid command: " & cmd
|
||||||
|
|
@ -267,6 +282,7 @@ proc runEpcTest(filename: string): int =
|
||||||
|
|
||||||
proc runTest(filename: string): int =
|
proc runTest(filename: string): int =
|
||||||
let s = parseTest filename
|
let s = parseTest filename
|
||||||
|
if s.skipDisabledTest: return 0
|
||||||
for cmd in s.startup:
|
for cmd in s.startup:
|
||||||
if not runCmd(cmd, s.dest):
|
if not runCmd(cmd, s.dest):
|
||||||
quit "invalid command: " & cmd
|
quit "invalid command: " & cmd
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ proc main =
|
||||||
|
|
||||||
#[!]#
|
#[!]#
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester $file
|
$nimsuggest --tester $file
|
||||||
>chk $1
|
>chk $1
|
||||||
chk;;skUnknown;;;;Hint;;???;;-1;;-1;;"tchk1 [Processing]";;0
|
chk;;skUnknown;;;;Hint;;???;;-1;;-1;;"tchk1 [Processing]";;0
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester --maxresults:2 $file
|
$nimsuggest --tester --maxresults:2 $file
|
||||||
>sug $1
|
>sug $1
|
||||||
sug;;skProc;;tdot4.main;;proc (inp: string): string;;$file;;10;;5;;"";;100;;None
|
sug;;skProc;;tdot4.main;;proc (inp: string): string;;$file;;10;;5;;"";;100;;None
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester compiler/nim.nim
|
$nimsuggest --tester compiler/nim.nim
|
||||||
>def compiler/semexprs.nim:25:50
|
>def compiler/semexprs.nim:25:50
|
||||||
def;;skType;;ast.PSym;;PSym;;*ast.nim;;707;;2;;"";;100
|
def;;skType;;ast.PSym;;PSym;;*ast.nim;;707;;2;;"";;100
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester lib/pure/strutils.nim
|
$nimsuggest --tester lib/pure/strutils.nim
|
||||||
>def lib/pure/strutils.nim:2529:6
|
>def lib/pure/strutils.nim:2529:6
|
||||||
def;;skTemplate;;system.doAssert;;proc (cond: bool, msg: string): typed;;*/lib/system.nim;;*;;9;;"same as `assert` but is always turned on and not affected by the\x0A``--assertions`` command line switch.";;100
|
def;;skTemplate;;system.doAssert;;proc (cond: bool, msg: string): typed;;*/lib/system.nim;;*;;9;;"same as `assert` but is always turned on and not affected by the\x0A``--assertions`` command line switch.";;100
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ proc main =
|
||||||
map0.#[!]#
|
map0.#[!]#
|
||||||
|
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester $file
|
$nimsuggest --tester $file
|
||||||
>sug $1
|
>sug $1
|
||||||
sug;;skProc;;tables.getOrDefault;;proc (t: Table[getOrDefault.A, getOrDefault.B], key: A): B;;$lib/pure/collections/tables.nim;;178;;5;;"";;100;;None
|
sug;;skProc;;tables.getOrDefault;;proc (t: Table[getOrDefault.A, getOrDefault.B], key: A): B;;$lib/pure/collections/tables.nim;;178;;5;;"";;100;;None
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester --maxresults:3 $file
|
$nimsuggest --tester --maxresults:3 $file
|
||||||
>sug $1
|
>sug $1
|
||||||
sug;;skType;;ttype_decl.Other;;Other;;$file;;10;;2;;"";;0;;None
|
sug;;skType;;ttype_decl.Other;;Other;;$file;;10;;2;;"";;0;;None
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,7 @@ echo r.age_human_yrs()
|
||||||
echo r
|
echo r
|
||||||
|
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester $file
|
$nimsuggest --tester $file
|
||||||
>sug $1
|
>sug $1
|
||||||
sug;;skField;;age;;int;;$file;;167;;6;;"";;100;;None
|
sug;;skField;;age;;int;;$file;;167;;6;;"";;100;;None
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,7 @@ echo r.age_human_yrs()
|
||||||
echo r
|
echo r
|
||||||
|
|
||||||
discard """
|
discard """
|
||||||
|
disabled:true
|
||||||
$nimsuggest --tester $file
|
$nimsuggest --tester $file
|
||||||
>sug $1
|
>sug $1
|
||||||
sug;;skField;;age;;int;;$file;;167;;6;;"";;100;;Prefix
|
sug;;skField;;age;;int;;$file;;167;;6;;"";;100;;Prefix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue