mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
make run the default action of a test in tester
This commit is contained in:
@@ -531,6 +531,7 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
|
||||
else:
|
||||
var testsRun = 0
|
||||
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
|
||||
echo name
|
||||
testSpec r, makeTest(name, options, cat)
|
||||
inc testsRun
|
||||
if testsRun == 0:
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
import parseutils, strutils, os, osproc, streams, parsecfg
|
||||
|
||||
|
||||
var compilerPrefix* = "compiler" / "nim "
|
||||
var compilerPrefix* = "compiler" / "nim"
|
||||
|
||||
let isTravis* = existsEnv("TRAVIS")
|
||||
let isAppVeyor* = existsEnv("APPVEYOR")
|
||||
|
||||
proc cmdTemplate*(): string =
|
||||
compilerPrefix & "$target --lib:lib --hints:on -d:testing --nimblePath:tests/deps $options $file"
|
||||
compilerPrefix & " $target --lib:lib --hints:on -d:testing --nimblePath:tests/deps $options $file"
|
||||
|
||||
type
|
||||
TTestAction* = enum
|
||||
actionCompile = "compile"
|
||||
actionRun = "run"
|
||||
actionCompile = "compile"
|
||||
actionReject = "reject"
|
||||
actionRunNoSpec = "runNoSpec"
|
||||
TResultEnum* = enum
|
||||
@@ -186,7 +186,7 @@ proc parseSpec*(filename: string): TSpec =
|
||||
raise newException(ValueError, "cannot interpret as a bool: " & e.value)
|
||||
of "cmd":
|
||||
if e.value.startsWith("nim "):
|
||||
result.cmd = compilerPrefix & e.value[4..^1]
|
||||
result.cmd = compilerPrefix & e.value[3..^1]
|
||||
else:
|
||||
result.cmd = e.value
|
||||
of "ccodecheck": result.ccodeCheck = e.value
|
||||
|
||||
@@ -469,7 +469,7 @@ proc main() =
|
||||
of "targets":
|
||||
targetsStr = p.val.string
|
||||
targets = parseTargets(targetsStr)
|
||||
of "nim": compilerPrefix = p.val.string & " "
|
||||
of "nim": compilerPrefix = p.val.string
|
||||
else: quit Usage
|
||||
p.next()
|
||||
if p.kind != cmdArgument: quit Usage
|
||||
|
||||
@@ -63,5 +63,3 @@ when defined(ssl):
|
||||
|
||||
assert msgCount == swarmSize * messagesToSend
|
||||
echo msgCount
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
# XXX: action should be run!
|
||||
|
||||
import asyncdispatch
|
||||
|
||||
proc completeOnReturn(fut: FutureVar[string], x: bool) {.async.} =
|
||||
@@ -44,4 +49,3 @@ proc main() {.async.} =
|
||||
|
||||
|
||||
waitFor main()
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
discard """
|
||||
output: '''
|
||||
(v: 3)
|
||||
'''
|
||||
"""
|
||||
|
||||
import typetraits
|
||||
type
|
||||
A[T] = ref object
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
discard """
|
||||
targets: "c cpp js"
|
||||
ccodecheck: "'HELLO'"
|
||||
action: compile
|
||||
"""
|
||||
|
||||
when defined(JS):
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
|
||||
discard """
|
||||
output: '''
|
||||
2
|
||||
2
|
||||
2
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug 2659
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# bug #2233
|
||||
type MalType = object
|
||||
fun: proc: MalType
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
discard """
|
||||
output: '''
|
||||
123
|
||||
baz
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug #5147
|
||||
|
||||
proc foo[T](t: T) =
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
|
||||
discard """
|
||||
output: '''
|
||||
vidx 18
|
||||
0,0
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug #4626
|
||||
var foo: (int, array[1, int]) # Tuple must be of length > 1
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# bug #3313
|
||||
import unittest, sugar
|
||||
{.experimental: "notnil".}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
type
|
||||
Byte* = uint8
|
||||
Bytes* = seq[Byte]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
discard """
|
||||
output: "16777215A"
|
||||
"""
|
||||
|
||||
import colors
|
||||
|
||||
echo int32(colWhite), 'A'
|
||||
|
||||
|
||||
@@ -1,4 +1,36 @@
|
||||
# bug #3799
|
||||
discard """
|
||||
output: '''
|
||||
00000000000000000000000000000000000000000
|
||||
00000000000001111111111111110000000000000
|
||||
00000000001111111111111111111110000000000
|
||||
00000000111111111111111111111111100000000
|
||||
00000011111222222221111111111111111000000
|
||||
00000111122222222222221111111111111100000
|
||||
00001112222333333459432111111111111110000
|
||||
00011122355544344463533221111111111111000
|
||||
00111124676667556896443322211111111111100
|
||||
00111126545561919686543322221111111111100
|
||||
01111123333346967807554322222211111111110
|
||||
01111122233334455582015332222221111111110
|
||||
01111122222333344567275432222222111111110
|
||||
01111112222222334456075443222222211111110
|
||||
01111111222222233459965444332222221111110
|
||||
01111111122222223457486554433322222111110
|
||||
01111111112222222367899655543333322111110
|
||||
01111111111122222344573948465444332111110
|
||||
00111111111112222334467987727667762111100
|
||||
00111111111111122233474655557836432111100
|
||||
00011111111111112233 454433334 4321111000
|
||||
00001111111111111122354333322222211110000
|
||||
00000111111111111111222222222222111100000
|
||||
00000001111111111111111122222111110000000
|
||||
00000000111111111111111111111111100000000
|
||||
00000000000111111111111111111100000000000
|
||||
00000000000000111111111111100000000000000
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
import macros
|
||||
|
||||
@@ -37,9 +69,9 @@ iterator stepIt[T](start, step: T, iterations: int): T =
|
||||
|
||||
|
||||
let c = (0.36237, 0.32)
|
||||
for y in stepIt(2.0, -0.0375, 107):
|
||||
for y in stepIt(2.0, -0.0375 * 4, 107 div 4):
|
||||
var row = ""
|
||||
for x in stepIt(-2.0, 0.025, 160):
|
||||
for x in stepIt(-2.0, 0.025 * 4, 160 div 4):
|
||||
#let n = julia((x, y), c, 4.0, nmax) ### this works
|
||||
let n = dendriteFractal((x, y), 4.0, nmax)
|
||||
if n < nmax:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
discard """
|
||||
file: "tgenscript.nim"
|
||||
target: "c"
|
||||
action: compile
|
||||
"""
|
||||
|
||||
echo "--genscript"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# bug #3669
|
||||
|
||||
@@ -10,4 +13,3 @@ type
|
||||
|
||||
var g: G[string]
|
||||
echo g.rnodes["foo"]
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
discard """
|
||||
output: '''
|
||||
312
|
||||
1000000
|
||||
1000000
|
||||
500000
|
||||
0
|
||||
'''
|
||||
"""
|
||||
|
||||
import strutils
|
||||
|
||||
type
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
discard """
|
||||
output: 100
|
||||
"""
|
||||
|
||||
var funcs: seq[proc (): int {.nimcall.}] = @[]
|
||||
for i in 0..10:
|
||||
funcs.add((proc (): int = return i * i))
|
||||
|
||||
echo(funcs[3]())
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
discard """
|
||||
nimout: '''
|
||||
t8314.nim(8, 7) Hint: BEGIN [User]
|
||||
t8314.nim(19, 7) Hint: END [User]
|
||||
t8314.nim(14, 7) Hint: BEGIN [User]
|
||||
t8314.nim(25, 7) Hint: END [User]
|
||||
'''
|
||||
|
||||
output: '''
|
||||
1
|
||||
1
|
||||
1
|
||||
'''
|
||||
"""
|
||||
|
||||
{.hint: "BEGIN".}
|
||||
|
||||
@@ -15,4 +15,4 @@ iterator fields(a = (0,0), b = (h-1,w-1)): auto =
|
||||
yield (y,x)
|
||||
|
||||
for y,x in fields():
|
||||
stdout.write disp[univ(x, y)]
|
||||
doAssert disp[univ(x, y)] == disp[Tree]
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
discard """
|
||||
output: '''
|
||||
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest2!test3?hi
|
||||
what's
|
||||
your
|
||||
name
|
||||
hi
|
||||
what's
|
||||
your
|
||||
name
|
||||
'''
|
||||
"""
|
||||
|
||||
# Test the new iterators
|
||||
|
||||
iterator xrange(fromm, to: int, step = 1): int =
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
discard """
|
||||
output: '''
|
||||
3 4
|
||||
4 5
|
||||
5 6
|
||||
6 7
|
||||
7 8
|
||||
(x: 3, y: 4)
|
||||
(x: 4, y: 5)
|
||||
(x: 5, y: 6)
|
||||
(x: 6, y: 7)
|
||||
(x: 7, y: 8)
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
iterator xrange(fromm, to: int, step = 1): tuple[x, y: int] =
|
||||
var a = fromm
|
||||
@@ -10,4 +25,3 @@ for a, b in xrange(3, 7):
|
||||
|
||||
for tup in xrange(3, 7):
|
||||
echo tup
|
||||
|
||||
|
||||
@@ -11,6 +11,3 @@ iterator iterAndZero(a: var openArray[int]): int =
|
||||
var x = [[1, 2, 3], [4, 5, 6]]
|
||||
for y in iterAndZero(x[0]): write(stdout, $y)
|
||||
#OUT 123
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
discard """
|
||||
output: '''
|
||||
@[@[1.0, 2.0], @[3.0, 4.0]]
|
||||
perm: 10.0 det: -2.0
|
||||
@[@[1.0, 2.0, 3.0, 4.0], @[4.0, 5.0, 6.0, 7.0], @[7.0, 8.0, 9.0, 10.0], @[10.0, 11.0, 12.0, 13.0]]
|
||||
perm: 29556.0 det: 0.0
|
||||
@[@[0.0, 1.0, 2.0, 3.0, 4.0], @[5.0, 6.0, 7.0, 8.0, 9.0], @[10.0, 11.0, 12.0, 13.0, 14.0], @[15.0, 16.0, 17.0, 18.0, 19.0], @[20.0, 21.0, 22.0, 23.0, 24.0]]
|
||||
perm: 6778800.0 det: 0.0
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
import sequtils, sugar
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
discard """
|
||||
ccodecheck: "!@('{' \\s* 'NI HEX3Astate;' \\s* '}')"
|
||||
output: '''
|
||||
a1 10
|
||||
a1 9
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug #1803
|
||||
@@ -26,6 +30,6 @@ var
|
||||
z: TaskFn
|
||||
|
||||
discard x()
|
||||
z = x #shallowCopy(z, x)
|
||||
z = y #shallowCopy(z, y)
|
||||
shallowCopy(z, x)
|
||||
shallowCopy(z, y)
|
||||
discard x()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
discard """
|
||||
msg: '''ObjectTy(Sym(Model), RecList(Sym(name), Sym(password)))
|
||||
BracketExpr(Sym(typeDesc), Sym(User))'''
|
||||
output: '''
|
||||
(ObjectTy (Empty) (Sym "Model") (RecList (Sym "name") (Sym "password")))
|
||||
(BracketExpr (Sym "typeDesc") (Sym "User"))
|
||||
'''
|
||||
"""
|
||||
import strutils, macros
|
||||
|
||||
|
||||
@@ -1,3 +1,35 @@
|
||||
discard """
|
||||
output: '''
|
||||
############
|
||||
#### gt ####
|
||||
############
|
||||
gt(Foo): typeDesc[Foo]
|
||||
gt(Bar): typeDesc[Bar]
|
||||
gt(Baz): typeDesc[int]
|
||||
gt(foo): distinct[int]
|
||||
gt(bar): distinct[int]
|
||||
gt(baz): int, int
|
||||
gt(v): seq[int]
|
||||
gt(vv): seq[float]
|
||||
gt(t): distinct[tuple[int, int]]
|
||||
gt(tt): distinct[tuple[float, float]]
|
||||
gt(s): distinct[tuple[int, int]]
|
||||
#############
|
||||
#### gt2 ####
|
||||
#############
|
||||
gt2(Foo): Foo
|
||||
gt2(Bar): Bar
|
||||
gt2(Baz): Baz
|
||||
gt2(foo): Foo
|
||||
gt2(bar): Bar
|
||||
gt2(baz): Baz
|
||||
gt2(v): seq[int]
|
||||
gt2(vv): seq[float]
|
||||
gt2(t): MyType[system.int]
|
||||
gt2(tt): MyType[system.float]
|
||||
gt2(s): MySimpleType
|
||||
'''
|
||||
"""
|
||||
|
||||
import macros, typetraits
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
discard """
|
||||
output: '''
|
||||
123
|
||||
Hallo Welt
|
||||
Hallo Welt
|
||||
'''
|
||||
"""
|
||||
|
||||
import macros
|
||||
|
||||
macro mac(): untyped =
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
|
||||
discard """
|
||||
output:'''
|
||||
void
|
||||
(Field0: "string", Field1: "string")
|
||||
1 mod 7
|
||||
@[2, 2, 2, 2, 2]
|
||||
impl 2 called
|
||||
asd
|
||||
Foo
|
||||
Bar
|
||||
'''
|
||||
"""
|
||||
|
||||
import typetraits, macros
|
||||
|
||||
@@ -145,6 +156,3 @@ block t3338:
|
||||
var t2 = Bar[int32]()
|
||||
t2.add()
|
||||
doAssert t2.x == 5
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
discard """
|
||||
output: '''
|
||||
proc Base
|
||||
proc Child
|
||||
method Base
|
||||
yield Base
|
||||
yield Child
|
||||
'''
|
||||
"""
|
||||
|
||||
import typetraits
|
||||
|
||||
type
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# test the new endian magic
|
||||
|
||||
writeLine(stdout, repr(system.cpuEndian))
|
||||
@@ -1,7 +1,6 @@
|
||||
#
|
||||
import times, os
|
||||
|
||||
var start = epochTime()
|
||||
os.sleep(1000)
|
||||
|
||||
echo epochTime() - start #OUT 1000
|
||||
let diff = abs(epochTime() - start - 1.0)
|
||||
doAssert diff < 0.005
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Hallo
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# noted this seems to be an old test file designed for manual testing.
|
||||
|
||||
import
|
||||
os, strutils, macros
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
import treorder
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
discard """
|
||||
output: '''
|
||||
abc
|
||||
xyz
|
||||
B.foo
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug #1595, #1612
|
||||
|
||||
import mexport2a
|
||||
|
||||
proc main() =
|
||||
echo "Import Test, two lines should follow. One with abc and one with xyz."
|
||||
printAbc()
|
||||
printXyz()
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# Covariance is not type safe:
|
||||
|
||||
type
|
||||
@@ -14,4 +18,3 @@ proc bp(x: var TB) = x.b[high(x.b)] = -1
|
||||
var f = cast[proc (x: var TA) {.nimcall.}](bp)
|
||||
var a: TA
|
||||
f(a) # bp expects a TB, but gets a TA
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
output: "[Suite] object basic methods"
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
type Obj = object
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
discard """
|
||||
sortoutput: true
|
||||
output: '''
|
||||
(x: 0.0)
|
||||
(x: 0.0)
|
||||
(x: 0.0)
|
||||
test
|
||||
test
|
||||
test
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug #2257
|
||||
import threadpool
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
discard """
|
||||
output: '''
|
||||
3
|
||||
25
|
||||
40
|
||||
50
|
||||
'''
|
||||
"""
|
||||
|
||||
import threadpool, os
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
output: "90"
|
||||
"""
|
||||
|
||||
|
||||
when false:
|
||||
template lock(a, b: ptr Lock; body: stmt) =
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
discard """
|
||||
output: '''
|
||||
done999 999
|
||||
'''
|
||||
"""
|
||||
|
||||
import threadpool
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
discard """
|
||||
ccodeCheck: "\\i @'deepCopy(' .*"
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# bug #2286
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
discard """
|
||||
output: '''
|
||||
Hello 1
|
||||
Hello 2
|
||||
Hello 3
|
||||
Hello 4
|
||||
Hello 5
|
||||
Hello 6
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
'''
|
||||
"""
|
||||
|
||||
# bug #2287
|
||||
|
||||
import threadPool
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
discard """
|
||||
ccodeCheck: "\\i @'__attribute__((noreturn))' .*"
|
||||
action: compile
|
||||
"""
|
||||
|
||||
proc noret1*(i: int) {.noreturn.} =
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
discard """
|
||||
"""
|
||||
|
||||
import os
|
||||
import osproc
|
||||
import parseopt2
|
||||
@@ -13,7 +10,6 @@ if argv == @[]:
|
||||
doAssert execShellCmd(getAppFilename() & " \"foo bar\" --aa:bar=a --a=c:d --ab -c --a[baz]:doo") == 0
|
||||
else:
|
||||
let f = toSeq(getopt())
|
||||
echo f.repr
|
||||
doAssert f[0].kind == cmdArgument and f[0].key == "foo bar" and f[0].val == ""
|
||||
doAssert f[1].kind == cmdLongOption and f[1].key == "aa" and f[1].val == "bar=a"
|
||||
doAssert f[2].kind == cmdLongOption and f[2].key == "a=c" and f[2].val == "d"
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
discard """
|
||||
output: '''
|
||||
arg
|
||||
arg
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
import sugar
|
||||
|
||||
@@ -6,4 +13,3 @@ template tempo(s) =
|
||||
|
||||
tempo((s: string)->auto => echo(s))
|
||||
tempo((s: string) => echo(s))
|
||||
|
||||
|
||||
0
tests/vm/tgorge.sh
Normal file → Executable file
0
tests/vm/tgorge.sh
Normal file → Executable file
0
tests/vm/tgorgeex.sh
Normal file → Executable file
0
tests/vm/tgorgeex.sh
Normal file → Executable file
Reference in New Issue
Block a user