summary refs log tree commit diff stats
path: root/tests/effects
diff options
context:
space:
mode:
authoree7 <45465154+ee7@users.noreply.github.com>2021-02-03 16:00:29 +0100
committerGitHub <noreply@github.com>2021-02-03 16:00:29 +0100
commit14c61ecf24110f3f6a1a4a9c88439e568065ddd9 (patch)
tree186f2905b029c69632f7f8043384befb29d42528 /tests/effects
parent6f1289b80ccf599008368b121d874b4ce4717fc6 (diff)
downloadNim-14c61ecf24110f3f6a1a4a9c88439e568065ddd9.tar.gz
strictFuncs+views: add test that imports stdlib modules (#16878)
This commit attempts to improve testing of strictFuncs and views, and
prevent regressions like #16873 (resolved by 0b01eddace6a).

We previously only explicitly tested strictFuncs and views with a
smaller number of stdlib modules, mostly in:
- tests/effects/tstrict_funcs.nim
- tests/views/tcan_compile_nim.nim

Note that this commit leaves the `pegs` module commented out; it
cannot currently be compiled with `--experimental:views` (see #16892).

Note also that this commit is not sufficient to test strictFuncs and
views, but it does detect a subset of problems.
Diffstat (limited to 'tests/effects')
-rw-r--r--tests/effects/tstrict_funcs.nim12
-rw-r--r--tests/effects/tstrict_funcs_imports.nim177
-rw-r--r--tests/effects/tstrict_funcs_imports_js.nim21
3 files changed, 198 insertions, 12 deletions
diff --git a/tests/effects/tstrict_funcs.nim b/tests/effects/tstrict_funcs.nim
index 30a62a711..044bc7ee1 100644
--- a/tests/effects/tstrict_funcs.nim
+++ b/tests/effects/tstrict_funcs.nim
@@ -3,18 +3,6 @@ discard """
 """
 
 import tables, streams, parsecsv
-# We import the below modules to check that they compile with `strictFuncs`.
-# They are otherwise unused in this file.
-import
-  complex,
-  critbits,
-  httpcore,
-  math,
-  nre,
-  rationals,
-  sequtils,
-  strutils,
-  uri
 
 type
   Contig2Reads = TableRef[string, seq[string]]
diff --git a/tests/effects/tstrict_funcs_imports.nim b/tests/effects/tstrict_funcs_imports.nim
new file mode 100644
index 000000000..4e9b9fe66
--- /dev/null
+++ b/tests/effects/tstrict_funcs_imports.nim
@@ -0,0 +1,177 @@
+discard """
+  cmd: "nim $target $options --hints:on --experimental:strictFuncs --experimental:views --threads:on -d:ssl -d:nimCoroutines $file"
+  targets: "c"
+"""
+{.warning[UnusedImport]: off.}
+
+when defined(linux):
+  import linenoise
+
+import
+  algorithm,
+  asyncdispatch,
+  asyncfile,
+  asyncftpclient,
+  asyncfutures,
+  asynchttpserver,
+  asyncmacro,
+  asyncnet,
+  asyncstreams,
+  atomics,
+  base64,
+  bitops,
+  browsers,
+  cgi,
+  chains,
+  colors,
+  complex,
+  cookies,
+  coro,
+  cpuinfo,
+  cpuload,
+  critbits,
+  cstrutils,
+  db_common,
+  db_mysql,
+  db_odbc,
+  db_postgres,
+  db_sqlite,
+  deques,
+  distros,
+  dynlib,
+  encodings,
+  endians,
+  epoll,
+  fenv,
+  hashes,
+  heapqueue,
+  hotcodereloading,
+  htmlgen,
+  htmlparser,
+  httpclient,
+  httpcore,
+  inotify,
+  intsets,
+  json,
+  kqueue,
+  lenientops,
+  lexbase,
+  lists,
+  locks,
+  logging,
+  macrocache,
+  macros,
+  marshal,
+  math,
+  md5,
+  memfiles,
+  mersenne,
+  mimetypes,
+  nativesockets,
+  net,
+  nimhcr,
+  # nimprof,
+  nre,
+  oids,
+  options,
+  os,
+  osproc,
+  parsecfg,
+  parsecsv,
+  parsejson,
+  parseopt,
+  parsesql,
+  parseutils,
+  parsexml,
+  pathnorm,
+  # pegs,
+  posix_utils,
+  prelude,
+  punycode,
+  random,
+  rationals,
+  rdstdin,
+  re,
+  registry,
+  reservedmem,
+  rlocks,
+  ropes,
+  rtarrays,
+  selectors,
+  sequtils,
+  sets,
+  sharedlist,
+  sharedtables,
+  smtp,
+  ssl_certs,
+  ssl_config,
+  stats,
+  streams,
+  streamwrapper,
+  strformat,
+  strmisc,
+  strscans,
+  strtabs,
+  strutils,
+  sugar,
+  tables,
+  terminal,
+  threadpool,
+  times,
+  typeinfo,
+  typetraits,
+  unicode,
+  unidecode,
+  unittest,
+  uri,
+  volatile,
+  winlean,
+  xmlparser,
+  xmltree
+
+import experimental/[
+  diff,
+]
+
+import packages/docutils/[
+  highlite,
+  rst,
+  rstast,
+  rstgen,
+]
+
+import std/[
+  compilesettings,
+  decls,
+  editdistance,
+  effecttraits,
+  enumerate,
+  enumutils,
+  exitprocs,
+  isolation,
+  jsonutils,
+  logic,
+  monotimes,
+  packedsets,
+  setutils,
+  sha1,
+  socketstreams,
+  stackframes,
+  sums,
+  time_t,
+  varints,
+  with,
+  wordwrap,
+  wrapnils,
+]
+
+import std/private/[
+  asciitables,
+  decode_helpers,
+  gitutils,
+  globs,
+  miscdollars,
+  since,
+  strimpl,
+  underscored_calls,
+]
diff --git a/tests/effects/tstrict_funcs_imports_js.nim b/tests/effects/tstrict_funcs_imports_js.nim
new file mode 100644
index 000000000..b7fcd343a
--- /dev/null
+++ b/tests/effects/tstrict_funcs_imports_js.nim
@@ -0,0 +1,21 @@
+discard """
+  cmd: "nim $target $options --hints:on --experimental:strictFuncs --experimental:views $file"
+  targets: "js"
+"""
+{.warning[UnusedImport]: off.}
+
+import
+  asyncjs,
+  dom,
+  dom_extensions,
+  jsconsole,
+  jsffi,
+  jsre
+
+import std/[
+  jsbigints,
+]
+
+import std/private/[
+  jsutils,
+]