summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-08-31 17:23:35 +0200
committerAraq <rumpf_a@web.de>2014-08-31 17:23:35 +0200
commitd7d059a68695c10b7fe93f8f452d4aceb90857eb (patch)
tree5213fbd2b62b79b6071302b640d097582e8044bf /tests
parent93eb9c456d4195e4296b0f91d27ba0c3e3ab3f33 (diff)
downloadNim-d7d059a68695c10b7fe93f8f452d4aceb90857eb.tar.gz
more tests green
Diffstat (limited to 'tests')
-rw-r--r--tests/ccgbugs/tccgen1.nim2
-rw-r--r--tests/closure/tclosure.nim2
-rw-r--r--tests/closure/tclosurebug2.nim28
-rw-r--r--tests/destructor/tdictdestruct.nim2
-rw-r--r--tests/effects/teffects1.nim8
-rw-r--r--tests/effects/teffects2.nim8
-rw-r--r--tests/exception/texcpt1.nim4
-rw-r--r--tests/exception/tnestedreturn.nim10
-rw-r--r--tests/exception/tnestedreturn2.nim10
-rw-r--r--tests/exception/tunhandledexc.nim6
-rw-r--r--tests/exception/twrongexc.nim6
-rw-r--r--tests/let/tlet.nim4
-rw-r--r--tests/typerel/tnoargopenarray.nim4
13 files changed, 47 insertions, 47 deletions
diff --git a/tests/ccgbugs/tccgen1.nim b/tests/ccgbugs/tccgen1.nim
index 137dd545d..9234bbd6c 100644
--- a/tests/ccgbugs/tccgen1.nim
+++ b/tests/ccgbugs/tccgen1.nim
@@ -45,7 +45,7 @@ type
   PText* = ref Text
   Text = object of CharacterData
   
-  PComment* = ref comment
+  PComment* = ref Comment
   Comment = object of CharacterData
   
   PCDataSection* = ref CDataSection
diff --git a/tests/closure/tclosure.nim b/tests/closure/tclosure.nim
index 764aaa97d..445a99b6d 100644
--- a/tests/closure/tclosure.nim
+++ b/tests/closure/tclosure.nim
@@ -36,7 +36,7 @@ myData.each do (x: int):
 
 type
   ITest = tuple[
-    setter: proc(v: Int),
+    setter: proc(v: int),
     getter: proc(): int]
 
 proc getInterf(): ITest =
diff --git a/tests/closure/tclosurebug2.nim b/tests/closure/tclosurebug2.nim
index ec4f0045b..12e4e3509 100644
--- a/tests/closure/tclosurebug2.nim
+++ b/tests/closure/tclosurebug2.nim
@@ -38,17 +38,17 @@ template rawInsertImpl() {.dirty.} =
   data[h].val = val
   data[h].slot = seFilled
 
-template AddImpl() {.dirty.} =
-  if mustRehash(len(t.data), t.counter): Enlarge(t)
-  RawInsert(t, t.data, key, val)
+template addImpl() {.dirty.} =
+  if mustRehash(len(t.data), t.counter): enlarge(t)
+  rawInsert(t, t.data, key, val)
   inc(t.counter)
 
-template PutImpl() {.dirty.} =
-  var index = RawGet(t, key)
+template putImpl() {.dirty.} =
+  var index = rawGet(t, key)
   if index >= 0:
     t.data[index].val = val
   else:
-    AddImpl()
+    addImpl()
 
 proc len*[A, B](t: TOrderedTable[A, B]): int {.inline.} =
   ## returns the number of keys in `t`.
@@ -89,7 +89,7 @@ iterator mvalues*[A, B](t: var TOrderedTable[A, B]): var B =
   forAllOrderedPairs:
     yield t.data[h].val
 
-proc RawGet[A, B](t: TOrderedTable[A, B], key: A): int =
+proc rawGet[A, B](t: TOrderedTable[A, B], key: A): int =
   rawGetImpl()
 
 proc `[]`*[A, B](t: TOrderedTable[A, B], key: A): B =
@@ -97,21 +97,21 @@ proc `[]`*[A, B](t: TOrderedTable[A, B], key: A): B =
   ## default empty value for the type `B` is returned
   ## and no exception is raised. One can check with ``hasKey`` whether the key
   ## exists.
-  var index = RawGet(t, key)
+  var index = rawGet(t, key)
   if index >= 0: result = t.data[index].val
 
 proc mget*[A, B](t: var TOrderedTable[A, B], key: A): var B =
   ## retrieves the value at ``t[key]``. The value can be modified.
   ## If `key` is not in `t`, the ``EInvalidKey`` exception is raised.
-  var index = RawGet(t, key)
+  var index = rawGet(t, key)
   if index >= 0: result = t.data[index].val
-  else: raise newException(EInvalidKey, "key not found: " & $key)
+  else: raise newException(KeyError, "key not found: " & $key)
 
 proc hasKey*[A, B](t: TOrderedTable[A, B], key: A): bool =
   ## returns true iff `key` is in the table `t`.
   result = rawGet(t, key) >= 0
 
-proc RawInsert[A, B](t: var TOrderedTable[A, B], 
+proc rawInsert[A, B](t: var TOrderedTable[A, B], 
                      data: var TOrderedKeyValuePairSeq[A, B],
                      key: A, val: B) =
   rawInsertImpl()
@@ -120,7 +120,7 @@ proc RawInsert[A, B](t: var TOrderedTable[A, B],
   if t.last >= 0: data[t.last].next = h
   t.last = h
 
-proc Enlarge[A, B](t: var TOrderedTable[A, B]) =
+proc enlarge[A, B](t: var TOrderedTable[A, B]) =
   var n: TOrderedKeyValuePairSeq[A, B]
   newSeq(n, len(t.data) * growthFactor)
   var h = t.first
@@ -129,7 +129,7 @@ proc Enlarge[A, B](t: var TOrderedTable[A, B]) =
   while h >= 0:
     var nxt = t.data[h].next
     if t.data[h].slot == seFilled: 
-      RawInsert(t, n, t.data[h].key, t.data[h].val)
+      rawInsert(t, n, t.data[h].key, t.data[h].val)
     h = nxt
   swap(t.data, n)
 
@@ -139,7 +139,7 @@ proc `[]=`*[A, B](t: var TOrderedTable[A, B], key: A, val: B) =
 
 proc add*[A, B](t: var TOrderedTable[A, B], key: A, val: B) =
   ## puts a new (key, value)-pair into `t` even if ``t[key]`` already exists.
-  AddImpl()
+  addImpl()
 
 proc initOrderedTable*[A, B](initialSize=64): TOrderedTable[A, B] =
   ## creates a new ordered hash table that is empty. `initialSize` needs to be
diff --git a/tests/destructor/tdictdestruct.nim b/tests/destructor/tdictdestruct.nim
index b7043f7b7..17ded4853 100644
--- a/tests/destructor/tdictdestruct.nim
+++ b/tests/destructor/tdictdestruct.nim
@@ -11,7 +11,7 @@ proc fakeNew[T](x: var ref T, destroy: proc (a: ref T) {.nimcall.}) =
 proc destroyDict[TK, TV](a: PDict[TK, TV]) =
     return
 proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] =
-    Fakenew(result, destroyDict[TK, TV])
+    fakeNew(result, destroyDict[TK, TV])
 
 # Problem: destroyDict is not instantiated when newDict is instantiated!    
 
diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim
index f73230ff9..bbae857ea 100644
--- a/tests/effects/teffects1.nim
+++ b/tests/effects/teffects1.nim
@@ -1,7 +1,7 @@
 discard """
   line: 2136
   file: "system.nim"
-  errormsg: "can raise an unlisted exception: ref EIO"
+  errormsg: "can raise an unlisted exception: ref IOError"
 """
 
 type
@@ -9,13 +9,13 @@ type
   TObjB = object of TObj
     a, b, c: string
   
-  EIO2 = ref object of EIO
+  IO2Error = ref object of IOError
   
 proc forw: int {. .}
   
-proc lier(): int {.raises: [EIO2].} =
+proc lier(): int {.raises: [IO2Error].} =
   writeln stdout, "arg"
 
 proc forw: int =
-  raise newException(EIO, "arg")
+  raise newException(IOError, "arg")
 
diff --git a/tests/effects/teffects2.nim b/tests/effects/teffects2.nim
index 7e6b17c36..89ad16edc 100644
--- a/tests/effects/teffects2.nim
+++ b/tests/effects/teffects2.nim
@@ -1,6 +1,6 @@
 discard """
   line: 19
-  errormsg: "can raise an unlisted exception: ref EIO"
+  errormsg: "can raise an unlisted exception: ref IOError"
 """
 
 type
@@ -8,13 +8,13 @@ type
   TObjB = object of TObj
     a, b, c: string
   
-  EIO2 = ref object of EIO
+  EIO2 = ref object of IOError
   
 proc forw: int {.raises: [].}
 
-proc lier(): int {.raises: [EIO].} =
+proc lier(): int {.raises: [IOError].} =
   writeln stdout, "arg"
 
 proc forw: int =
-  raise newException(EIO, "arg")
+  raise newException(IOError, "arg")
 
diff --git a/tests/exception/texcpt1.nim b/tests/exception/texcpt1.nim
index ec74c9470..50a95eeec 100644
--- a/tests/exception/texcpt1.nim
+++ b/tests/exception/texcpt1.nim
@@ -2,8 +2,8 @@ discard """
   outputsub: "-6"
 """
 type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
+  ESomething = object of Exception
+  ESomeOtherErr = object of Exception
 
 proc genErrors(s: string) =
   if s == "error!":
diff --git a/tests/exception/tnestedreturn.nim b/tests/exception/tnestedreturn.nim
index b9f7843f6..591638f0e 100644
--- a/tests/exception/tnestedreturn.nim
+++ b/tests/exception/tnestedreturn.nim
@@ -10,8 +10,8 @@ proc test1() =
   finally: echo "A"
 
   try:
-    raise newException(EOS, "Problem")
-  except EOS:
+    raise newException(OSError, "Problem")
+  except OSError:
     return
 
 test1()
@@ -23,7 +23,7 @@ proc test2() =
 
   try:
     return
-  except EOS:
+  except OSError:
     discard
 
 test2()
@@ -31,8 +31,8 @@ test2()
 proc test3() =
   try:
     try:
-      raise newException(EOS, "Problem")
-    except EOS:
+      raise newException(OSError, "Problem")
+    except OSError:
       return
   finally:
     echo "C"
diff --git a/tests/exception/tnestedreturn2.nim b/tests/exception/tnestedreturn2.nim
index 14a2dab92..4bd2d535d 100644
--- a/tests/exception/tnestedreturn2.nim
+++ b/tests/exception/tnestedreturn2.nim
@@ -1,14 +1,14 @@
 discard """
-  file: "tnestedreturn.nim"
-  outputsub: "Error: unhandled exception: Problem [EOS]"
+  file: "tnestedreturn2.nim"
+  outputsub: "Error: unhandled exception: Problem [OSError]"
   exitcode: "1"
 """
 
 proc test4() =
   try:
     try:
-      raise newException(EOS, "Problem")
-    except EOS:
+      raise newException(OSError, "Problem")
+    except OSError:
       return
   finally:
     discard
@@ -17,4 +17,4 @@ proc test4() =
 # but could cause segmentation fault if 
 # exceptions are not handled properly.
 test4()
-raise newException(EOS, "Problem")
+raise newException(OSError, "Problem")
diff --git a/tests/exception/tunhandledexc.nim b/tests/exception/tunhandledexc.nim
index f24881aef..aa9d61236 100644
--- a/tests/exception/tunhandledexc.nim
+++ b/tests/exception/tunhandledexc.nim
@@ -4,8 +4,8 @@ discard """
   exitcode: "1"
 """
 type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
+  ESomething = object of Exception
+  ESomeOtherErr = object of Exception
 
 proc genErrors(s: string) =
   if s == "error!":
@@ -13,7 +13,7 @@ proc genErrors(s: string) =
   else:
     raise newException(EsomeotherErr, "bla")
 
-when True:
+when true:
   try:
     genErrors("errssor!")
   except ESomething:
diff --git a/tests/exception/twrongexc.nim b/tests/exception/twrongexc.nim
index 755f7d979..4e921b8a3 100644
--- a/tests/exception/twrongexc.nim
+++ b/tests/exception/twrongexc.nim
@@ -1,11 +1,11 @@
 discard """
   file: "twrongexc.nim"
-  outputsub: "Error: unhandled exception:  [EInvalidValue]"
+  outputsub: "Error: unhandled exception:  [ValueError]"
   exitcode: "1"
 """
 try:
-  raise newException(EInvalidValue, "")
-except EOverflow:
+  raise newException(ValueError, "")
+except OverflowError:
   echo("Error caught")
   
 
diff --git a/tests/let/tlet.nim b/tests/let/tlet.nim
index 3d36432fb..6703ba254 100644
--- a/tests/let/tlet.nim
+++ b/tests/let/tlet.nim
@@ -3,9 +3,9 @@ discard """
   errormsg: "'name' cannot be assigned to"
 """
 
-Echo("What's your name? ")
+echo("What's your name? ")
 let name = readLine(stdin)
 while name == "":
-  Echo("Please tell me your name: ")
+  echo("Please tell me your name: ")
   name = readLine(stdin)
 
diff --git a/tests/typerel/tnoargopenarray.nim b/tests/typerel/tnoargopenarray.nim
index 872ec86d2..20ebe5ecc 100644
--- a/tests/typerel/tnoargopenarray.nim
+++ b/tests/typerel/tnoargopenarray.nim
@@ -1,7 +1,7 @@
 
 import db_sqlite
 
-var db: TDbConn
-Exec(db, sql"create table blabla()")
+var db: DbConn
+exec(db, sql"create table blabla()")