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

Annotate private to spec methods/classes more #3892

Merged
merged 1 commit into from Jan 17, 2017

Conversation

makenowjust
Copy link
Contributor

Crystal supports file private methods and classes. This pull request apply private annotation to methods or classes in spec files.

Copy link
Member

@bcardiff bcardiff left a comment

Choose a reason for hiding this comment

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

All the cleanup are fine, but I made I comment regarding the changed requires. Thanks!

@@ -1,26 +1,24 @@
require "spec"
require "yaml"
require "../../../../src/compiler/crystal/**"
Copy link
Member

Choose a reason for hiding this comment

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

using relative paths allow testing the code of the compiler without building the compiler.
if we keep the require "compiler/crystal/**" the code that will be tested is the one in the compiler used to build the specs.

I would leave the require "../../.. ...." since it allows more unit test like of the compiler.

Checking in the code, I notice that it could be replaced with require "../../spec_helper" But maybe that could be handle in another PR and just leave this for enforcing the private methods/classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure that's incorrect. The bin/crystal wrapper should edit the load path so that any part of the stdlib is loaded from the git repo, not the distribution. There's nothing special about the compiler requires.

Copy link
Member

Choose a reason for hiding this comment

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

@RX14 My comment applies when you do $ crystal spec spec/compiler/.../. i.e. no bin/crystal wrapper is called.

At least for a DRY about relative vs crystal path we should change this to require spec_helper. But again that is not about adding private to methods and classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bcardiff as far as i'm concerned we shouldn't be supporting not using bin/crystal. All the specs for the stdlib use non-relative requires, so I don't see why the compiler should be special.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bcardiff @RX14 I'll fix to use require "../../../spec_helper" instead of require "compiler/crystal/**" because other compiler's spec uses it. (And spec/spec_helper.cr requires compiler files with relative path. If you want to fix it, please open another pull request or issue.)

Copy link
Member

Choose a reason for hiding this comment

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

@RX14 you are probably right and things might be as they are because of evolution only and could be changed. There is no point in using bundled stdlib with compiler with current master code.

@asterite
Copy link
Member

  • 👍 for adding private
  • 👎 for removing include Crystal in top-level, it makes code so much verbose

@makenowjust
Copy link
Contributor Author

@asterite Ok. I updated to use spec_helper.cr instead of compiler/crystal/**, and it has include Crystal.

@bcardiff
Copy link
Member

Thanks @makenowjust . I think there where some tools specs you cleaned up removing whitespaces. I see those changes gone now. I miss why they where changed in the first place, maybe that will come up later, but if you have those change around, may I ask you the reason for those changes?

@bcardiff bcardiff merged commit 1b97c99 into crystal-lang:master Jan 17, 2017
@bcardiff bcardiff added this to the Next milestone Jan 17, 2017
@makenowjust makenowjust deleted the fix/specs/more-private branch January 17, 2017 17:44
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

4 participants