-
Notifications
You must be signed in to change notification settings - Fork 39
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
Handle incomplete lines #22
base: master
Are you sure you want to change the base?
Conversation
…bergs#17, thombergs#20) - Incomplete marker lines are not parsed as NEUTRAL lines anymore, they are set as a flag on a Diff for either of the diff side instead. This is a potentially breaking change, so version bumped to 2.0. - TestNG used to pull in JUnit as a direct dependency, and test classes used to use a mixture of TestNG and JUnit assertions. This commit bumps TestNG to a recent 6.14.3 which doesn't have JUnit anymore, and adjusts the tests to use TestNG assertions only.
@@ -12,7 +12,7 @@ repositories { | |||
} | |||
|
|||
// run gradle with "-Dsnapshot=true" to automatically append "-SNAPSHOT" to the version | |||
version = '1.5' + (Boolean.valueOf(System.getProperty("snapshot")) ? "-SNAPSHOT" : "") | |||
version = '2.0' + (Boolean.valueOf(System.getProperty("snapshot")) ? "-SNAPSHOT" : "") |
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 bumped the major version because the change to how incomplete line markers are parsed is a breaking change: consumers might've handled them in some way already.
@@ -24,7 +24,7 @@ ext{ | |||
dependencies { | |||
compile('org.slf4j:slf4j-api:1.7.25') | |||
testCompile('org.slf4j:slf4j-log4j12:1.7.25') | |||
testCompile('org.testng:testng:6.8.7') | |||
testCompile('org.testng:testng:6.14.3') |
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.
TestNG used to pull in JUnit, and test classes were using a mix of assertion methods from both libraries.
This recent version fixed that, hence there're many import changes in the test classes.
import static org.testng.Assert.assertFalse; | ||
import static org.testng.Assert.assertNotNull; | ||
import static org.testng.Assert.assertTrue; | ||
import static org.testng.AssertJUnit.assertEquals; |
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.
The signature of .assertEquals()
in TestNG and JUnit differs: they accept "expected" and "actual" values in different order. I didn't want to change flip all the usages in this PR too, so for now used this adapting method.
*/ | ||
public class SvnDiffTest { | ||
|
||
@Test | ||
public void testParse() throws Exception { |
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 removed unused declarations along the way, since I touched most of the test classes content anyway.
@@ -64,22 +68,22 @@ public void testParse_WhenHunkRangeLineCountNotSpecified_ShouldSetHunkRangeLineC | |||
+ "\n"; | |||
|
|||
// when | |||
List<Diff> diffs = parser.parse(in.getBytes()); | |||
List<Diff> diffs = parser.parse(in.getBytes(StandardCharsets.UTF_8)); |
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.
It is generally unsafe to call .getBytes()
without specifying a charset, so I declared UTF-8 everywhere.
Sorry for a bit of a mess, there seems no way to make a cross-repo stacked pull request on GitHub, so this PR also contains a commit form my previous PR.
Please either review and merge the other one first, so that this one becomes smaller, or just review the second commit here.
Please advise if there's a better way to organise this.
There're two changes in the second commit:
Incomplete marker lines are not parsed as NEUTRAL lines anymore, they are set as a flag on a Diff for either of the diff side instead. This is a potentially breaking change, so version bumped to 2.0.
TestNG used to pull in JUnit as a direct dependency, and test classes used to use a mixture of TestNG and JUnit assertions. This commit bumps TestNG to a recent 6.14.3 which doesn't have JUnit anymore, and adjusts the tests to use TestNG assertions only.