summary refs log tree commit diff stats
path: root/tests/modules
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2020-07-28 17:47:22 +0800
committerGitHub <noreply@github.com>2020-07-28 11:47:22 +0200
commite2b149190584e53c662d09aeee9390908bbb250f (patch)
treed8a3da1133d03a5b250400d6319bc9da3d7acc5f /tests/modules
parent39487f9728c03e98109b70c2d169e6366b9a8337 (diff)
downloadNim-e2b149190584e53c662d09aeee9390908bbb250f.tar.gz
Fix #11352 strutil.insertSep() fails on negative numbers (#15087)
* fix #11352 strutil.insertSep handle negtive number

* test for #11352

* optimize

* not parts string var

* Update lib/pure/strutils.nim

Thanks!

Co-authored-by: alaviss <leorize+oss@disroot.org>

* need to be countdown

Co-authored-by: alaviss <leorize+oss@disroot.org>
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/tstrutils_insert_sep.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/modules/tstrutils_insert_sep.nim b/tests/modules/tstrutils_insert_sep.nim
new file mode 100644
index 000000000..775fe7da1
--- /dev/null
+++ b/tests/modules/tstrutils_insert_sep.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''
+-100
+-100,000
+100,000
+'''
+"""
+# test https://github.com/nim-lang/Nim/issues/11352
+
+import strutils
+echo insertSep($(-100), ',')
+echo insertSep($(-100_000), ',')
+echo insertSep($(100_000), ',')
\ No newline at end of file