<commit_before>discard """
  cmd: '''nim c --newruntime $file'''
  output: '''a b
0 0  alloc/dealloc pairs: 0'''
"""

import core / allocators
import system / ansi_c

proc main(): owned(proc()) =
  var a = "a"
  var b = "b"
  result = proc() =
    echo a, " ", b

proc wrap =
  let p = main()
  p()

wrap()
let (a, d) = allocCounters()
discard cprintf("%ld %ld  alloc/dealloc pairs: %ld\n", a, d, system.allocs)<commit_msg>[other] newruntime: add a simple closure iterator test<commit_after>discard """
  cmd: '''nim c --newruntime $file'''
  output: '''a b
70
2 2  alloc/dealloc pairs: 0'''
"""

import core / allocators
import system / ansi_c

proc main(): owned(proc()) =
  var a = "a"
  var b = "b"
  result = proc() =
    echo a, " ", b


proc foo(f: (iterator(): int)) =
  for i in f(): echo i

proc wrap =
  let p = main()
  p()

  let fIt = iterator(): int = yield 70
  foo fIt

wrap()
let (a, d) = allocCounters()
discard cprintf("%ld %ld  alloc/dealloc pairs: %ld\n", a, d, system.allocs)
{'fraction_non_alphanumeric': 0.18036072144288579, 'fraction_numerical': 0.01002004008016032, 'mean_word_length': 3.2151898734177213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6870195', 'n_tokens_mistral': 388, 'n_tokens_neox': 378, 'n_words': 133}