Skip to content

Instantly share code, notes, and snippets.

@Skrylar
Created February 27, 2014 19:50
Show Gist options
  • Save Skrylar/9258024 to your computer and use it in GitHub Desktop.
Save Skrylar/9258024 to your computer and use it in GitHub Desktop.
Using 'check' prevents propagation of changes to variable parameters.
import unittest
proc doThings(spuds: var int): int =
spuds = 24
return 99
suite "broken":
test "count the spuds":
var spuds = 0
check doThings(spuds) == 99
check spuds == 24 # fails, spuds is still 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment