From f92e046d13f98f34ff2bfc8dd0793122ff18706b Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Sat, 7 Jun 2014 00:04:26 -0700 Subject: [PATCH] add spec helpers --- spec/helpers.moon | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 spec/helpers.moon diff --git a/spec/helpers.moon b/spec/helpers.moon new file mode 100644 index 0000000..c5ddf9f --- /dev/null +++ b/spec/helpers.moon @@ -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 }