Fix JsonValueRef nil comparison
This commit is contained in:
parent
ce214b000d
commit
547604004d
|
@ -136,7 +136,7 @@ func `==`*(lhs, rhs: JsonValueRef): bool =
|
||||||
if lhs.isNil and rhs.isNil:
|
if lhs.isNil and rhs.isNil:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
if lhs.isNil and rhs.isNil:
|
if not lhs.isNil and rhs.isNil:
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if lhs.isNil and not rhs.isNil:
|
if lhs.isNil and not rhs.isNil:
|
||||||
|
|
|
@ -243,6 +243,14 @@ suite "Public parser":
|
||||||
if name notin allowedToFail:
|
if name notin allowedToFail:
|
||||||
testParseAsString(fileName)
|
testParseAsString(fileName)
|
||||||
|
|
||||||
|
test "JsonValueRef comparison":
|
||||||
|
var x = JsonValueRef[uint64](kind: JsonValueKind.Null)
|
||||||
|
var n = JsonValueRef[uint64](nil)
|
||||||
|
check x != n
|
||||||
|
check n != x
|
||||||
|
check x == x
|
||||||
|
check n == n
|
||||||
|
|
||||||
const
|
const
|
||||||
jsonText = """
|
jsonText = """
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue