-
Notifications
You must be signed in to change notification settings - Fork 83
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
Comment shebang line before passing to tokenizer #437
Conversation
Wondering if we can implement a test for this. |
Ohhh yeah.. good point! |
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.
This fix seems to be good enough
@Mte90 I think that this was my fault. I forgot that this would alter the size of the output file. |
if code.starts_with("#!") { | ||
code.split('\n').skip(1).collect_vec().join("\n") | ||
String::from("// ") + &code |
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.
Actually... can we replace shebang with an empty line? The comments can now persist in the generated bash file: #403
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.
We could, but wouldn't it be better to show that there was a shebang in the input file, for debugging purposes?
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.
Okay let's leave it as a comment then
Just a small tweak so that we output a cleaner bash code |
I'm not sure that's going to work without changes to the test framework, as it does not currently appear to capture standard error:
|
Good point, we need something for that. What do you think @Ph0enixKM @b1ek |
Let's not bother testing formatting of errors just yet. Unless someone wants to implement them ofc. There are some more important things to be done now |
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.
Looks good! Thanks for your help 🙏
@Mte90 that can be done with how we already validate the tests in I think that we should create error codes for different errors. This way we could just check which error code was triggered instead of checking the error message which could change anytime. I'll create issue for this |
Fixes #435.