From 1551fff8532540106acf792a830fd9979e1e431b Mon Sep 17 00:00:00 2001 From: Miran Date: Tue, 7 Jan 2020 09:49:08 +0100 Subject: [PATCH] clean up deprecated stuff and unused imports in tests (#13059) --- lib/pure/random.nim | 2 +- tests/js/tclosures.nim | 8 ++++---- tests/js/test1.nim | 4 +--- tests/js/tjsffi_old.nim | 3 +-- tests/method/mmultim3.nim | 2 +- tests/method/tmultimjs.nim | 4 ++-- tests/openarray/t6163.nim | 4 ++-- tests/stdlib/tfrexp1.nim | 4 +++- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/pure/random.nim b/lib/pure/random.nim index 00e6243a33c2..a0e46660a4b0 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 70037f4bf04e..3137123bf8d3 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 73e7a37ed21e..7ad3f85f6ac7 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 48e06c46c4ef..1f149694b4d4 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 b391731be726..a97248203463 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 9dcfc0dcc87e..ce62a2c235d8 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 ec8c3cd0b3a4..0e9d4e0e43ca 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 c6bb2b38ccbd..a32ecbc23556 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