mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
chore(template): add test cases to cleanTemplate
This commit is contained in:
parent
077e538500
commit
1e597a7c51
|
@ -310,10 +310,21 @@ func TestCleanTemplate(t *testing.T) {
|
|||
Expected: "{{ if or (.Data.Working.Changed) (.Data.Staging.Changed) }}#FF9248{{ end }}",
|
||||
Template: "{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}",
|
||||
},
|
||||
{
|
||||
Case: "Global property override",
|
||||
Expected: "{{.OS}}",
|
||||
Template: "{{.$.OS}}",
|
||||
},
|
||||
{
|
||||
Case: "Local property override",
|
||||
Expected: "{{.Data.OS}}",
|
||||
Template: "{{.OS}}",
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tmpl := &Text{
|
||||
Template: tc.Template,
|
||||
Context: map[string]interface{}{"OS": "posh"},
|
||||
}
|
||||
tmpl.cleanTemplate()
|
||||
assert.Equal(t, tc.Expected, tmpl.Template, tc.Case)
|
||||
|
|
Loading…
Reference in a new issue