summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-01-07 09:49:08 +0100
committerGitHub <noreply@github.com>2020-01-07 09:49:08 +0100
commit1551fff8532540106acf792a830fd9979e1e431b (patch)
treeebd3860a1c40989589a9090baa39e4c529a0c715
parent6a7a19eb15d3878bc97a7ea729d981124628f3ad (diff)
downloadNim-1551fff8532540106acf792a830fd9979e1e431b.tar.gz
clean up deprecated stuff and unused imports in tests (#13059)
-rw-r--r--lib/pure/random.nim2
-rw-r--r--tests/js/tclosures.nim8
-rw-r--r--tests/js/test1.nim4
-rw-r--r--tests/js/tjsffi_old.nim3
-rw-r--r--tests/method/mmultim3.nim2
-rw-r--r--tests/method/tmultimjs.nim4
-rw-r--r--tests/openarray/t6163.nim4
-rw-r--r--tests/stdlib/tfrexp1.nim4
8 files changed, 15 insertions, 16 deletions
diff --git a/lib/pure/random.nim b/lib/pure/random.nim
index 00e6243a3..a0e46660a 100644
--- a/lib/pure/random.nim
+++ b/lib/pure/random.nim
@@ -670,7 +670,7 @@ when isMainModule:
     doAssert a[1] == 0
 
     doAssert rand(0) == 0
-    doAssert rand("a") == 'a'
+    doAssert sample("a") == 'a'
 
     when compileOption("rangeChecks"):
       try:
diff --git a/tests/js/tclosures.nim b/tests/js/tclosures.nim
index 70037f4bf..3137123bf 100644
--- a/tests/js/tclosures.nim
+++ b/tests/js/tclosures.nim
@@ -2,7 +2,7 @@ discard """
   action: run
 """
 
-import math, random, strutils
+import random, strutils
 const consolePrefix = "jsCallbacks"
 
 asm """
@@ -33,8 +33,8 @@ proc runCallbacks ():cstring {.importc.}
 proc `*` (s:string, n:Natural) : string = s.repeat(n)
 
 proc outer (i:Natural) : (string, int) =
-    let c = $char(random(93) + 33)
-    let n = random(40)
+    let c = $char(rand(93) + 33)
+    let n = rand(40)
     let s = c * n
     proc inner(): cstring = ("[$1]" % $n) & s & " <--"
     regCallback(inner)
@@ -92,4 +92,4 @@ block issue7048:
     let f = foo(p)
     p = addr s2
     doAssert len(p[]) == 5
-    doAssert f() == 3
\ No newline at end of file
+    doAssert f() == 3
diff --git a/tests/js/test1.nim b/tests/js/test1.nim
index 73e7a37ed..7ad3f85f6 100644
--- a/tests/js/test1.nim
+++ b/tests/js/test1.nim
@@ -4,8 +4,7 @@ discard """
 
 # This file tests the JavaScript generator
 
-import
-  dom, strutils
+import strutils
 
 var
   inputElement = "1123"
@@ -51,4 +50,3 @@ block:
   var s: seq[int]
   s.add(2)
   doAssert(s == @[2])
-
diff --git a/tests/js/tjsffi_old.nim b/tests/js/tjsffi_old.nim
index 48e06c46c..1f149694b 100644
--- a/tests/js/tjsffi_old.nim
+++ b/tests/js/tjsffi_old.nim
@@ -35,7 +35,7 @@ true
 ## same as tjsffi, but this test uses the old names: importc and
 ## importcpp. This test is for backwards compatibility.
 
-import macros, jsffi, jsconsole
+import jsffi, jsconsole
 
 # Tests for JsObject
 # Test JsObject []= and []
@@ -299,7 +299,6 @@ block:
 
   test()
 
-import macros
 
 block:
   {.emit:
diff --git a/tests/method/mmultim3.nim b/tests/method/mmultim3.nim
index b391731be..a97248203 100644
--- a/tests/method/mmultim3.nim
+++ b/tests/method/mmultim3.nim
@@ -1,5 +1,5 @@
 type
-    TObj* = object {.inheritable.}
+    TObj* {.inheritable.} = object
 
 var myObj* : ref TObj
 
diff --git a/tests/method/tmultimjs.nim b/tests/method/tmultimjs.nim
index 9dcfc0dcc..ce62a2c23 100644
--- a/tests/method/tmultimjs.nim
+++ b/tests/method/tmultimjs.nim
@@ -9,7 +9,7 @@ hello
 
 # tmultim1
 type
-  Expression = ref object {.inheritable.}
+  Expression {.inheritable.} = ref object
   Literal = ref object of Expression
     x: int
   PlusExpr = ref object of Expression
@@ -69,4 +69,4 @@ var s:ref Test = newTest()
 #doesn't work
 for z in 1..4:
   s.doMethod()
-  break
\ No newline at end of file
+  break
diff --git a/tests/openarray/t6163.nim b/tests/openarray/t6163.nim
index ec8c3cd0b..0e9d4e0e4 100644
--- a/tests/openarray/t6163.nim
+++ b/tests/openarray/t6163.nim
@@ -5,7 +5,7 @@ discard """
 '''
 """
 
-from future import `->`, `=>`
+from sugar import `->`, `=>`
 from math import `^`, sum
 from sequtils import filter, map, toSeq
 
@@ -14,4 +14,4 @@ proc f: int =
 
 var a = f()
 
-echo a
\ No newline at end of file
+echo a
diff --git a/tests/stdlib/tfrexp1.nim b/tests/stdlib/tfrexp1.nim
index c6bb2b38c..a32ecbc23 100644
--- a/tests/stdlib/tfrexp1.nim
+++ b/tests/stdlib/tfrexp1.nim
@@ -4,10 +4,12 @@ discard """
 """
 
 import math
-import strformat
 
 const manualTest = false
 
+when manualTest:
+  import strformat
+
 proc frexp_test(lo, hi, step: float64) =
   var exp: int
   var frac: float64