-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add test file #5
base: master
Are you sure you want to change the base?
Conversation
Do you think we can construct some actual tests that run on CI? |
Sure, I'd love to look into that! Though I have never set up CI.
... would be parsed as an identifier. That is also why I think a proper parser would be more useful. I have thought about writing one for Universal Ctags that would be more sophisticated than the current one but it would take some time. Guess the tests failing would be the exact thing we want until then. :) |
I think easiest would be to setup CI for julia and write the tests in julia, Then you could do You can copy the .travisci from any julia project to do that. |
If you write the tests, so you can run them locally |
How would you go about using the external Universal Ctags? They don't have release tags and the binary name may be hard to find due to name overlaps with Exuberant Ctags or Etags. Or should I just write, try and see using
Thanks, but I'd actually be glad to learn by doing! |
Can't we just use Exuberant Ctags ? |
You are absolutely right and I see why naming is no problem. I added the tests and Travis CI, hope you are content with the code. Broken features are marked depending on the identifier name or the "kind" (function, variable, struct, ...). The tests will fail now because I based them on the updated ctags file (#4). |
Hey, the build keeps being stuck on "Resolving package versions..." when testing. I couldn't find any other reports via searching and have checked out other |
Do your tests work fine locally? |
Yes, I tested just now with:
And it worked fine. Though as I mentioned, if the tests ran in Travis, they would fail because I based them on the new Edit: |
Sorry to spam; after trying a lot, I still haven't figured out how to remove those duplicate commits from |
I tried your PR at my own machine and it gets stuck in an endless loop because none of the predefined ctags executables worked. The same probably happens to Travis. You probably should make sure that |
I'm not sure how much packaging you want to do with this but you could always provide a ctags build if one wasn't found either with BinaryProvider.jl or with the Anaconda Ctags package using Conda.jl. If you go this route you would probably want to make this into a proper julia package. |
That wouldn't really make sense. |
Not really. It can be passed in as an option to the |
When you do |
@oxinabox I created a pull request #6 to package julia-ctags into In addition, optionally providing a |
Hey Karl, thank you so much for finding that. I actually hadn't forgotten this PR but due to the CI failing and me being so ashamed of the test code (it doesn't seem "right" at all), I never cared finishing it... Sorry! 😅 I will fix it later so #6 can be merged as well. By the way, I also wrote an Etags file for use with the Emacs-internal tags engine. Do you want it in the repo as well? |
Correspondingly, add the generated "tags" file to .gitignore. I tried to add "actual code" and have too many tests rather than only complex ones. Surely, some cases are not covered. For example, using multiple macros for a definition.
Many tests are still marked as broken. The test/testtags file contains the desired tags to obtain. Some need only a little work, some need a more complete parser than the current argument-regex-based approach. We could possibly use the master of Universal Ctags for MacOS but that would introduce another error surface.
Sorry it took so long. I also remembered why I didn't add the |
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.
Thanks for taking the time to write those tests! I added a few comments on the current commit.
|
||
"Ctags binaries to sequentially try to call if one is not found." | ||
const ctagsbins = ( | ||
"uctags", |
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.
You should change the order of the possible tag command in such a way that the tag command available at your own system is last in the list. This way your make sure that you test the error case of the trygeneratetags
method.
It would probably also be a good idea to only add those tag binaries to the list for which you can actually execute the tests. It is better to have a short but testes list of binaries then a complete but untested list.
People using binaries not in the list can then add their binary to the list them self, see if the test work and create an according PR or issue if necessary.
return generatetags(testfile, ctagsbinary) | ||
catch e | ||
# For compatibility accept either exception type. | ||
if !(err isa LoadError || err isa ErrorException |
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.
For uctags the generatetags
method failed with a Base.IOError
instead of a LoadError
(although from the printed error message it looked like a LoadError
), so you should add that one to the list of 'acceptable' error.
I'm not sure if adding LoadError
to the list of acceptable Exceptions is necessary. At least for my setup none of the failing tag binaries did throw an actual LoadError
.
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.
I expected ProcessFailedException
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.
Sorry, I was busy when pushing and didn't test. I'll be sure to fix it, thanks again, Karl!
I actually can't remember why I included the LoadError
(should have documented that one) but I'm sure it's there for a reason. Maybe I can replicate it again. But yeah if the IOError
looked like a LoadError
that may be the reason.
Hey Lyndon, that one's listed one line below, you can't see it in the diff.
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.
ah cool cool
Correspondingly, add the generated "tags" file to .gitignore.
I tried to add "actual code" and have too many tests rather than only
complex ones.
Surely, some cases are not covered. For example, using multiple macros
for a definition.