test removing dollar for objects out of system (#20242)
* test removing dollar for objects out of system * test & fixes * fix bootstrap * use nimPreviewSlimSystem, test stdlib category * fix test
This commit is contained in:
parent
9d9ecc3c1d
commit
b8dc58d884
9 changed files with 84 additions and 40 deletions
11
lib/std/objectdollar.nim
Normal file
11
lib/std/objectdollar.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import std/private/miscdollars
|
||||
|
||||
proc `$`*[T: object](x: T): string =
|
||||
## Generic `$` operator for objects with similar output to
|
||||
## `$` for named tuples.
|
||||
runnableExamples:
|
||||
type Foo = object
|
||||
a, b: int
|
||||
let x = Foo(a: 23, b: 45)
|
||||
assert $x == "(a: 23, b: 45)"
|
||||
tupleObjectDollar(result, x)
|
||||
Loading…
Add table
Add a link
Reference in a new issue