-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
InvalidBehaviorA valid or not valid code has an invalid behavior at runtimeA valid or not valid code has an invalid behavior at runtimebugBug: something already implemented does not work as it shouldBug: something already implemented does not work as it shouldneedsInvestigationNeed to investigateNeed to investigatetemplatesRelated to the templateRelated to the template
Description
Description
The swapping of the first and the second elements of a slice, which is assigned to a field of a struct of a (global) slice element, generates an invalid behavior.
How to reproduce
Add this test to test/misc/templates_test.go
:
"https://github.com/open2b/scriggo/issues/945": {
sources: fstest.Files{
"index.txt": `
{%%
for item in items {
item.Options[0], item.Options[1] = item.Options[1], item.Options[0]
show item.Options[0].Name, ",", item.Options[1].Name
}
%%}
`,
},
main: native.Package{
Name: "main",
Declarations: native.Declarations{
"items": &[]struct {
Options []struct {
Name string
}
}{
{Options: []struct{ Name string }{
{Name: "first-option"},
{Name: "second-option"},
}},
},
},
},
expectedOut: "\nsecond-option,first-option\t\t\t",
},
Metadata
Metadata
Assignees
Labels
InvalidBehaviorA valid or not valid code has an invalid behavior at runtimeA valid or not valid code has an invalid behavior at runtimebugBug: something already implemented does not work as it shouldBug: something already implemented does not work as it shouldneedsInvestigationNeed to investigateNeed to investigatetemplatesRelated to the templateRelated to the template