Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

~ not remove whitespaces when using with else if block #48

Open
DanielLiu1123 opened this issue Sep 15, 2024 · 0 comments
Open

~ not remove whitespaces when using with else if block #48

DanielLiu1123 opened this issue Sep 15, 2024 · 0 comments

Comments

@DanielLiu1123
Copy link

When use else if block, ~ seems not remove whitespaces.

func TestElseIf(t *testing.T) {
	source := `
{{~#if a ~}}
	A
{{~else if b ~}}
	B
{{~else~}}
	C
{{~/if~}}`

	tpl, _ := Parse(source)

	result, _ := tpl.Exec(map[string]interface{}{"a": true})

	if result != "A" {
		t.Errorf("Expected 'A', got '%s'", result)
	}
}
Expected 'A', got 'A
        '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant