clean up deprecated stuff and unused imports in tests (#13059)

This commit is contained in:
Miran 2020-01-07 09:49:08 +01:00 • committed by GitHub
commit 1551fff853
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 16 deletions

View file

@ -670,7 +670,7 @@ when isMainModule:
doAssert a[1] == 0 doAssert a[1] == 0
doAssert rand(0) == 0 doAssert rand(0) == 0
doAssert rand("a") == 'a' doAssert sample("a") == 'a'
when compileOption("rangeChecks"): when compileOption("rangeChecks"):
try: try:

View file

@ -2,7 +2,7 @@ discard """
action: run action: run
""" """
import math, random, strutils import random, strutils
const consolePrefix = "jsCallbacks" const consolePrefix = "jsCallbacks"
asm """ asm """
@ -33,8 +33,8 @@ proc runCallbacks ():cstring {.importc.}
proc `*` (s:string, n:Natural) : string = s.repeat(n) proc `*` (s:string, n:Natural) : string = s.repeat(n)
proc outer (i:Natural) : (string, int) = proc outer (i:Natural) : (string, int) =
let c = $char(random(93) + 33) let c = $char(rand(93) + 33)
let n = random(40) let n = rand(40)
let s = c * n let s = c * n
proc inner(): cstring = ("[$1]" % $n) & s & " <--" proc inner(): cstring = ("[$1]" % $n) & s & " <--"
regCallback(inner) regCallback(inner)

View file

@ -4,8 +4,7 @@ discard """
# This file tests the JavaScript generator # This file tests the JavaScript generator
import import strutils
dom, strutils
var var
inputElement = "1123" inputElement = "1123"
@ -51,4 +50,3 @@ block:
var s: seq[int] var s: seq[int]
s.add(2) s.add(2)
doAssert(s == @[2]) doAssert(s == @[2])

View file

@ -35,7 +35,7 @@ true
## same as tjsffi, but this test uses the old names: importc and ## same as tjsffi, but this test uses the old names: importc and
## importcpp. This test is for backwards compatibility. ## importcpp. This test is for backwards compatibility.
import macros, jsffi, jsconsole import jsffi, jsconsole
# Tests for JsObject # Tests for JsObject
# Test JsObject []= and [] # Test JsObject []= and []
@ -299,7 +299,6 @@ block:
test() test()
import macros
block: block:
{.emit: {.emit:

View file

@ -1,5 +1,5 @@
type type
TObj* = object {.inheritable.} TObj* {.inheritable.} = object
var myObj* : ref TObj var myObj* : ref TObj

View file

@ -9,7 +9,7 @@ hello
# tmultim1 # tmultim1
type type
Expression = ref object {.inheritable.} Expression {.inheritable.} = ref object
Literal = ref object of Expression Literal = ref object of Expression
x: int x: int
PlusExpr = ref object of Expression PlusExpr = ref object of Expression

View file

@ -5,7 +5,7 @@ discard """
''' '''
""" """
from future import `->`, `=>` from sugar import `->`, `=>`
from math import `^`, sum from math import `^`, sum
from sequtils import filter, map, toSeq from sequtils import filter, map, toSeq

View file

@ -4,10 +4,12 @@ discard """
""" """
import math import math
import strformat
const manualTest = false const manualTest = false
when manualTest:
import strformat
proc frexp_test(lo, hi, step: float64) = proc frexp_test(lo, hi, step: float64) =
var exp: int var exp: int
var frac: float64 var frac: float64