TEST: Attempt at making a test

This commit is contained in:
Able 2025-02-18 14:27:12 -06:00
parent 29b781a167
commit 78412a40a1
2 changed files with 28 additions and 2 deletions

View file

@ -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

View file

@ -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