require errormsg to be specified before file.
This commit is contained in:
parent
ca394ebd95
commit
1105d03644
264 changed files with 305 additions and 623 deletions
|
|
@ -1,9 +1,9 @@
|
|||
discard """
|
||||
errormsg: "cannot evaluate at compile time: bn"
|
||||
file: "t99bott.nim"
|
||||
line: 26
|
||||
errormsg: "cannot evaluate at compile time: bn"
|
||||
disabled: false
|
||||
"""
|
||||
|
||||
## 99 Bottles of Beer
|
||||
## http://www.99-bottles-of-beer.net/
|
||||
## Nim version
|
||||
|
|
@ -30,7 +30,3 @@ for bn in countdown(99, 1):
|
|||
|
||||
echo "No more bottles of beer on the wall, no more bottles of beer."
|
||||
echo "Go to the store and buy some more, 99 bottles of beer on the wall."
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "tack.nim"
|
||||
output: "125"
|
||||
"""
|
||||
# the Ackermann function
|
||||
|
|
@ -17,5 +16,3 @@ proc ack(x, y: int): int =
|
|||
|
||||
# echo(ack(0, 0))
|
||||
write(stdout, ack(3, 4)) #OUT 125
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "tbug511622.nim"
|
||||
output: "3"
|
||||
"""
|
||||
import StrUtils, Math
|
||||
|
|
@ -11,6 +10,3 @@ proc FibonacciA(n: int): int64 =
|
|||
return int64((pow(p, fn) + pow(q, fn)) / sqrt(5.0))
|
||||
|
||||
echo FibonacciA(4) #OUT 3
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "temit.nim"
|
||||
output: "509"
|
||||
"""
|
||||
# Test the new ``emit`` pragma:
|
||||
|
|
@ -14,7 +13,3 @@ proc embedsC() =
|
|||
{.emit: """printf("%d\n", cvariable + (int)`nimVar`);""".}
|
||||
|
||||
embedsC()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
discard """
|
||||
file: "tevents.nim"
|
||||
output: '''HandlePrintEvent: Output -> Handled print event
|
||||
output: '''
|
||||
HandlePrintEvent: Output -> Handled print event
|
||||
HandlePrintEvent2: Output -> printing for ME
|
||||
HandlePrintEvent2: Output -> printing for ME'''
|
||||
HandlePrintEvent2: Output -> printing for ME
|
||||
'''
|
||||
"""
|
||||
|
||||
import events
|
||||
|
|
@ -45,4 +46,3 @@ ee.emit(obj.printEvent, eventargs)
|
|||
obj.printEvent.removeHandler(handleprintevent2)
|
||||
|
||||
ee.emit(obj.printEvent, eventargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
discard """
|
||||
errormsg: "cannot instantiate T2"
|
||||
file: "tgenconstraints.nim"
|
||||
line: 25
|
||||
disabled: true
|
||||
errormsg: "cannot instantiate T2"
|
||||
"""
|
||||
|
||||
type
|
||||
|
|
@ -29,4 +29,3 @@ proc bar(x: int|TNumber): T1[type(x)] {.discardable.} =
|
|||
bar "test"
|
||||
bar 100
|
||||
bar 1.1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
discard """
|
||||
file: "thintoff.nim"
|
||||
output: "0"
|
||||
"""
|
||||
|
||||
{.hint[XDeclaredButNotUsed]: off.}
|
||||
var
|
||||
x: int
|
||||
|
||||
echo x #OUT 0
|
||||
|
||||
|
||||
|
|
@ -1,12 +1,8 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got <int>"
|
||||
file: "tinc.nim"
|
||||
line: 8
|
||||
errormsg: "type mismatch: got <int>"
|
||||
"""
|
||||
var x = 0
|
||||
|
||||
inc(x+1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "tinit.nim"
|
||||
output: "Hello from module! Hello from main module!"
|
||||
"""
|
||||
# Test the new init section in modules
|
||||
|
|
@ -8,5 +7,3 @@ import minit
|
|||
|
||||
write(stdout, "Hello from main module!\n")
|
||||
#OUT Hello from module! Hello from main module!
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got <int literal(3)>"
|
||||
file: "tinout.nim"
|
||||
line: 12
|
||||
errormsg: "type mismatch: got <int literal(3)>"
|
||||
"""
|
||||
# Test in out checking for parameters
|
||||
|
||||
|
|
@ -12,5 +12,3 @@ proc b() =
|
|||
abc(3) #ERROR
|
||||
|
||||
b()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got <array[0..6, string], int literal(7)>"
|
||||
file: "tinvalidnewseq.nim"
|
||||
line: 15
|
||||
errormsg: "type mismatch: got <array[0..6, string], int literal(7)>"
|
||||
"""
|
||||
import re, strutils
|
||||
|
||||
|
|
@ -22,6 +22,3 @@ var r: TUrl
|
|||
|
||||
r = parseUrl(r"http://google.com/search?var=bleahdhsad")
|
||||
echo(r.domain)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
errorMsg: "attempting to call routine: '||'"
|
||||
file: "tissue710.nim"
|
||||
line: 8
|
||||
errorMsg: "attempting to call routine: '||'"
|
||||
"""
|
||||
var sum = 0
|
||||
for x in 3..1000:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
line: 12
|
||||
errormsg: "instantiate 'notConcrete' explicitly"
|
||||
line: 12
|
||||
disabled: "true"
|
||||
"""
|
||||
|
||||
|
|
@ -14,4 +14,3 @@ proc wrap[T]() =
|
|||
|
||||
|
||||
wrap[int]()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
discard """
|
||||
line: 8
|
||||
errormsg: "type mismatch: got <int literal(3)>"
|
||||
line: 8
|
||||
"""
|
||||
|
||||
# please finally disallow Len(3)
|
||||
|
||||
echo len(3)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
errormsg: "type mismatch"
|
||||
file: "tnot.nim"
|
||||
line: 14
|
||||
errormsg: "type mismatch"
|
||||
"""
|
||||
# BUG: following compiles, but should not:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "tparseopt.nim"
|
||||
output: '''
|
||||
parseopt
|
||||
first round
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "tpos.nim"
|
||||
output: "6"
|
||||
"""
|
||||
# test this particular function
|
||||
|
|
@ -31,5 +30,3 @@ var sub = "hello"
|
|||
var s = "world hello"
|
||||
write(stdout, mypos(sub, s))
|
||||
#OUT 6
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
discard """
|
||||
errormsg: "closing \" expected"
|
||||
file: "trawstr.nim"
|
||||
line: 10
|
||||
errormsg: "closing \" expected"
|
||||
"""
|
||||
# Test the new raw strings:
|
||||
|
||||
const
|
||||
xxx = r"This is a raw string!"
|
||||
yyy = "This not\" #ERROR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got <bool> but expected \'string\'"
|
||||
file: "tsimtych.nim"
|
||||
line: 10
|
||||
errormsg: "type mismatch: got <bool> but expected \'string\'"
|
||||
"""
|
||||
# Test 2
|
||||
# Simple type checking
|
||||
|
||||
var a: string
|
||||
a = false #ERROR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
file: "tslices.nim"
|
||||
output: '''456456
|
||||
output: '''
|
||||
456456
|
||||
456456
|
||||
456456
|
||||
Zugr5nd
|
||||
|
|
@ -56,4 +56,3 @@ echo mystr
|
|||
var s = "abcdef"
|
||||
s[1 .. ^2] = "xyz"
|
||||
assert s == "axyzf"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
discard """
|
||||
file: "tstrange.nim"
|
||||
output: '''hallo40
|
||||
output: '''
|
||||
hallo40
|
||||
1
|
||||
2'''
|
||||
2
|
||||
'''
|
||||
"""
|
||||
# test for extremely strange bug
|
||||
|
||||
|
|
@ -25,4 +26,3 @@ write(stdout, ack(5, 4))
|
|||
let h=3
|
||||
for x in 0.. <h.int:
|
||||
echo x
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
file: "tlenopenarray.nim"
|
||||
output: '''1
|
||||
output: '''
|
||||
1
|
||||
0
|
||||
Whopie
|
||||
12
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
discard """
|
||||
file: "tvarnums.nim"
|
||||
output: "Success!"
|
||||
"""
|
||||
# Test variable length binary integers
|
||||
|
|
@ -138,5 +137,3 @@ tm(low(int32))
|
|||
tm(high(int32))
|
||||
|
||||
writeLine(stdout, "Success!") #OUT Success!
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue