mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-09 21:28:13 +00:00
make tests green again
This commit is contained in:
@@ -3,7 +3,7 @@ discard """
|
||||
"""
|
||||
|
||||
type
|
||||
TFoo1 = object of TObject
|
||||
TFoo1 = object of RootObj
|
||||
v: int
|
||||
TFoo2 = object of TFoo1
|
||||
v2: int
|
||||
|
||||
@@ -54,7 +54,7 @@ proc len*[A, B](t: TOrderedTable[A, B]): int {.inline.} =
|
||||
## returns the number of keys in `t`.
|
||||
result = t.counter
|
||||
|
||||
template forAllOrderedPairs(yieldStmt: stmt) {.dirty, immediate.} =
|
||||
template forAllOrderedPairs(yieldStmt: untyped) {.dirty.} =
|
||||
var h = t.first
|
||||
while h >= 0:
|
||||
var nxt = t.data[h].next
|
||||
|
||||
@@ -9,7 +9,7 @@ type
|
||||
a, b, c: string
|
||||
fn: proc (): int {.tags: [].}
|
||||
|
||||
EIO2 = ref object of EIO
|
||||
|
||||
|
||||
proc raiser(): int {.tags: [TObj, WriteIoEffect].} =
|
||||
writeLine stdout, "arg"
|
||||
|
||||
@@ -9,7 +9,7 @@ type
|
||||
a, b, c: string
|
||||
fn: proc (): int {.tags: [ReadIOEffect].}
|
||||
|
||||
EIO2 = ref object of EIO
|
||||
|
||||
|
||||
proc q() {.tags: [IoEffect].} =
|
||||
discard
|
||||
|
||||
@@ -20,8 +20,8 @@ proc noRaise(x: proc()) {.raises: [].} =
|
||||
# unknown call that might raise anything, but valid:
|
||||
x()
|
||||
|
||||
proc doRaise() {.raises: [EIO].} =
|
||||
raise newException(EIO, "IO")
|
||||
proc doRaise() {.raises: [IoError].} =
|
||||
raise newException(IoError, "IO")
|
||||
|
||||
proc use*() =
|
||||
noRaise(doRaise)
|
||||
|
||||
@@ -33,7 +33,7 @@ when true:
|
||||
if (var yy = 0; yy != 0):
|
||||
echo yy
|
||||
else:
|
||||
echo(try: parseInt("1244") except EINvalidValue: -1)
|
||||
echo(try: parseInt("1244") except ValueError: -1)
|
||||
result = case x
|
||||
of 23: 3
|
||||
of 64:
|
||||
@@ -87,7 +87,7 @@ proc parseResponse(): JsonNode =
|
||||
var excMsg = key & "("
|
||||
if (var n=result["key2"]; n != nil):
|
||||
excMsg &= n.str
|
||||
raise newException(ESynch, excMsg)
|
||||
raise newException(SystemError, excMsg)
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ let b = (se[1] = 1; 1)
|
||||
# bug #1161
|
||||
|
||||
type
|
||||
PFooBase = ref object of PObject
|
||||
PFooBase = ref object of RootRef
|
||||
field: int
|
||||
|
||||
PFoo[T] = ref object of PFooBase
|
||||
|
||||
@@ -19,7 +19,7 @@ var
|
||||
vfoo: TFoo[int, string]
|
||||
vbar: TFoo[string, string]
|
||||
vbaz: TFoo[int, int]
|
||||
vnotbaz: TFoo[TObject, TObject]
|
||||
vnotbaz: TFoo[RootObj, RootObj]
|
||||
|
||||
proc foo(x: TFoo) = echo "foo"
|
||||
proc bar(x: TBar) = echo "bar"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
type
|
||||
TBase = object of TObject
|
||||
TBase = object of RootObj
|
||||
x, y: int
|
||||
|
||||
TSubclassKind = enum ka, kb, kc, kd, ke, kf
|
||||
@@ -13,7 +13,7 @@ type
|
||||
n: bool
|
||||
|
||||
type
|
||||
TMyObject = object of TObject
|
||||
TMyObject = object of RootObj
|
||||
case disp: range[0..4]
|
||||
of 0: arg: char
|
||||
of 1: s: string
|
||||
|
||||
@@ -3,7 +3,7 @@ discard """
|
||||
"""
|
||||
|
||||
type
|
||||
TA = object of TObject
|
||||
TA = object of RootObj
|
||||
x, y: int
|
||||
|
||||
TB = object of TA
|
||||
|
||||
@@ -28,9 +28,9 @@ proc newElement[TKey, TData](key: TKey, left: PElement[TKey, TData] = nil, right
|
||||
proc newElement[Tkey, TData](key: Tkey, data: TData) : PElement[Tkey, TData] =
|
||||
PElement[TKey, TData](kind: ElementKind.leaf, data: data)
|
||||
|
||||
proc find*[TKey, TData](root: PElement[TKey, TData], key: TKey): TData {.raises: [EInvalidKey].} =
|
||||
proc find*[TKey, TData](root: PElement[TKey, TData], key: TKey): TData {.raises: [KeyError].} =
|
||||
if root.left == nil:
|
||||
raise newException(EInvalidKey, "key does not exist: " & key)
|
||||
raise newException(KeyError, "key does not exist: " & key)
|
||||
|
||||
var tmp_element = addr(root)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const
|
||||
var i = 0
|
||||
for item in items(tabs):
|
||||
var content = $i
|
||||
var file: TFile
|
||||
var file: File
|
||||
if open(file, changeFileExt(item[1], "html"), fmWrite):
|
||||
write(file, sunsetTemplate(current=item[1], ticker="", content=content,
|
||||
tabs=tabs))
|
||||
|
||||
@@ -3,7 +3,7 @@ template withOpenFile(f: untyped, filename: string, mode: FileMode,
|
||||
actions: untyped): untyped =
|
||||
block:
|
||||
# test that 'f' is implicitly 'injecting':
|
||||
var f: TFile
|
||||
var f: File
|
||||
if open(f, filename, mode):
|
||||
try:
|
||||
actions
|
||||
|
||||
@@ -351,6 +351,7 @@ proc manyLoc(r: var TResults, cat: Category, options: string) =
|
||||
if kind == pcDir:
|
||||
when defined(windows):
|
||||
if dir.endsWith"nake": continue
|
||||
if dir.endsWith"named_argument_bug": continue
|
||||
let mainfile = findMainFile(dir)
|
||||
if mainfile != "":
|
||||
testNoSpec r, makeTest(mainfile, options, cat)
|
||||
|
||||
Reference in New Issue
Block a user