follow #16505 move and active tests (#16508)

* fix printing negative zero in JS backend

* move tests
This commit is contained in:
flywind 2020-12-30 08:06:50 -06:00 • committed by GitHub
commit 73f778e441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 30 deletions

View file

@ -1,30 +0,0 @@
discard """
targets: "c cpp js"
"""
proc main()=
block:
let a = -0.0
doAssert $a == "-0.0"
doAssert $(-0.0) == "-0.0"
block:
let a = 0.0
when nimvm: discard ## TODO VM print wrong -0.0
else:
doAssert $a == "0.0"
doAssert $(0.0) == "0.0"
block:
let b = -0
doAssert $b == "0"
doAssert $(-0) == "0"
block:
let b = 0
doAssert $b == "0"
doAssert $(0) == "0"
static: main()
main()

View file

@ -77,3 +77,29 @@ block: # #14350 for JS
doAssert cstr == nil doAssert cstr == nil
doAssert cstr.isNil doAssert cstr.isNil
doAssert cstr != cstring("") doAssert cstr != cstring("")
proc main()=
block:
let a = -0.0
doAssert $a == "-0.0"
doAssert $(-0.0) == "-0.0"
block:
let a = 0.0
doAssert $a == "0.0"
doAssert $(0.0) == "0.0"
block:
let b = -0
doAssert $b == "0"
doAssert $(-0) == "0"
block:
let b = 0
doAssert $b == "0"
doAssert $(0) == "0"
static: main()
main()