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

hugolib: Allow arrays of arrays in frontmatter Params #2841

Merged
merged 1 commit into from Jan 6, 2017

Conversation

moorereason
Copy link
Contributor

Fixes #2752

@moorereason moorereason added this to the v0.19 milestone Dec 29, 2016
// Page Params
pages := sites.findAllPagesByKind(KindPage)
for _, p := range pages {
if p.Path() == "sect1/regular1.en.md" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure the above is truthful on Windows?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, when you need to add an import to get to the assert package, you by definition is breaking the standard set in the file. I think the require package is suitable in most situations. If something fails, it is bad and I want it to stop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, and I know I have been a sinner in area, adding more test cases to an existing very broad test to test for a very specific thing smells a little. I think we have narrower unit-typish tests for these params conversions -- and if not, we should.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Good catch. I need to use filepath.Join.

  2. I didn't notice your standard. Apparently, I have a different standard. 😁 I use assert where I would use t.Errorf and require where I would use t.Fatalf. I only use Fatalf/require to avoid accessing nil pointers and such in subsequent tests. So, when I use require, it's a signal to me that we've got a serious problem. If a Test func contains numerous assertions, I like to see them all fail instead of just the first one. With require I'd only see the first failured assertion. If you don't like my reasoning, I'll change to require in this file.

  3. I agree, but I was trying to follow your lead. 😀 Sometimes I'm not quite sure how to setup all the site scaffolding to run a simple unit test. I'll take another look at the tests in this PR to see if I can pull them out into a more narrow test.

Copy link
Member

@bep bep Jan 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node_as_page_test was something I built to be able to move from node to page, and is a little bit of everything, and I was thinking of maybe remove it, or move the tests.

Testing TOML to interface{} conversions sounds like a job for a unit test.

As to require: If you have one failing test, you have a serious problem by (my) definition -- and fixing that one test is usually enough to fix any tests that come after it. But up to you, my point was: If there are 100 require in a test file, then adding one single assert is at least breaking a pattern.

@bep bep merged commit 3d058a9 into gohugoio:master Jan 6, 2017
@moorereason moorereason deleted the iss2752 branch March 1, 2017 15:34
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TOML array not parsed
2 participants