mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fix stringify unsigned integer in JS and JS VM (#17086)
* fix js unsigned integer * better
This commit is contained in:
@@ -101,6 +101,31 @@ block: # #14350, #16674, #16686 for JS
|
||||
doAssert nil1 == cstring("")
|
||||
doAssert nil2 == cstring("")
|
||||
|
||||
block:
|
||||
block:
|
||||
let x = -1'i8
|
||||
let y = uint32(x)
|
||||
|
||||
doAssert $y == "4294967295"
|
||||
|
||||
block:
|
||||
let x = -1'i16
|
||||
let y = uint32(x)
|
||||
|
||||
doAssert $y == "4294967295"
|
||||
|
||||
block:
|
||||
let x = -1'i32
|
||||
let y = uint32(x)
|
||||
|
||||
doAssert $y == "4294967295"
|
||||
|
||||
block:
|
||||
let x = 4294967295'u32
|
||||
doAssert $x == "4294967295"
|
||||
|
||||
block:
|
||||
doAssert $(4294967295'u32) == "4294967295"
|
||||
|
||||
proc main()=
|
||||
block:
|
||||
@@ -124,5 +149,8 @@ proc main()=
|
||||
doAssert $(0) == "0"
|
||||
|
||||
|
||||
doAssert $uint32.high == "4294967295"
|
||||
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user