compilation cache: tests now part of test suite
This commit is contained in:
parent
5e5e4abfee
commit
2d54b85089
19 changed files with 250 additions and 46 deletions
9
tests/rodfiles/aconv.nim
Normal file
9
tests/rodfiles/aconv.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
discard """
|
||||
output: "ugly conversion successful"
|
||||
"""
|
||||
|
||||
import int2bool
|
||||
|
||||
if 4:
|
||||
echo "ugly conversion successful"
|
||||
|
||||
13
tests/rodfiles/amethods.nim
Normal file
13
tests/rodfiles/amethods.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
type
|
||||
TBaseClass* = object of TObject
|
||||
|
||||
proc newBaseClass*: ref TBaseClass =
|
||||
new result
|
||||
|
||||
method echoType*(x: ref TBaseClass) =
|
||||
echo "base class"
|
||||
|
||||
proc echoAlias*(x: ref TBaseClass) =
|
||||
echoType x
|
||||
|
||||
9
tests/rodfiles/bconv.nim
Normal file
9
tests/rodfiles/bconv.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
discard """
|
||||
output: "ugly conversion successful 2"
|
||||
"""
|
||||
|
||||
import int2bool
|
||||
|
||||
if 4:
|
||||
echo "ugly conversion successful 2"
|
||||
|
||||
30
tests/rodfiles/bmethods.nim
Normal file
30
tests/rodfiles/bmethods.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
discard """
|
||||
output: '''
|
||||
derived class
|
||||
base class
|
||||
'''
|
||||
"""
|
||||
|
||||
import amethods
|
||||
|
||||
|
||||
type
|
||||
TDerivedClass* = object of TBaseClass
|
||||
|
||||
proc newDerivedClass: ref TDerivedClass =
|
||||
new result
|
||||
|
||||
method echoType*(x: ref TDerivedClass) =
|
||||
echo "derived class"
|
||||
|
||||
var b, d: ref TBaseClass
|
||||
|
||||
b = newBaseClass()
|
||||
d = newDerivedClass()
|
||||
|
||||
#b.echoType()
|
||||
#d.echoType()
|
||||
|
||||
echoAlias d
|
||||
echoAlias b
|
||||
|
||||
30
tests/rodfiles/bmethods2.nim
Normal file
30
tests/rodfiles/bmethods2.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
discard """
|
||||
output: '''
|
||||
derived class 2
|
||||
base class
|
||||
'''
|
||||
"""
|
||||
|
||||
import amethods
|
||||
|
||||
|
||||
type
|
||||
TDerivedClass* = object of TBaseClass
|
||||
|
||||
proc newDerivedClass: ref TDerivedClass =
|
||||
new result
|
||||
|
||||
method echoType*(x: ref TDerivedClass) =
|
||||
echo "derived class 2"
|
||||
|
||||
var b, d: ref TBaseClass
|
||||
|
||||
b = newBaseClass()
|
||||
d = newDerivedClass()
|
||||
|
||||
#b.echoType()
|
||||
#d.echoType()
|
||||
|
||||
echoAlias d
|
||||
echoAlias b
|
||||
|
||||
9
tests/rodfiles/deada.nim
Normal file
9
tests/rodfiles/deada.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
discard """
|
||||
output: '''
|
||||
246
|
||||
'''
|
||||
"""
|
||||
|
||||
import deadg, deadb
|
||||
|
||||
|
||||
13
tests/rodfiles/deada2.nim
Normal file
13
tests/rodfiles/deada2.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
output: '''
|
||||
246
|
||||
xyzabc
|
||||
'''
|
||||
"""
|
||||
|
||||
import deadg, deadb
|
||||
|
||||
# now add call to previously unused proc p2:
|
||||
echo p2("xyz", "abc")
|
||||
|
||||
|
||||
7
tests/rodfiles/deadb.nim
Normal file
7
tests/rodfiles/deadb.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
import deadg
|
||||
|
||||
|
||||
echo p1(123, 123)
|
||||
|
||||
|
||||
10
tests/rodfiles/deadg.nim
Normal file
10
tests/rodfiles/deadg.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
{.deadCodeElim: on.}
|
||||
|
||||
proc p1*(x, y: int): int =
|
||||
result = x + y
|
||||
|
||||
proc p2*(x, y: string): string =
|
||||
result = x & y
|
||||
|
||||
|
||||
14
tests/rodfiles/gtkex1.nim
Executable file
14
tests/rodfiles/gtkex1.nim
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
import
|
||||
cairo, glib2, gtk2
|
||||
|
||||
proc destroy(widget: pWidget, data: pgpointer) {.cdecl.} =
|
||||
main_quit()
|
||||
|
||||
var
|
||||
window: pWidget
|
||||
nimrod_init()
|
||||
window = window_new(WINDOW_TOPLEVEL)
|
||||
discard signal_connect(window, "destroy",
|
||||
SIGNAL_FUNC(gtkex1.destroy), nil)
|
||||
show(window)
|
||||
main()
|
||||
22
tests/rodfiles/gtkex2.nim
Executable file
22
tests/rodfiles/gtkex2.nim
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
import
|
||||
glib2, gtk2
|
||||
|
||||
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
|
||||
main_quit()
|
||||
|
||||
var
|
||||
window: PWidget
|
||||
button: PWidget
|
||||
|
||||
nimrod_init()
|
||||
window = window_new(WINDOW_TOPLEVEL)
|
||||
button = button_new("Click me")
|
||||
set_border_width(PContainer(Window), 5)
|
||||
add(PContainer(window), button)
|
||||
discard signal_connect(window, "destroy",
|
||||
SIGNAL_FUNC(gtkex2.destroy), nil)
|
||||
show(button)
|
||||
show(window)
|
||||
main()
|
||||
|
||||
6
tests/rodfiles/hallo.nim
Executable file
6
tests/rodfiles/hallo.nim
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
discard """
|
||||
output: "Hello World"
|
||||
"""
|
||||
|
||||
echo "Hello World"
|
||||
|
||||
17
tests/rodfiles/hallo2.nim
Normal file
17
tests/rodfiles/hallo2.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
discard """
|
||||
output: "Hello World"
|
||||
"""
|
||||
|
||||
# Test incremental type information
|
||||
|
||||
type
|
||||
TNode = object {.pure.}
|
||||
le, ri: ref TNode
|
||||
data: string
|
||||
|
||||
proc newNode(data: string): ref TNode =
|
||||
new(result)
|
||||
result.data = data
|
||||
|
||||
echo newNode("Hello World").data
|
||||
|
||||
5
tests/rodfiles/int2bool.nim
Normal file
5
tests/rodfiles/int2bool.nim
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
converter uglyToBool*(x: int): bool =
|
||||
result = x != 0
|
||||
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
#
|
||||
# Nimrod Tester
|
||||
# (c) Copyright 2011 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## This program tests Nimrod's ROD file mechanism.
|
||||
|
||||
import
|
||||
parseutils, strutils, pegs, os, osproc, streams, parsecfg, browsers, json,
|
||||
marshal, cgi
|
||||
|
||||
const
|
||||
cmdTemplate = r"nimrod cc --hints:on $# $#"
|
||||
resultsFile = "testresults.html"
|
||||
jsonFile = "testresults.json"
|
||||
Usage = "usage: tester reject|compile|examples|run|merge [nimrod options]"
|
||||
|
||||
proc myExec(cmd: string): string =
|
||||
result = osproc.execProcess(cmd)
|
||||
|
||||
var
|
||||
pegLineError = peg"{[^(]*} '(' {\d+} ', ' \d+ ') Error:' \s* {.*}"
|
||||
pegOtherError = peg"'Error:' \s* {.*}"
|
||||
pegSuccess = peg"'Hint: operation successful'.*"
|
||||
pegOfInterest = pegLineError / pegOtherError / pegSuccess
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue