Skip to content

Instantly share code, notes, and snippets.

@jtrim
Created November 26, 2014 19:32
Show Gist options
  • Save jtrim/0261be657b3b75c4be84 to your computer and use it in GitHub Desktop.
Save jtrim/0261be657b3b75c4be84 to your computer and use it in GitHub Desktop.
defmodule StringCalculator.DelimiterTest do
use ExUnit.Case
import StringCalculator.Delimiter
test "when given a string with no custom delimiter, the default delimiter is returned" do
assert delimiter_from("1,2,3") == ~r/(?:,|\n)/
end
test "when given a string with a custom delimiter, the custom delimiter is extracted and added to the defaults" do
assert delimiter_from("//;\n1,2,3") == ~r/(?:;|,|\n)/
end
test "when given a string with a custom delimiter, the custom delimiter is escaped properly" do
assert delimiter_from("//[***]\n1,2***3") == ~r/(?:\*\*\*|,|\n)/
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment