summary refs log tree commit diff stats
path: root/tests/stdlib/talgorithm.nim
diff options
context:
space:
mode:
authorshirleyquirk <31934565+shirleyquirk@users.noreply.github.com>2020-10-27 12:38:46 +0000
committerGitHub <noreply@github.com>2020-10-27 12:38:46 +0000
commit218acfe3671a5a4b7a4c203b6010fdacbe32051c (patch)
treee5eaf744040a27db8f41aecc13fdbd4a1df825d2 /tests/stdlib/talgorithm.nim
parent12143d90c828bb4142751a6511ce790aac8aca51 (diff)
downloadNim-218acfe3671a5a4b7a4c203b6010fdacbe32051c.tar.gz
fixes #10456,#12928 issues when chaining templates to sortedByIt (#15734)
* update c_malloc's to csize_t 

fix for broken --os:ios

* I'm an idiot sorry

* Create talgorithm.nim

* workaround for #10456

I don't understand the intricacies of how lambdalifting and template expansions interact with lent, so i don't know how to fix the real problem, but this sidesteps whatever issue that is.

* working test, use typeof rather than auto
Diffstat (limited to 'tests/stdlib/talgorithm.nim')
-rw-r--r--tests/stdlib/talgorithm.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/stdlib/talgorithm.nim b/tests/stdlib/talgorithm.nim
new file mode 100644
index 000000000..85ae79219
--- /dev/null
+++ b/tests/stdlib/talgorithm.nim
@@ -0,0 +1,18 @@
+discard """
+  output:'''@["3", "2", "1"]
+  '''
+"""
+#12928,10456
+import sequtils, strutils, algorithm, json
+
+proc test() = 
+  try: 
+    let info = parseJson("""
+    {"a": ["1", "2", "3"]}
+    """)
+    let prefixes = info["a"].getElems().mapIt(it.getStr()).sortedByIt(it).reversed()
+    echo prefixes
+  except:
+    discard
+  
+test()