Skip to content

Commit

Permalink
[fix] Detect conflict markers in double quotes, fix #122
Browse files Browse the repository at this point in the history
  • Loading branch information
slarse committed May 16, 2020
1 parent 832202d commit d972722
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,12 @@ public SporkPrinterHelper write(String s) {
//
// All we need to do here is the decrease tabs and enter some appropriate whitespace
writelnIfNotPresent().writeAtLeftMargin(s).writeln();
return this;
}
if (globalContentConflicts.containsKey(s)) {
Pair<String, String> conflict = globalContentConflicts.get(s);

String strippedQuotes = trimmed.replaceAll("\"", "");
if (globalContentConflicts.containsKey(strippedQuotes)) {
Pair<String, String> conflict = globalContentConflicts.get(strippedQuotes);
writeConflict(conflict.first, conflict.second);
} else if (localConflictMap.isPresent() && localConflictMap.get().containsKey(s)) {
Pair<String, String> conflict = localConflictMap.get().get(s);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Main {
int calcNumber() {
return 1 + 2 + 3;
}
}
11 changes: 11 additions & 0 deletions src/test/resources/conflict/integer_literal_conflict/Expected.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Main {
int calcNumber() {
return 1 + 2 +
<<<<<<< LEFT
99
=======
102
>>>>>>> RIGHT
;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Main {
int calcNumber() {
return 1 + 2 + 99;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Main {
int calcNumber() {
return 1 + 2 + 102;
}
}

0 comments on commit d972722

Please sign in to comment.