Skip to content

Commit bfa099c

Browse files
committed
add test for multiple template strings
1 parent 58d95c3 commit bfa099c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/file.bats

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,22 @@ load "test-helper"
238238

239239
rm -f "$tmp_file"
240240
}
241+
242+
@test "file_fill_template non empty file, replace multiple" {
243+
local -r tmp_file=$(mktemp)
244+
local -a auto_fill=("<__PLACEHOLDER__>=hello")
245+
auto_fill+=("<__PLACEHOLDER2__>=foo")
246+
247+
local -r file_contents=$(echo -e "abc\n<__PLACEHOLDER__> world\n<__PLACEHOLDER2__> baz")
248+
249+
echo "$file_contents" > "$tmp_file"
250+
251+
run file_fill_template "$tmp_file" "${auto_fill[@]}"
252+
assert_success
253+
254+
local -r actual=$(cat "$tmp_file")
255+
local -r expected=$(echo -e "abc\nhello world\nfoo baz")
256+
assert_equal "$expected" "$actual"
257+
258+
rm -f "$tmp_file"
259+
}

0 commit comments

Comments
 (0)