v2 / vlib / v / tests / tmpl_with_single_quotes_test.v
25 lines · 20 sloc · 440 bytes · 94a36c5ca42f6ebeaddf3bf1b84840249aea0fe3
Raw
1pub struct SomeThing {
2pub:
3 m map[string]string
4}
5
6fn (s SomeThing) someval(what string) string {
7 return s.m[what]
8}
9
10fn (s SomeThing) template() string {
11 return $tmpl('tmpl/template.in')
12}
13
14fn test_tmpl_with_single_quotes() {
15 mut sm := map[string]string{}
16 sm['huh'] = 'monkey'
17 sm['hah'] = 'parrot'
18
19 s := SomeThing{sm}
20 result := s.template()
21 println(result)
22 assert result.trim_space() == 'someval: monkey
23
24someotherval: parrot'
25}
26