add spec helpers

This commit is contained in:
leaf corcoran 2014-06-07 00:04:26 -07:00
parent c73762e00e
commit f92e046d13

9
spec/helpers.moon Normal file
View File

@ -0,0 +1,9 @@
-- remove front indentation from a multiline string, making it suitable to be
-- parsed
unindent = (str) ->
indent = str\match "^%s+"
return str unless indent
(str\gsub("\n#{indent}", "\n")\gsub "%s+$", "")
{ :unindent }