std/options: $some(3) is now "some(3)", etc. (#17147)
* std/options: $some(3) is now "some(3)", not "Some(3)", `$none(int)` is now `"none(int)"` instead of `"None[int]"` * fix tests * disable optionsutils
This commit is contained in:
parent
a4e6b242d5
commit
578d1ee751
6 changed files with 29 additions and 20 deletions
|
|
@ -24,9 +24,9 @@ G:0,1:0.1
|
|||
G:0,1:0.1
|
||||
H:1:0.1
|
||||
0
|
||||
(foo: None[seq[Foo]], s: "")
|
||||
(foo: Some(@[(a: "world", bar: None[Bar])]), s: "hello,")
|
||||
@[(a: "hey", bar: None[Bar])]
|
||||
(foo: none(seq[Foo]), s: "")
|
||||
(foo: some(@[(a: "world", bar: none(Bar))]), s: "hello,")
|
||||
@[(a: "hey", bar: none(Bar))]
|
||||
'''
|
||||
joinable: false
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ block:
|
|||
let
|
||||
a1 = some(newJNull())
|
||||
a2 = none(JsonNode)
|
||||
doAssert $($$a1).to[:Option[JsonNode]] == "Some(null)"
|
||||
doAssert $($$a2).to[:Option[JsonNode]] == "None[JsonNode]"
|
||||
doAssert $($$a1).to[:Option[JsonNode]] == "some(null)"
|
||||
doAssert $($$a2).to[:Option[JsonNode]] == "none(JsonNode)"
|
||||
doAssert ($$a1).to[:Option[JsonNode]] == some(newJNull())
|
||||
doAssert ($$a2).to[:Option[JsonNode]] == none(JsonNode)
|
||||
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ proc main() =
|
|||
doAssert(stringNone.get("Correct") == "Correct")
|
||||
|
||||
block stringify:
|
||||
doAssert($(some("Correct")) == "Some(\"Correct\")")
|
||||
doAssert($(stringNone) == "None[string]")
|
||||
doAssert($(some("Correct")) == "some(\"Correct\")")
|
||||
doAssert($(stringNone) == "none(string)")
|
||||
|
||||
disableJsVm:
|
||||
block map_with_a_void_result:
|
||||
|
|
@ -155,7 +155,7 @@ proc main() =
|
|||
name: string
|
||||
|
||||
let nobody = none(Named)
|
||||
doAssert($nobody == "None[Named]")
|
||||
doAssert($nobody == "none(Named)")
|
||||
|
||||
# "$ on type with name()"
|
||||
block:
|
||||
|
|
@ -163,7 +163,7 @@ proc main() =
|
|||
myname: string
|
||||
|
||||
let noperson = none(Person)
|
||||
doAssert($noperson == "None[Person]")
|
||||
doAssert($noperson == "none(Person)")
|
||||
|
||||
# "Ref type with overloaded `==`"
|
||||
block:
|
||||
|
|
@ -190,7 +190,7 @@ proc main() =
|
|||
block:
|
||||
let x = none(cstring)
|
||||
doAssert x.isNone
|
||||
doAssert $x == "None[cstring]"
|
||||
doAssert $x == "none(cstring)"
|
||||
|
||||
|
||||
static: main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue