-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Fix WithTemplates(nil) function #400
base: main
Are you sure you want to change the base?
Conversation
Thanks! Maintainers never use Can you add a test with |
Also please that your tests pass by running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests
@EwenQuim sorry im not sure how to do this. Can you guide me please? |
func TestWithTemplateNilShouldPanic(...
fuego.NewServer(
fuego.WithTemplates(nil)
)
} This should raise an error when running
func TestWithTemplateNilShouldPanic(...
require.Panics(func() {
fuego.NewServer(
fuego.WithTemplates(nil)
)
}} |
Hey @sdil an exact example can be found here for this: https://github.com/go-fuego/fuego/blob/main/engine_test.go#L43. You can place it in this test here: https://github.com/go-fuego/fuego/blob/main/server_test.go#L178 😄 |
So I looked into this some. I'm not really understanding the reasoning for this approach? What is the need to pass |
Summary
Currently using
WithTemplates(nil)
gives me error like below because it cannot reference the template.Template object correctlyThis diff should fix the error and the error shouldn't be raised when the default directory
./templates
exists.