summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system/sysstr.nim2
-rw-r--r--tests/overload/tsystemcmp.nim4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim
index 31a59c0c0..5bf90c895 100644
--- a/lib/system/sysstr.nim
+++ b/lib/system/sysstr.nim
@@ -30,7 +30,7 @@ proc cmpStrings(a, b: NimString): int {.inline, compilerProc.} =
     if result == 0:
       result = a.len - b.len
   else:
-    result = 0
+    result = a.len - b.len
 
 proc eqStrings(a, b: NimString): bool {.inline, compilerProc.} =
   if a == b: return true
diff --git a/tests/overload/tsystemcmp.nim b/tests/overload/tsystemcmp.nim
index 68cbf9fa7..aa761b759 100644
--- a/tests/overload/tsystemcmp.nim
+++ b/tests/overload/tsystemcmp.nim
@@ -1,12 +1,14 @@
 discard """
   cmd: r"nim c --hints:on $options --threads:on $file"
+  output: '''@["", "a", "ha", "hi", "ho", "huu"]'''
 """
 
 import algorithm
 
 # bug #1657
-var modules = @["hi", "ho", "ha", "huu"]
+var modules = @["hi", "ho", "", "a", "ha", "huu"]
 sort(modules, system.cmp)
+echo modules
 
 type
   MyType = object