TEST: Attempt at making a test
This commit is contained in:
parent
29b781a167
commit
78412a40a1
|
@ -19,6 +19,23 @@ defmodule RlRepo.Template do
|
|||
# body
|
||||
end
|
||||
|
||||
def test_template(template_name, replacements) do
|
||||
body = "~(reason)"
|
||||
# TODO: Check if there is any actual placeholders
|
||||
v = String.contains?(body, "~(")
|
||||
Logger.info v
|
||||
# if v do
|
||||
len = body |> String.split("~(") |> length()
|
||||
Logger.info body
|
||||
# TODO: Math this out to be equal to the number of splits
|
||||
# if len >= 2 do
|
||||
template_step(replacements, body, len)
|
||||
# Logger.info "Len greater 2"
|
||||
# end
|
||||
# end
|
||||
# body
|
||||
end
|
||||
|
||||
def template_step(replacements, body, steps_left) do
|
||||
[before_placeholder | rest] = split_path = String.split(body, "~(", parts: 2)
|
||||
[remains | _] = rest
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
defmodule RlRepoTest do
|
||||
require Logger
|
||||
use ExUnit.Case
|
||||
doctest RlRepo
|
||||
|
||||
test "greets the world" do
|
||||
# assert RlRepo.hello() == :world
|
||||
test "single template replace" do
|
||||
string = "~(replace)"
|
||||
placeholders = %{"replace" => "DONE"}
|
||||
|
||||
|
||||
|
||||
b = RlRepo.Template.test_template(string, placeholders)
|
||||
|
||||
|
||||
assert :world == :world
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue