summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2022-08-24 10:44:16 +0300
committerGitHub <noreply@github.com>2022-08-24 09:44:16 +0200
commitb8dc58d8843af7dbd0ee2f3274e0d4cf18391dd2 (patch)
tree78c2cf31185875c855de1f1457daaefbaadd930e /tests
parent9d9ecc3c1d774a71b4b866d7e503b25c307e7cbf (diff)
downloadNim-b8dc58d8843af7dbd0ee2f3274e0d4cf18391dd2.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tobjectdollar.nim14
-rw-r--r--tests/stdlib/toptions.nim3
-rw-r--r--tests/stdlib/tstrformat.nim3
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/stdlib/tobjectdollar.nim b/tests/stdlib/tobjectdollar.nim
new file mode 100644
index 000000000..cf78fa255
--- /dev/null
+++ b/tests/stdlib/tobjectdollar.nim
@@ -0,0 +1,14 @@
+discard """
+  matrix: "-d:nimPreviewSlimSystem"
+"""
+
+import std/assertions
+
+type Foo = object
+  a, b: int
+
+let x = Foo(a: 23, b: 45)
+doAssert not compiles($x)
+import std/objectdollar
+doAssert compiles($x)
+doAssert $x == "(a: 23, b: 45)"
diff --git a/tests/stdlib/toptions.nim b/tests/stdlib/toptions.nim
index 71c52a07e..633be6c04 100644
--- a/tests/stdlib/toptions.nim
+++ b/tests/stdlib/toptions.nim
@@ -4,6 +4,9 @@ discard """
 
 import std/[json, options]
 
+when defined(nimPreviewSlimSystem):
+  import std/objectdollar
+
 
 # RefPerson is used to test that overloaded `==` operator is not called by
 # options. It is defined here in the global scope, because otherwise the test
diff --git a/tests/stdlib/tstrformat.nim b/tests/stdlib/tstrformat.nim
index 1863d3138..ea7be8297 100644
--- a/tests/stdlib/tstrformat.nim
+++ b/tests/stdlib/tstrformat.nim
@@ -3,6 +3,9 @@
 import genericstrformat
 import std/[strformat, strutils, times, tables, json]
 
+when defined(nimPreviewSlimSystem):
+  import std/objectdollar
+
 proc main() =
   block: # issue #7632
     doAssert works(5) == "formatted  5"