summary refs log tree commit diff stats
path: root/tests/modules
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/UpperCased.nim6
-rw-r--r--tests/modules/a/module_name_clashes.nim8
-rw-r--r--tests/modules/a/utils.nim2
-rw-r--r--tests/modules/b/module_name_clashes.nim3
-rw-r--r--tests/modules/b/utils.nim2
-rw-r--r--tests/modules/definitions.nim4
-rw-r--r--tests/modules/m9627/a.nim1
-rw-r--r--tests/modules/m9627/b.nim1
-rw-r--r--tests/modules/mexport2a.nim7
-rw-r--r--tests/modules/mexport2b.nim3
-rw-r--r--tests/modules/mexporta.nim8
-rw-r--r--tests/modules/mexportb.nim7
-rw-r--r--tests/modules/mforwarded_pure_enum.nim3
-rw-r--r--tests/modules/mforwarded_pure_enum2.nim4
-rw-r--r--tests/modules/mimport_in_config.nim2
-rw-r--r--tests/modules/mincludeprefix.nim1
-rw-r--r--tests/modules/mincludetemplate.nim1
-rw-r--r--tests/modules/mmodule_same_proc.nim6
-rw-r--r--tests/modules/mmodule_same_proc_client.nim2
-rw-r--r--tests/modules/mnamspc1.nim2
-rw-r--r--tests/modules/mnamspc2.nim3
-rw-r--r--tests/modules/mnotuniquename.nim1
-rw-r--r--tests/modules/mopaque.nim7
-rw-r--r--tests/modules/morder_depa.nim5
-rw-r--r--tests/modules/morder_depb.nim1
-rw-r--r--tests/modules/mrange.nim5
-rw-r--r--tests/modules/mrecmod.nim1
-rw-r--r--tests/modules/mrecmod2.nim9
-rw-r--r--tests/modules/proxy_module.nim3
-rw-r--r--tests/modules/seq.nim5
-rw-r--r--tests/modules/t8665.nim5
-rw-r--r--tests/modules/t9627.nim7
-rw-r--r--tests/modules/tambig_range.nim13
-rw-r--r--tests/modules/tcanimport.nim19
-rw-r--r--tests/modules/texplicit_system_import.nim9
-rw-r--r--tests/modules/texport.nim13
-rw-r--r--tests/modules/texport2.nim18
-rw-r--r--tests/modules/tfowarded_pure_enum.nim7
-rw-r--r--tests/modules/timport_in_config.nim9
-rw-r--r--tests/modules/timport_in_config.nim.cfg2
-rw-r--r--tests/modules/timportas.nim21
-rw-r--r--tests/modules/timportexcept.nim9
-rw-r--r--tests/modules/tincludeas.nim6
-rw-r--r--tests/modules/tincludeprefix.nim3
-rw-r--r--tests/modules/tincludetemplate.nim5
-rw-r--r--tests/modules/tmismatchedvisibility.nim9
-rw-r--r--tests/modules/tmodule_name_clashes.nim17
-rw-r--r--tests/modules/tmodule_same_proc.nim9
-rw-r--r--tests/modules/tmodulesymtype.nim22
-rw-r--r--tests/modules/tnamspc.nim10
-rw-r--r--tests/modules/tnotuniquename.nim10
-rw-r--r--tests/modules/tnotuniquename2.nim8
-rw-r--r--tests/modules/tnotuniquename_dir/mnotuniquename.nim2
-rw-r--r--tests/modules/topaque.nim16
-rw-r--r--tests/modules/torder_dep.nim10
-rw-r--r--tests/modules/trecinca.nim10
-rw-r--r--tests/modules/trecincb.nim11
-rw-r--r--tests/modules/trecmod.nim8
-rw-r--r--tests/modules/trecmod2.nim13
-rw-r--r--tests/modules/treorder.nim47
-rw-r--r--tests/modules/tselfimport.nim8
-rw-r--r--tests/modules/tseq.nim8
-rw-r--r--tests/modules/tstrutils_insert_sep.nim13
-rw-r--r--tests/modules/tuppercased.nim8
-rw-r--r--tests/modules/tutils_ab.nim5
65 files changed, 503 insertions, 0 deletions
diff --git a/tests/modules/UpperCased.nim b/tests/modules/UpperCased.nim
new file mode 100644
index 000000000..7beffcc5f
--- /dev/null
+++ b/tests/modules/UpperCased.nim
@@ -0,0 +1,6 @@
+
+# bug #5076
+
+var str*: string
+
+UpperCased.str = "hello"
diff --git a/tests/modules/a/module_name_clashes.nim b/tests/modules/a/module_name_clashes.nim
new file mode 100644
index 000000000..209526e22
--- /dev/null
+++ b/tests/modules/a/module_name_clashes.nim
@@ -0,0 +1,8 @@
+# See `tmodule_name_clashes`
+
+import ../b/module_name_clashes
+type A* = object
+  b*: B
+
+proc print*(a: A) =
+  echo repr a
diff --git a/tests/modules/a/utils.nim b/tests/modules/a/utils.nim
new file mode 100644
index 000000000..f37abfb93
--- /dev/null
+++ b/tests/modules/a/utils.nim
@@ -0,0 +1,2 @@
+proc burnMem*(a: int) =
+  discard
diff --git a/tests/modules/b/module_name_clashes.nim b/tests/modules/b/module_name_clashes.nim
new file mode 100644
index 000000000..6a10cac33
--- /dev/null
+++ b/tests/modules/b/module_name_clashes.nim
@@ -0,0 +1,3 @@
+# See `tmodule_name_clashes`
+
+type B* = object
diff --git a/tests/modules/b/utils.nim b/tests/modules/b/utils.nim
new file mode 100644
index 000000000..e343385f5
--- /dev/null
+++ b/tests/modules/b/utils.nim
@@ -0,0 +1,2 @@
+# module b/utils.nim
+let x* = 10
diff --git a/tests/modules/definitions.nim b/tests/modules/definitions.nim
new file mode 100644
index 000000000..edc6eaa6d
--- /dev/null
+++ b/tests/modules/definitions.nim
@@ -0,0 +1,4 @@
+var v*: int
+proc p* = echo "proc p called"
+template t* = echo "template t expanded"
+
diff --git a/tests/modules/m9627/a.nim b/tests/modules/m9627/a.nim
new file mode 100644
index 000000000..0dd32430e
--- /dev/null
+++ b/tests/modules/m9627/a.nim
@@ -0,0 +1 @@
+var a = 10
diff --git a/tests/modules/m9627/b.nim b/tests/modules/m9627/b.nim
new file mode 100644
index 000000000..2806a78ed
--- /dev/null
+++ b/tests/modules/m9627/b.nim
@@ -0,0 +1 @@
+var b = 9
diff --git a/tests/modules/mexport2a.nim b/tests/modules/mexport2a.nim
new file mode 100644
index 000000000..3cf84337e
--- /dev/null
+++ b/tests/modules/mexport2a.nim
@@ -0,0 +1,7 @@
+
+import mexport2b
+export mexport2b
+proc printAbc*() = echo "abc"
+
+proc foo*() = echo "A.foo"
+
diff --git a/tests/modules/mexport2b.nim b/tests/modules/mexport2b.nim
new file mode 100644
index 000000000..1af034133
--- /dev/null
+++ b/tests/modules/mexport2b.nim
@@ -0,0 +1,3 @@
+proc printXyz*() = echo "xyz"
+
+proc foo*(x: int) = echo "B.foo"
diff --git a/tests/modules/mexporta.nim b/tests/modules/mexporta.nim
new file mode 100644
index 000000000..b7d4ddec9
--- /dev/null
+++ b/tests/modules/mexporta.nim
@@ -0,0 +1,8 @@
+# module A
+import mexportb
+export mexportb.TMyObject, mexportb.xyz
+
+export mexportb.q
+
+proc `$`*(x: TMyObject): string = "my object"
+
diff --git a/tests/modules/mexportb.nim b/tests/modules/mexportb.nim
new file mode 100644
index 000000000..10d89f388
--- /dev/null
+++ b/tests/modules/mexportb.nim
@@ -0,0 +1,7 @@
+# module B
+type TMyObject* = object
+
+const xyz* = 13
+
+proc q*(x: int): int = 6
+proc q*(x: string): string = "8"
diff --git a/tests/modules/mforwarded_pure_enum.nim b/tests/modules/mforwarded_pure_enum.nim
new file mode 100644
index 000000000..3f03390a5
--- /dev/null
+++ b/tests/modules/mforwarded_pure_enum.nim
@@ -0,0 +1,3 @@
+
+import mforwarded_pure_enum2
+export mforwarded_pure_enum2.PureEnum
diff --git a/tests/modules/mforwarded_pure_enum2.nim b/tests/modules/mforwarded_pure_enum2.nim
new file mode 100644
index 000000000..e5d5d2a71
--- /dev/null
+++ b/tests/modules/mforwarded_pure_enum2.nim
@@ -0,0 +1,4 @@
+
+type
+  PureEnum* {.pure.} = enum
+    x, y, z
diff --git a/tests/modules/mimport_in_config.nim b/tests/modules/mimport_in_config.nim
new file mode 100644
index 000000000..555b6074d
--- /dev/null
+++ b/tests/modules/mimport_in_config.nim
@@ -0,0 +1,2 @@
+type
+  DefinedInB* = int
diff --git a/tests/modules/mincludeprefix.nim b/tests/modules/mincludeprefix.nim
new file mode 100644
index 000000000..6d557a430
--- /dev/null
+++ b/tests/modules/mincludeprefix.nim
@@ -0,0 +1 @@
+const bar = 456
diff --git a/tests/modules/mincludetemplate.nim b/tests/modules/mincludetemplate.nim
new file mode 100644
index 000000000..febe9bfcf
--- /dev/null
+++ b/tests/modules/mincludetemplate.nim
@@ -0,0 +1 @@
+const foo = 123
diff --git a/tests/modules/mmodule_same_proc.nim b/tests/modules/mmodule_same_proc.nim
new file mode 100644
index 000000000..5ce56ec11
--- /dev/null
+++ b/tests/modules/mmodule_same_proc.nim
@@ -0,0 +1,6 @@
+
+# the module being the same name as the proc
+# is a requirement to trigger the error
+import mmodule_same_proc_client
+
+proc bar*[T](foo: T): bool = foo.mmodule_same_proc_client()
diff --git a/tests/modules/mmodule_same_proc_client.nim b/tests/modules/mmodule_same_proc_client.nim
new file mode 100644
index 000000000..e36ec42cf
--- /dev/null
+++ b/tests/modules/mmodule_same_proc_client.nim
@@ -0,0 +1,2 @@
+
+proc mmodule_same_proc_client*(x: string): bool = x.len > 0
diff --git a/tests/modules/mnamspc1.nim b/tests/modules/mnamspc1.nim
new file mode 100644
index 000000000..91f4d1566
--- /dev/null
+++ b/tests/modules/mnamspc1.nim
@@ -0,0 +1,2 @@
+import mnamspc2
+
diff --git a/tests/modules/mnamspc2.nim b/tests/modules/mnamspc2.nim
new file mode 100644
index 000000000..899ef27ea
--- /dev/null
+++ b/tests/modules/mnamspc2.nim
@@ -0,0 +1,3 @@
+# export an identifier:
+var
+  global*: int
diff --git a/tests/modules/mnotuniquename.nim b/tests/modules/mnotuniquename.nim
new file mode 100644
index 000000000..54d5883cd
--- /dev/null
+++ b/tests/modules/mnotuniquename.nim
@@ -0,0 +1 @@
+proc flat*() = echo "flat"
diff --git a/tests/modules/mopaque.nim b/tests/modules/mopaque.nim
new file mode 100644
index 000000000..2129bdaf2
--- /dev/null
+++ b/tests/modules/mopaque.nim
@@ -0,0 +1,7 @@
+type
+  TLexer* {.final.} = object
+    line*: int
+    filename*: string
+    buffer: cstring
+
+proc noProcVar*(): int = 18
diff --git a/tests/modules/morder_depa.nim b/tests/modules/morder_depa.nim
new file mode 100644
index 000000000..846fb1441
--- /dev/null
+++ b/tests/modules/morder_depa.nim
@@ -0,0 +1,5 @@
+
+import morder_depb
+
+proc Foo*(x: int): Foo = discard
+
diff --git a/tests/modules/morder_depb.nim b/tests/modules/morder_depb.nim
new file mode 100644
index 000000000..b77bc5acb
--- /dev/null
+++ b/tests/modules/morder_depb.nim
@@ -0,0 +1 @@
+type Foo* = array[2, byte]
diff --git a/tests/modules/mrange.nim b/tests/modules/mrange.nim
new file mode 100644
index 000000000..20c424a8c
--- /dev/null
+++ b/tests/modules/mrange.nim
@@ -0,0 +1,5 @@
+
+proc range*() = echo "yo"
+
+proc set*(a: int) =
+  discard
diff --git a/tests/modules/mrecmod.nim b/tests/modules/mrecmod.nim
new file mode 100644
index 000000000..ce8fa3d64
--- /dev/null
+++ b/tests/modules/mrecmod.nim
@@ -0,0 +1 @@
+import trecmod
diff --git a/tests/modules/mrecmod2.nim b/tests/modules/mrecmod2.nim
new file mode 100644
index 000000000..31fac6e4d
--- /dev/null
+++ b/tests/modules/mrecmod2.nim
@@ -0,0 +1,9 @@
+# Module B
+import trecmod2
+
+proc p*(x: trecmod2.T1): trecmod2.T1 =
+  # this works because the compiler has already
+  # added T1 to trecmod2's interface symbol table
+  return x + 1
+
+
diff --git a/tests/modules/proxy_module.nim b/tests/modules/proxy_module.nim
new file mode 100644
index 000000000..c244688cd
--- /dev/null
+++ b/tests/modules/proxy_module.nim
@@ -0,0 +1,3 @@
+import definitions
+export definitions except p
+
diff --git a/tests/modules/seq.nim b/tests/modules/seq.nim
new file mode 100644
index 000000000..176e44025
--- /dev/null
+++ b/tests/modules/seq.nim
@@ -0,0 +1,5 @@
+var seq: seq[int]
+var b: seq[float]
+
+echo seq
+echo b
diff --git a/tests/modules/t8665.nim b/tests/modules/t8665.nim
new file mode 100644
index 000000000..74d31452f
--- /dev/null
+++ b/tests/modules/t8665.nim
@@ -0,0 +1,5 @@
+discard """
+  action: compile
+"""
+
+import treorder
diff --git a/tests/modules/t9627.nim b/tests/modules/t9627.nim
new file mode 100644
index 000000000..daba46374
--- /dev/null
+++ b/tests/modules/t9627.nim
@@ -0,0 +1,7 @@
+discard """
+  output: "109"
+"""
+
+include m9627 / [a, b]
+
+echo a, b
diff --git a/tests/modules/tambig_range.nim b/tests/modules/tambig_range.nim
new file mode 100644
index 000000000..e1ecc0013
--- /dev/null
+++ b/tests/modules/tambig_range.nim
@@ -0,0 +1,13 @@
+discard """
+  errormsg: "ambiguous identifier: 'range' -- use one of the following:"
+  line: "13"
+"""
+
+import mrange
+
+# bug #6965
+type SomeObj = object
+  s: set[int8]
+
+# bug #6726
+range()
diff --git a/tests/modules/tcanimport.nim b/tests/modules/tcanimport.nim
new file mode 100644
index 000000000..bc4e2e53f
--- /dev/null
+++ b/tests/modules/tcanimport.nim
@@ -0,0 +1,19 @@
+discard """
+  output: '''ABC
+nope'''
+"""
+
+template canImport(x): bool =
+  compiles:
+    import x
+
+when canImport(strutils):
+  import strutils
+  echo "abc".toUpperAscii
+else:
+  echo "meh"
+
+when canImport(none):
+  echo "what"
+else:
+  echo "nope"
diff --git a/tests/modules/texplicit_system_import.nim b/tests/modules/texplicit_system_import.nim
new file mode 100644
index 000000000..0a4cedc71
--- /dev/null
+++ b/tests/modules/texplicit_system_import.nim
@@ -0,0 +1,9 @@
+import system except `+`
+
+discard """
+  errormsg: "undeclared identifier: '+'"
+  line: 9
+"""
+
+
+echo 4+5
diff --git a/tests/modules/texport.nim b/tests/modules/texport.nim
new file mode 100644
index 000000000..a8c217ab8
--- /dev/null
+++ b/tests/modules/texport.nim
@@ -0,0 +1,13 @@
+discard """
+  output: "my object68"
+"""
+
+import mexporta
+
+# bug #1029:
+from nativesockets import accept
+
+# B.TMyObject has been imported implicitly here:
+var x: TMyObject
+echo($x, q(0), q"0")
+
diff --git a/tests/modules/texport2.nim b/tests/modules/texport2.nim
new file mode 100644
index 000000000..e90c58673
--- /dev/null
+++ b/tests/modules/texport2.nim
@@ -0,0 +1,18 @@
+discard """
+output: '''
+abc
+xyz
+B.foo
+'''
+"""
+
+# bug #1595, #1612
+
+import mexport2a
+
+proc main() =
+  printAbc()
+  printXyz()
+
+main()
+foo(3)
diff --git a/tests/modules/tfowarded_pure_enum.nim b/tests/modules/tfowarded_pure_enum.nim
new file mode 100644
index 000000000..1d2c4f342
--- /dev/null
+++ b/tests/modules/tfowarded_pure_enum.nim
@@ -0,0 +1,7 @@
+discard """
+  output: '''z'''
+"""
+
+import mforwarded_pure_enum as t2
+
+echo z
diff --git a/tests/modules/timport_in_config.nim b/tests/modules/timport_in_config.nim
new file mode 100644
index 000000000..847b063bd
--- /dev/null
+++ b/tests/modules/timport_in_config.nim
@@ -0,0 +1,9 @@
+discard """
+output: '''hallo'''
+joinable: false
+"""
+
+# bug #9978, #9994
+var x: DefinedInB
+
+echo "hi".replace("i", "allo")
diff --git a/tests/modules/timport_in_config.nim.cfg b/tests/modules/timport_in_config.nim.cfg
new file mode 100644
index 000000000..2633e1012
--- /dev/null
+++ b/tests/modules/timport_in_config.nim.cfg
@@ -0,0 +1,2 @@
+--import: "strutils"
+--import: "mimport_in_config"
diff --git a/tests/modules/timportas.nim b/tests/modules/timportas.nim
new file mode 100644
index 000000000..179613c6b
--- /dev/null
+++ b/tests/modules/timportas.nim
@@ -0,0 +1,21 @@
+discard """
+    action: run
+"""
+
+import .. / modules / [mexporta as a1, definitions as foo1]
+import .. / modules / definitions as foo2
+import ./[mexporta as a2, definitions as foo3]
+import std / times as bar
+from times as bar2 import nil
+import times as bar3 except convert
+import definitions as baz
+
+discard foo1.v
+discard foo2.v
+discard foo3.v
+discard bar.now()
+discard bar2.now()
+discard bar3.now()
+discard baz.v
+discard a1.xyz
+discard a2.xyz
diff --git a/tests/modules/timportexcept.nim b/tests/modules/timportexcept.nim
new file mode 100644
index 000000000..40b748088
--- /dev/null
+++ b/tests/modules/timportexcept.nim
@@ -0,0 +1,9 @@
+discard """
+  errormsg: "undeclared identifier: '%'"
+  line: 9
+"""
+
+import strutils except `%`
+
+# doesn't work
+echo "$1" % "abc"
diff --git a/tests/modules/tincludeas.nim b/tests/modules/tincludeas.nim
new file mode 100644
index 000000000..b82e38b14
--- /dev/null
+++ b/tests/modules/tincludeas.nim
@@ -0,0 +1,6 @@
+discard """
+  errormsg: "Cannot use 'as' in 'include'."
+  line: 6
+"""
+
+include foobar as foo
diff --git a/tests/modules/tincludeprefix.nim b/tests/modules/tincludeprefix.nim
new file mode 100644
index 000000000..d45a6eff3
--- /dev/null
+++ b/tests/modules/tincludeprefix.nim
@@ -0,0 +1,3 @@
+include ./[mincludeprefix, mincludetemplate]
+doAssert foo == 123
+doAssert bar == 456
diff --git a/tests/modules/tincludetemplate.nim b/tests/modules/tincludetemplate.nim
new file mode 100644
index 000000000..77e409ee5
--- /dev/null
+++ b/tests/modules/tincludetemplate.nim
@@ -0,0 +1,5 @@
+# issue #12539
+
+template includePath(n: untyped) = include ../modules/n # But `include n` works
+includePath(mincludetemplate)
+doAssert foo == 123
diff --git a/tests/modules/tmismatchedvisibility.nim b/tests/modules/tmismatchedvisibility.nim
new file mode 100644
index 000000000..b649a5a3e
--- /dev/null
+++ b/tests/modules/tmismatchedvisibility.nim
@@ -0,0 +1,9 @@
+discard """
+  errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)' has non-public forward declaration at "
+  line: 8
+"""
+
+proc foo(a: int): int
+
+proc foo*(a: int): int =
+  result = a + a
diff --git a/tests/modules/tmodule_name_clashes.nim b/tests/modules/tmodule_name_clashes.nim
new file mode 100644
index 000000000..814d5d152
--- /dev/null
+++ b/tests/modules/tmodule_name_clashes.nim
@@ -0,0 +1,17 @@
+discard """
+matrix: "--mm:refc"
+targets: "c"
+ccodecheck: "\\i @('atmaatsmodule_name_clashesdotnim_DatInit000')"
+ccodecheck: "\\i @('atmbatsmodule_name_clashesdotnim_DatInit000')"
+joinable: false
+"""
+
+# Test module name clashes within same package.
+# This was created to test that module symbol mangling functioned correctly
+# for the C backend when there are one or more modules with the same name in
+# a package, and more than one of them require module initialization procs.
+# I'm not sure of the simplest method to cause the init procs to be generated.
+
+import a/module_name_clashes
+
+print A()
diff --git a/tests/modules/tmodule_same_proc.nim b/tests/modules/tmodule_same_proc.nim
new file mode 100644
index 000000000..dc4dfd3d6
--- /dev/null
+++ b/tests/modules/tmodule_same_proc.nim
@@ -0,0 +1,9 @@
+
+import mmodule_same_proc
+
+# importing baz causes the error not to trigger
+#import baz
+
+# bug #11188
+
+discard "foo".bar()
diff --git a/tests/modules/tmodulesymtype.nim b/tests/modules/tmodulesymtype.nim
new file mode 100644
index 000000000..d17c4cca4
--- /dev/null
+++ b/tests/modules/tmodulesymtype.nim
@@ -0,0 +1,22 @@
+discard """
+cmd: "nim check $file"
+"""
+
+# bug #19225
+import std/sequtils
+sequtils #[tt.Error
+^ expression has no type: sequtils]#
+proc foo() =
+  block: #[tt.Error
+  ^ expression has no type: block:
+  sequtils]#
+    sequtils
+
+foo()
+
+# issue #23399
+when isMainModule:
+  sequtils #[tt.Error
+  ^ expression has no type: sequtils]#
+
+discard
diff --git a/tests/modules/tnamspc.nim b/tests/modules/tnamspc.nim
new file mode 100644
index 000000000..93ce71568
--- /dev/null
+++ b/tests/modules/tnamspc.nim
@@ -0,0 +1,10 @@
+discard """
+  errormsg: "undeclared identifier: \'global\'"
+  file: "tnamspc.nim"
+  line: 10
+"""
+# Test17 - test correct handling of namespaces
+
+import mnamspc1
+
+global = 9 #ERROR
diff --git a/tests/modules/tnotuniquename.nim b/tests/modules/tnotuniquename.nim
new file mode 100644
index 000000000..bc401e662
--- /dev/null
+++ b/tests/modules/tnotuniquename.nim
@@ -0,0 +1,10 @@
+discard """
+  output: '''nested
+flat'''
+"""
+
+import mnotuniquename
+import tnotuniquename_dir/mnotuniquename as nun
+
+nested()
+flat()
diff --git a/tests/modules/tnotuniquename2.nim b/tests/modules/tnotuniquename2.nim
new file mode 100644
index 000000000..e4501bc24
--- /dev/null
+++ b/tests/modules/tnotuniquename2.nim
@@ -0,0 +1,8 @@
+discard """
+  errormsg: "module names need to be unique per Nimble package"
+  file: "tnotuniquename/mnotuniquename.nim"
+  disabled: "true"
+"""
+
+import mnotuniquename
+import tnotuniquename/mnotuniquename
diff --git a/tests/modules/tnotuniquename_dir/mnotuniquename.nim b/tests/modules/tnotuniquename_dir/mnotuniquename.nim
new file mode 100644
index 000000000..11e52d9d0
--- /dev/null
+++ b/tests/modules/tnotuniquename_dir/mnotuniquename.nim
@@ -0,0 +1,2 @@
+
+proc nested*() = echo "nested"
diff --git a/tests/modules/topaque.nim b/tests/modules/topaque.nim
new file mode 100644
index 000000000..94ff8ff25
--- /dev/null
+++ b/tests/modules/topaque.nim
@@ -0,0 +1,16 @@
+discard """
+  errormsg: "undeclared field: \'buffer\'"
+  file: "topaque.nim"
+  line: 16
+"""
+# Test the new opaque types
+
+import
+  mopaque
+
+var
+  L: TLexer
+
+L.filename = "ha"
+L.line = 34
+L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer'
diff --git a/tests/modules/torder_dep.nim b/tests/modules/torder_dep.nim
new file mode 100644
index 000000000..85211228a
--- /dev/null
+++ b/tests/modules/torder_dep.nim
@@ -0,0 +1,10 @@
+discard """
+  output: '''[0, 0]'''
+"""
+
+import morder_depb
+import morder_depa
+
+# bug #11187
+
+echo Foo(3)
diff --git a/tests/modules/trecinca.nim b/tests/modules/trecinca.nim
new file mode 100644
index 000000000..56798dedd
--- /dev/null
+++ b/tests/modules/trecinca.nim
@@ -0,0 +1,10 @@
+discard """
+  errormsg: "recursive dependency: 'trecincb.nim'"
+  file: "trecincb.nim"
+  line: 9
+"""
+# Test recursive includes
+
+include trecincb
+
+echo "trecina"
diff --git a/tests/modules/trecincb.nim b/tests/modules/trecincb.nim
new file mode 100644
index 000000000..30a5d7800
--- /dev/null
+++ b/tests/modules/trecincb.nim
@@ -0,0 +1,11 @@
+discard """
+  errormsg: "recursive dependency: 'trecincb.nim'"
+  file: "trecincb.nim"
+  line: 9
+"""
+# Test recursive includes
+
+
+include trecincb
+
+echo "trecinb"
diff --git a/tests/modules/trecmod.nim b/tests/modules/trecmod.nim
new file mode 100644
index 000000000..43e510e87
--- /dev/null
+++ b/tests/modules/trecmod.nim
@@ -0,0 +1,8 @@
+discard """
+  errormsg: "recursive module dependency detected"
+  file: "mrecmod.nim"
+  line: 1
+  disabled: true
+"""
+# recursive module
+import mrecmod
diff --git a/tests/modules/trecmod2.nim b/tests/modules/trecmod2.nim
new file mode 100644
index 000000000..03c8cf70d
--- /dev/null
+++ b/tests/modules/trecmod2.nim
@@ -0,0 +1,13 @@
+discard """
+  output: "4"
+"""
+type
+  T1* = int  # Module A exports the type ``T1``
+
+import mrecmod2   # the compiler starts parsing B
+# the manual says this should work
+proc main() =
+  echo p(3) # works because B has been parsed completely here
+
+main()
+
diff --git a/tests/modules/treorder.nim b/tests/modules/treorder.nim
new file mode 100644
index 000000000..ff0b2e071
--- /dev/null
+++ b/tests/modules/treorder.nim
@@ -0,0 +1,47 @@
+discard """
+  matrix: "-d:testdef"
+  output: '''works 34
+34
+defined
+3'''
+"""
+
+{.experimental: "codeReordering".}
+
+{.push callconv: stdcall.}
+
+proc bar(x: T)
+
+proc foo() =
+  bar(34)
+  whendep()
+
+proc foo(dummy: int) = echo dummy
+
+proc bar(x: T) =
+  echo "works ", x
+  foo(x)
+
+when defined(testdef):
+  proc whendep() = echo "defined"
+else:
+  proc whendep() = echo "undefined"
+
+foo()
+
+type
+  T = int
+
+
+when not declared(goo):
+  proc goo(my, omy) = echo my
+
+when not declared(goo):
+  proc goo(my, omy) = echo omy
+
+using
+  my, omy: int
+
+goo(3, 4)
+
+{.pop.}
diff --git a/tests/modules/tselfimport.nim b/tests/modules/tselfimport.nim
new file mode 100644
index 000000000..ba5d9b4cf
--- /dev/null
+++ b/tests/modules/tselfimport.nim
@@ -0,0 +1,8 @@
+discard """
+  errormsg: "module 'tselfimport' cannot import itself"
+  file: "tselfimport.nim"
+  line: 7
+"""
+import strutils as su # guard against regression
+import tselfimport #ERROR
+echo("Hello World")
diff --git a/tests/modules/tseq.nim b/tests/modules/tseq.nim
new file mode 100644
index 000000000..22ee48f42
--- /dev/null
+++ b/tests/modules/tseq.nim
@@ -0,0 +1,8 @@
+discard """
+  joinable: false
+  output: '''@[]
+@[]
+'''
+"""
+
+import seq
diff --git a/tests/modules/tstrutils_insert_sep.nim b/tests/modules/tstrutils_insert_sep.nim
new file mode 100644
index 000000000..775fe7da1
--- /dev/null
+++ b/tests/modules/tstrutils_insert_sep.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''
+-100
+-100,000
+100,000
+'''
+"""
+# test https://github.com/nim-lang/Nim/issues/11352
+
+import strutils
+echo insertSep($(-100), ',')
+echo insertSep($(-100_000), ',')
+echo insertSep($(100_000), ',')
\ No newline at end of file
diff --git a/tests/modules/tuppercased.nim b/tests/modules/tuppercased.nim
new file mode 100644
index 000000000..65f41becd
--- /dev/null
+++ b/tests/modules/tuppercased.nim
@@ -0,0 +1,8 @@
+discard """
+  output: "hello"
+"""
+
+import UpperCased
+
+# stress normalization rules:
+echo Upper_Cased.str
diff --git a/tests/modules/tutils_ab.nim b/tests/modules/tutils_ab.nim
new file mode 100644
index 000000000..25bd08f3c
--- /dev/null
+++ b/tests/modules/tutils_ab.nim
@@ -0,0 +1,5 @@
+import a/utils as autils, b/utils
+
+# bug #12420
+
+burnMem(x)