Skip to content

Commit

Permalink
clean up deprecated stuff and unused imports in tests (#13059)
Browse files Browse the repository at this point in the history
  • Loading branch information
narimiran authored Jan 7, 2020
1 parent 6a7a19e commit 1551fff
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/pure/random.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/js/tclosures.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ discard """
action: run
"""

import math, random, strutils
import random, strutils
const consolePrefix = "jsCallbacks"

asm """
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -92,4 +92,4 @@ block issue7048:
let f = foo(p)
p = addr s2
doAssert len(p[]) == 5
doAssert f() == 3
doAssert f() == 3
4 changes: 1 addition & 3 deletions tests/js/test1.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ discard """

# This file tests the JavaScript generator

import
dom, strutils
import strutils

var
inputElement = "1123"
Expand Down Expand Up @@ -51,4 +50,3 @@ block:
var s: seq[int]
s.add(2)
doAssert(s == @[2])

3 changes: 1 addition & 2 deletions tests/js/tjsffi_old.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
Expand Down Expand Up @@ -299,7 +299,6 @@ block:

test()

import macros

block:
{.emit:
Expand Down
2 changes: 1 addition & 1 deletion tests/method/mmultim3.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type
TObj* = object {.inheritable.}
TObj* {.inheritable.} = object

var myObj* : ref TObj

Expand Down
4 changes: 2 additions & 2 deletions tests/method/tmultimjs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -69,4 +69,4 @@ var s:ref Test = newTest()
#doesn't work
for z in 1..4:
s.doMethod()
break
break
4 changes: 2 additions & 2 deletions tests/openarray/t6163.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ discard """
'''
"""

from future import `->`, `=>`
from sugar import `->`, `=>`
from math import `^`, sum
from sequtils import filter, map, toSeq

Expand All @@ -14,4 +14,4 @@ proc f: int =

var a = f()

echo a
echo a
4 changes: 3 additions & 1 deletion tests/stdlib/tfrexp1.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1551fff

Please sign in to comment.