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

Avoid using keywords for arguments in TestHelpers #1084

Merged
merged 4 commits into from Mar 1, 2017

Conversation

tchssk
Copy link
Member

@tchssk tchssk commented Feb 28, 2017

Fix #1083.

@tchssk
Copy link
Member Author

tchssk commented Mar 1, 2017

It might be better not to use local variables in the test helper functions.

Copy link
Member

@raphael raphael left a comment

Choose a reason for hiding this comment

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

Thank you, this is a lot of work! I think we should go ahead and merge this once you have done the changes suggested in the code review. I agree that there may be a better approach for the generic case (maybe local variables should all have __ prefix or something like that).

@@ -218,6 +222,36 @@ func (g *Generator) createTestMethod(resource *design.ResourceDefinition, action
}
}

var arguments map[string]bool

This comment was marked as off-topic.

funcs := template.FuncMap{"isSlice": isSlice}
funcs := template.FuncMap{
"isSlice": isSlice,
"initArguments": initArguments,

This comment was marked as off-topic.

funcs := template.FuncMap{
"isSlice": isSlice,
"initArguments": initArguments,
"tempvar": tempvar,

This comment was marked as off-topic.

@tchssk
Copy link
Member Author

tchssk commented Mar 1, 2017

Thank you for your great review.

I added a new commit fixing the matters.

@tchssk
Copy link
Member Author

tchssk commented Mar 1, 2017

Now local variables use _ as suffix. Should we use prefix instead of suffix?

Copy link
Member

@raphael raphael left a comment

Choose a reason for hiding this comment

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

Thank you for applying the changes! one last suggestion in the code review.

"initArguments": initArguments,
"tempvar": tempvar,
"isSlice": isSlice,
"escape": escape,

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@raphael
Copy link
Member

raphael commented Mar 1, 2017

Using a suffix is fine too.

@raphael
Copy link
Member

raphael commented Mar 1, 2017

Thank you!

@raphael raphael merged commit 41ba6d4 into goadesign:master Mar 1, 2017
raphael pushed a commit that referenced this pull request Mar 1, 2017
* Avoid using variables name same with arguments

in TestHelpers.

* Add reservedNames in TestMethod

* Add Escape() to TestMethod

* Use prefix instead of suffix in Escape()
raphael pushed a commit that referenced this pull request Mar 1, 2017
* Avoid using variables name same with arguments

in TestHelpers.

* Add reservedNames in TestMethod

* Add Escape() to TestMethod

* Use prefix instead of suffix in Escape()
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

Successfully merging this pull request may close these issues.

None yet

2 participants