From e2b149190584e53c662d09aeee9390908bbb250f Mon Sep 17 00:00:00 2001 From: Bung Date: Tue, 28 Jul 2020 17:47:22 +0800 Subject: 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 * need to be countdown Co-authored-by: alaviss --- tests/modules/tstrutils_insert_sep.nim | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/modules/tstrutils_insert_sep.nim (limited to 'tests/modules') 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 -- cgit 1.4.1-2-gfad0