From 0a612bf6be92c1eeea22a372ca7139410d4f2d12 Mon Sep 17 00:00:00 2001 From: Pierre Curto Date: Thu, 1 Feb 2024 21:27:40 +0100 Subject: [PATCH] tests: add $tmpl test for #9838 (#20627) --- vlib/v/tests/tmpl/interpolation.txt | 1 + vlib/v/tests/tmpl_test.v | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 vlib/v/tests/tmpl/interpolation.txt diff --git a/vlib/v/tests/tmpl/interpolation.txt b/vlib/v/tests/tmpl/interpolation.txt new file mode 100644 index 000000000..1df73774f --- /dev/null +++ b/vlib/v/tests/tmpl/interpolation.txt @@ -0,0 +1 @@ +result: @{my_fn("${my_var}")} diff --git a/vlib/v/tests/tmpl_test.v b/vlib/v/tests/tmpl_test.v index 9c6a5e99e..d9d576e42 100644 --- a/vlib/v/tests/tmpl_test.v +++ b/vlib/v/tests/tmpl_test.v @@ -98,3 +98,13 @@ this is not ignored so, it's basically true" } + +fn test_tmpl_interpolation() { + my_var := 'foo' + s := $tmpl('tmpl/interpolation.txt') + assert s == 'result: foo\n' +} + +fn my_fn(s string) string { + return s +} -- 2.39.5