fix stylecheck for BiggestUInt (#99)
* fix reader_desc.nim * fix test_serialization.nim * workaround segfault on C++ related to unittest2 * link to nim issue as comment
This commit is contained in:
parent
ab1a061756
commit
9110cc8d7a
|
@ -60,7 +60,7 @@ type
|
|||
|
||||
IntOverflowError* = object of JsonReaderError
|
||||
isNegative: bool
|
||||
absIntVal: BiggestUint
|
||||
absIntVal: BiggestUInt
|
||||
|
||||
Json.setReader JsonReader
|
||||
|
||||
|
@ -129,7 +129,7 @@ template raiseUnexpectedValue*(r: JsonReader, msg: string) =
|
|||
raiseUnexpectedValue(r.lex, msg)
|
||||
|
||||
func raiseIntOverflow*(
|
||||
lex: JsonLexer, absIntVal: BiggestUint, isNegative: bool)
|
||||
lex: JsonLexer, absIntVal: BiggestUInt, isNegative: bool)
|
||||
{.noreturn, raises: [JsonReaderError].} =
|
||||
var ex = new IntOverflowError
|
||||
ex.assignLineNumber(lex)
|
||||
|
@ -137,7 +137,7 @@ func raiseIntOverflow*(
|
|||
ex.isNegative = isNegative
|
||||
raise ex
|
||||
|
||||
template raiseIntOverflow*(r: JsonReader, absIntVal: BiggestUint, isNegative: bool) =
|
||||
template raiseIntOverflow*(r: JsonReader, absIntVal: BiggestUInt, isNegative: bool) =
|
||||
raiseIntOverflow(r.lex, absIntVal, isNegative)
|
||||
|
||||
func raiseUnexpectedField*(
|
||||
|
|
|
@ -142,8 +142,10 @@ suite "JsonReader basic test":
|
|||
test "readValue":
|
||||
try:
|
||||
var r = toReader jsonText3
|
||||
var val: MasterReader
|
||||
r.readValue(val)
|
||||
var valOrig: MasterReader
|
||||
r.readValue(valOrig)
|
||||
# workaround for https://github.com/nim-lang/Nim/issues/24274
|
||||
let val = valOrig
|
||||
check:
|
||||
val.one == JsonString("[1,true,null]")
|
||||
val.two.num == 123
|
||||
|
|
|
@ -678,14 +678,14 @@ suite "toJson tests":
|
|||
"""
|
||||
|
||||
test "max unsigned value":
|
||||
var uintVal = not BiggestUint(0)
|
||||
var uintVal = not BiggestUInt(0)
|
||||
let jsonValue = Json.encode(uintVal)
|
||||
check:
|
||||
jsonValue == "18446744073709551615"
|
||||
Json.decode(jsonValue, BiggestUint) == uintVal
|
||||
Json.decode(jsonValue, BiggestUInt) == uintVal
|
||||
|
||||
expect JsonReaderError:
|
||||
discard Json.decode(jsonValue, BiggestUint, flags = {JsonReaderFlag.portableInt})
|
||||
discard Json.decode(jsonValue, BiggestUInt, flags = {JsonReaderFlag.portableInt})
|
||||
|
||||
test "max signed value":
|
||||
let intVal = BiggestInt.high
|
||||
|
|
Loading…
Reference in New Issue