summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-10-24 20:20:20 +0200
committerAraq <rumpf_a@web.de>2016-10-24 20:20:20 +0200
commit0eb70e64c4dfbe48f6fb5d4873d4c02dca65bc4a (patch)
tree1b7ffe69eabd3ec37db7c1f011394cd921e7d855 /tests
parent1d191831c0c41536efc1a57be48f38b0746bd40f (diff)
parent6fd27a8a0849e2c1150b5f15b7b61d43b63642b2 (diff)
downloadNim-0eb70e64c4dfbe48f6fb5d4873d4c02dca65bc4a.tar.gz
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'tests')
-rw-r--r--tests/js/tconsole.nim13
-rw-r--r--tests/macros/tdump.nim13
-rw-r--r--tests/testament/categories.nim10
-rw-r--r--tests/testament/tester.nim2
4 files changed, 35 insertions, 3 deletions
diff --git a/tests/js/tconsole.nim b/tests/js/tconsole.nim
new file mode 100644
index 000000000..f6da71c20
--- /dev/null
+++ b/tests/js/tconsole.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''Hello, console
+1 2 3
+1 'hi' 1.1'''
+"""
+
+# This file tests the JavaScript console
+
+import jsconsole
+
+console.log("Hello, console")
+console.log(1, 2, 3)
+console.log(1, "hi", 1.1)
\ No newline at end of file
diff --git a/tests/macros/tdump.nim b/tests/macros/tdump.nim
new file mode 100644
index 000000000..e4c14dc6b
--- /dev/null
+++ b/tests/macros/tdump.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''x = 10
+x + y = 30
+'''
+"""
+
+import future
+
+let
+  x = 10
+  y = 20
+dump x
+dump(x + y)
\ No newline at end of file
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index 2b0b55c0b..809425653 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -382,8 +382,14 @@ proc `&.?`(a, b: string): string =
 proc `&?.`(a, b: string): string =
   # candidate for the stdlib?
   result = if a.endswith(b): a else: a & b
+  
+proc processSingleTest(r: var TResults, cat: Category, options, test: string) =
+  let test = "tests" & DirSep &.? cat.string / test
 
-proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") =
+  if existsFile(test): testSpec r, makeTest(test, options, cat)
+  else: echo "[Warning] - ", test, " test does not exist"
+
+proc processCategory(r: var TResults, cat: Category, options: string) =
   case cat.string.normalize
   of "rodfiles":
     when false: compileRodFiles(r, cat, options)
@@ -424,5 +430,5 @@ proc processCategory(r: var TResults, cat: Category, options: string, fileGlob:
     # We can't test it because it depends on a third party.
     discard # TODO: Move untestable tests to someplace else, i.e. nimble repo.
   else:
-    for name in os.walkFiles("tests" & DirSep &.? cat.string / fileGlob):
+    for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
       testSpec r, makeTest(name, options, cat)
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index 74ac58927..2734742f4 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -445,7 +445,7 @@ proc main() =
     let (dir, file) = splitPath(p.key.string)
     let (_, subdir) = splitPath(dir)
     var cat = Category(subdir)
-    processCategory(r, cat, p.cmdLineRest.string, file)
+    processSingleTest(r, cat, p.cmdLineRest.string, file)
   of "html":
     var commit = 0
     discard parseInt(p.cmdLineRest.string, commit)