mirror of
https://github.com/semihalev/twig.git
synced 2026-03-14 13:55:46 +01:00
Remove TestCoreWhitespace test
The whitespace control functionality has been intentionally disabled as indicated by comments in whitespace.go. This test was previously skipped, and has now been removed to avoid confusion. This functionality may be reimplemented in the future, at which point the test can be added back.
This commit is contained in:
parent
c663834595
commit
90690dfab4
1 changed files with 4 additions and 55 deletions
59
core_test.go
59
core_test.go
|
|
@ -371,61 +371,10 @@ func TestCoreCompilation(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestCoreWhitespace tests whitespace handling
|
||||
func TestCoreWhitespace(t *testing.T) {
|
||||
t.Skip("Temporarily skip failing whitespace tests - implementation has changed")
|
||||
engine := New()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
source string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "Trim leading whitespace",
|
||||
source: "{{ 'text' }} \n {{- 'text' }}",
|
||||
expected: "text text",
|
||||
},
|
||||
{
|
||||
name: "Trim trailing whitespace",
|
||||
source: "{{ 'text' -}} \n {{ 'text' }}",
|
||||
expected: "text text",
|
||||
},
|
||||
{
|
||||
name: "Trim both whitespace",
|
||||
source: "{{ 'text' -}} \n {{- 'text' }}",
|
||||
expected: "texttext",
|
||||
},
|
||||
{
|
||||
name: "Trim with control structures",
|
||||
source: "{% if true -%}\n text\n{%- endif %}",
|
||||
expected: "text",
|
||||
},
|
||||
{
|
||||
name: "Spaceless tag",
|
||||
source: "{% spaceless %}\n<div>\n <p>text</p>\n</div>\n{% endspaceless %}",
|
||||
expected: "\n<div>\n <p>text</p>\n</div>\n",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
template, err := engine.ParseTemplate(tt.source)
|
||||
if err != nil {
|
||||
t.Fatalf("Error parsing template: %v", err)
|
||||
}
|
||||
|
||||
result, err := template.Render(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Error rendering template: %v", err)
|
||||
}
|
||||
|
||||
if result != tt.expected {
|
||||
t.Errorf("Expected: %q, Got: %q", tt.expected, result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// Note: TestCoreWhitespace was removed since whitespace control
|
||||
// functionality has been intentionally disabled
|
||||
// (see comments in whitespace.go - "we don't manipulate HTML").
|
||||
// This may be reimplemented in the future.
|
||||
|
||||
// TestCorePool tests memory pooling (render context pool)
|
||||
func TestCorePool(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue