-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Normalize line separators for .txt files (fix Windows tests) #3488
Conversation
I still don't understand how to force |
Have you tried: git config --global core.autocrlf false |
Yes, I've tried with no effect. Ok, I'll restore line separators processing and replace line separators tests with handwritten tests. |
Oh sorry. didn't see this yet, @KvanTTT (Just emailed you). |
Yes, I'm working on it. |
1e94a77
to
bfb7efc
Compare
@parrt the fix is ready. |
import java.util.List; | ||
|
||
public class ExtraTests { | ||
public static RuntimeTestDescriptor[] getRuntimeTestDescriptors(String targetName) { |
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.
These tests are useful. We can write here test for generated and very large grammars. For instance, LargeLexer.txt can be moved here.
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.
Why not include LargeLexer etc... in main section?
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.
Can you remind me what the purpose is for a new file ExtraTests.java ?
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.
Is it only way to distinguish \r\n from \n tests?
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.
Why not include LargeLexer etc... in main section?
Because it contains a lot of duplicated lines. It can be replaced by a short and clear test with several lines (also, it's possible to vary the number of tokens and other parameters).
Is it only way to distinguish \r\n from \n tests?
For now yes. But I'm working on #1863 and other related bugs that also require big tests that ideally should be generated.
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'll try to think about this today. One first thought. We don't need the regex anymore if we use \n. split works great and is much easier to understand. Also means less change to existing code in a PR.
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.
Ok, I'll remove regex. Definitely, now it does not make sense since we have other tests for line endings checking.
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.
Done. Please don't squash my commits since they are logically different.
Also, in the future, we can use use fixup!
commits for easier changes review. Before the final PR merge, all !fixup
are being merged to original commits for clear history. I mean !fixup Change something
is being merged to Change something
.
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.
hi. the fixup thing might be hard for me to remember and complicate my life ;)
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.
Ok. I just always use interactive rebase in IDEA and never have troubles :)
return result; | ||
} | ||
|
||
static RuntimeTestDescriptor getLargeLexerDescriptor(String targetName) { |
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.
Ok, I've moved LargeLexer
in the current PR for the demo.
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.
Ok. Yeah, I'm still thinking we are making a big departure from the point of descriptor files to solve this \r\n thing. Seems we're off the road to shove in a test case for a tiny fraction of the number of tests
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 have yet another generated test getAtnStatesSizeMoreThan65535Descriptor
in another PR. It's too excess to use yet another big file with uniform data. Output data is also being generated.
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 see. yes, starting to make sense to me for generated examples.
9021548
to
905001b
Compare
Ok, looking good now in my mind except that we've so far tried to group tests now by area like lexing, parsing. Instead of adding new TestExtra, shouldn't we add the new tests to TestLexer or whatever? |
Ok, maybe it makes sense. I just didn't want to mix descriptor and handwritten tests but probably it does not matter. |
yeah, probably better to mix gen vs files to keep test topics/areas the same. This way we can also avoid adding new TestX.java file |
Seems github is hosed. This times out in actions: |
…s (LineSeparatorLf, LineSeparatorCrLf)
905001b
to
40ebc46
Compare
Indeed, much fewer changes.
That's probably a problem with self-hosted CI again. I see the following:
|
@ericvergnaud does the antlr data center look ok from your side? Any network issues? thanks! |
@@ -367,6 +366,13 @@ public static ErrorQueue antlrOnString(String workdir, | |||
System.err.println("Can't read descriptor file "+fname); | |||
} | |||
} | |||
|
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 makes me kinda nervous but better than altering all target test files I guess.
@@ -0,0 +1,68 @@ | |||
package org.antlr.v4.test.runtime; | |||
|
|||
public class ExtraTests { |
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 to be fussy but "Extra" isn't very specific. Maybe "GeneratedTests" or even "GeneratedLexerDescriptors"?
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'll merge then think/tweak of name
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.
Yes, but I haven't found a better name. Generated is also not very correct since it contains line separator tests. Maybe handwritten or something like this.
Thanks for the hard work, @KvanTTT ! |
No apparent issue here, some builds are successful. |
No description provided.