summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/casestmt/tcaseexpr1.nim2
-rw-r--r--tests/closure/tclosure4.nim8
-rw-r--r--tests/concepts/tmonoid.nim13
-rw-r--r--tests/generics/t2tables.nim13
-rw-r--r--tests/generics/tbadgenericlambda.nim2
-rw-r--r--tests/generics/tgeneric0.nim2
-rw-r--r--tests/generics/tgenericlambda.nim6
-rw-r--r--tests/macros/tclosuremacro.nim2
-rw-r--r--tests/misc/tupcomingfeatures.nim39
-rw-r--r--tests/stdlib/nre/init.nim2
-rw-r--r--tests/stdlib/tmitems.nim4
-rw-r--r--tests/template/tit.nim2
-rw-r--r--tests/testament/categories.nim2
-rw-r--r--tests/tuples/tuple_with_nil.nim4
-rw-r--r--tests/typerel/trettypeinference.nim6
15 files changed, 86 insertions, 21 deletions
diff --git a/tests/casestmt/tcaseexpr1.nim b/tests/casestmt/tcaseexpr1.nim
index e5e08e25e..56acbbc8a 100644
--- a/tests/casestmt/tcaseexpr1.nim
+++ b/tests/casestmt/tcaseexpr1.nim
@@ -11,7 +11,7 @@ discard """
 type
   E = enum A, B, C
 
-proc foo(x): auto =
+proc foo(x: int): auto =
   return case x
     of 1..9: "digit"
     else: "number"
diff --git a/tests/closure/tclosure4.nim b/tests/closure/tclosure4.nim
index 10c7cac54..69c076cd5 100644
--- a/tests/closure/tclosure4.nim
+++ b/tests/closure/tclosure4.nim
@@ -1,13 +1,13 @@
 
 import json, tables, sequtils
 
-proc run(json_params: TTable) =
+proc run(json_params: Table) =
   let json_elems = json_params["files"].elems
   # These fail compilation.
-  var files = map(json_elems, proc (x: PJsonNode): string = x.str)
-  #var files = json_elems.map do (x: PJsonNode) -> string: x.str
+  var files = map(json_elems, proc (x: JsonNode): string = x.str)
+  #var files = json_elems.map do (x: JsonNode) -> string: x.str
   echo "Hey!"
 
 when isMainModule:
   let text = """{"files": ["a", "b", "c"]}"""
-  run(toTable((text.parseJson).fields))
+  run((text.parseJson).fields)
diff --git a/tests/concepts/tmonoid.nim b/tests/concepts/tmonoid.nim
new file mode 100644
index 000000000..49b3239bd
--- /dev/null
+++ b/tests/concepts/tmonoid.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''true'''
+"""
+
+# bug #3686
+
+type Monoid = concept x, y
+  x + y is type(x)
+  type(z(type(x))) is type(x)
+
+proc z(x: typedesc[int]): int = 0
+
+echo(int is Monoid)
diff --git a/tests/generics/t2tables.nim b/tests/generics/t2tables.nim
new file mode 100644
index 000000000..3ef5e621e
--- /dev/null
+++ b/tests/generics/t2tables.nim
@@ -0,0 +1,13 @@
+
+# bug #3669
+
+import tables
+
+type
+  G[T] = object
+    inodes: Table[int, T]
+    rnodes: Table[T, int]
+
+var g: G[string]
+echo g.rnodes["foo"]
+
diff --git a/tests/generics/tbadgenericlambda.nim b/tests/generics/tbadgenericlambda.nim
index 2ab8e724d..9fac150c1 100644
--- a/tests/generics/tbadgenericlambda.nim
+++ b/tests/generics/tbadgenericlambda.nim
@@ -3,5 +3,5 @@ discard """
   line: 6
 """
 
-let x = proc (x, y): auto = x + y
+let x = proc (x, y: auto): auto = x + y
 
diff --git a/tests/generics/tgeneric0.nim b/tests/generics/tgeneric0.nim
index 45450ccca..a045b32f8 100644
--- a/tests/generics/tgeneric0.nim
+++ b/tests/generics/tgeneric0.nim
@@ -18,7 +18,7 @@ proc foo[T](p: TType[T, range[0..2]]) =
 
 #bug #1366
 
-proc reversed(x) =
+proc reversed(x: auto) =
   for i in countdown(x.low, x.high):
     echo i
 
diff --git a/tests/generics/tgenericlambda.nim b/tests/generics/tgenericlambda.nim
index eb6ada3e5..41ee74557 100644
--- a/tests/generics/tgenericlambda.nim
+++ b/tests/generics/tgenericlambda.nim
@@ -5,15 +5,15 @@ discard """
 proc test(x: proc (a, b: int): int) =
   echo x(5, 5)
 
-test(proc (a, b): auto = a + b)
+test(proc (a, b: auto): auto = a + b)
 
-test do (a, b) -> auto: a + b
+test do (a, b: auto) -> auto: a + b
 
 proc foreach[T](s: seq[T], body: proc(x: T)) =
   for e in s:
     body(e)
 
-foreach(@[1,2,3]) do (x):
+foreach(@[1,2,3]) do (x: auto):
   echo x
 
 proc foo =
diff --git a/tests/macros/tclosuremacro.nim b/tests/macros/tclosuremacro.nim
index cf51949ed..c29fbe1c8 100644
--- a/tests/macros/tclosuremacro.nim
+++ b/tests/macros/tclosuremacro.nim
@@ -26,7 +26,7 @@ proc noReturn(x: () -> void) =
 proc doWithOneAndTwo(f: (int, int) -> int): int =
   f(1,2)
 
-echo twoParams(proc (a, b): auto = a + b)
+echo twoParams(proc (a, b: auto): auto = a + b)
 echo twoParams((x, y) => x + y)
 
 echo oneParam(x => x+5)
diff --git a/tests/misc/tupcomingfeatures.nim b/tests/misc/tupcomingfeatures.nim
new file mode 100644
index 000000000..cf07b06df
--- /dev/null
+++ b/tests/misc/tupcomingfeatures.nim
@@ -0,0 +1,39 @@
+discard """
+  output: '''0 -2 0
+0 -2'''
+"""
+
+{.this: self.}
+
+type
+  Foo {.partial.} = object
+    a, b: int
+
+type
+  tupcomingfeatures.Foo = object
+    x: int
+
+proc yay(self: Foo) =
+  echo a, " ", b, " ", x
+
+proc footest[T](self: var Foo, a: T) =
+  b = 1+a
+  yay()
+
+proc nongeneric(self: Foo) =
+  echo a, " ", b
+
+var ff: Foo
+footest(ff, -3)
+ff.nongeneric
+
+{.experimental.}
+using
+  c: Foo
+  x, y: int
+
+proc usesSig(c) =
+  echo "yummy"
+
+proc foobar(c, y) =
+  echo "yay"
diff --git a/tests/stdlib/nre/init.nim b/tests/stdlib/nre/init.nim
index 1a1470842..26e668104 100644
--- a/tests/stdlib/nre/init.nim
+++ b/tests/stdlib/nre/init.nim
@@ -2,7 +2,7 @@ import unittest
 include nre
 
 suite "Test NRE initialization":
-  test "correct intialization":
+  test "correct initialization":
     check(re("[0-9]+") != nil)
     check(re("(?i)[0-9]+") != nil)
 
diff --git a/tests/stdlib/tmitems.nim b/tests/stdlib/tmitems.nim
index 27ff344e5..c713d91a4 100644
--- a/tests/stdlib/tmitems.nim
+++ b/tests/stdlib/tmitems.nim
@@ -11,7 +11,7 @@ fpqeew
 [11, 12, 13]
 [11, 12, 13]
 [11, 12, 13]
-{"key1":11,"key2":12,"key3":13}
+11 12 13
 [11,12,13]
 <Students>
   <Student Name="Aprilfoo" />
@@ -115,7 +115,7 @@ block:
   var j = parseJson """{"key1": 1, "key2": 2, "key3": 3}"""
   for key,val in j.pairs:
     val.num += 10
-  echo j
+  echo j["key1"], " ", j["key2"], " ", j["key3"]
 
 block:
   var j = parseJson """[1, 2, 3]"""
diff --git a/tests/template/tit.nim b/tests/template/tit.nim
index 9866711de..cf50d2f6f 100644
--- a/tests/template/tit.nim
+++ b/tests/template/tit.nim
@@ -5,7 +5,7 @@ template someIt(a, pred: expr): expr =
   var it {.inject.} = 0
   pred
 
-proc aProc(n) =
+proc aProc(n: auto) =
   n.someIt(echo(it))
 
 aProc(89)
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index ff83379b8..150c55edc 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -223,7 +223,7 @@ proc jsTests(r: var TResults, cat: Category, options: string) =
                    "varres/tvartup", "misc/tints", "misc/tunsignedinc"]:
     test "tests/" & testfile & ".nim"
 
-  for testfile in ["pure/strutils"]:
+  for testfile in ["pure/strutils", "pure/json"]:
     test "lib/" & testfile & ".nim"
 
 # ------------------------- manyloc -------------------------------------------
diff --git a/tests/tuples/tuple_with_nil.nim b/tests/tuples/tuple_with_nil.nim
index 26e4ae85e..442fbab92 100644
--- a/tests/tuples/tuple_with_nil.nim
+++ b/tests/tuples/tuple_with_nil.nim
@@ -345,7 +345,7 @@ proc writeformat(o: var Writer; p: pointer; fmt: Format) =
   ## Write pointer `i` according to format `fmt` using output object
   ## `o` and output function `add`.
   ##
-  ## Pointers are casted to unsigned int and formated as hexadecimal
+  ## Pointers are casted to unsigned int and formatted as hexadecimal
   ## with prefix unless specified otherwise.
   var f = fmt
   if f.typ == 0.char:
@@ -584,7 +584,7 @@ proc splitfmt(s: string): seq[Part] {.compiletime, nosideeffect.} =
   ## Each part is either a literal string or a format specification. A
   ## format specification is a substring of the form
   ## "{[arg][:format]}" where `arg` is either empty or a number
-  ## refering to the arg-th argument and an additional field or array
+  ## referring to the arg-th argument and an additional field or array
   ## index. The format string is a string accepted by `parse`.
   let subpeg = sequence(capture(digits()),
                           capture(?sequence(charSet({'.'}), *pegs.identStartChars(), *identChars())),
diff --git a/tests/typerel/trettypeinference.nim b/tests/typerel/trettypeinference.nim
index 41b4aa5ef..fa4e89cc8 100644
--- a/tests/typerel/trettypeinference.nim
+++ b/tests/typerel/trettypeinference.nim
@@ -5,8 +5,8 @@ discard """
 
 import typetraits
 
-proc plus(a, b): auto = a + b
-proc makePair(a, b): auto = (first: a, second: b)
+proc plus(a, b: auto): auto = a + b
+proc makePair(a, b: auto): auto = (first: a, second: b)
 
 proc `+`(a, b: string): seq[string] = @[a, b]
 
@@ -19,7 +19,7 @@ static: assert p[0].type is string
 echo i.type.name
 echo s.type.name
 
-proc inst(a): auto =
+proc inst(a: auto): auto =
   static: echo "instantiated for ", a.type.name
   result = a