Created
November 26, 2014 19:32
-
-
Save jtrim/0261be657b3b75c4be84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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