Skip to content

rs-parsepatch misses some diffs #92

@abpostelnicu

Description

@abpostelnicu

Assuming that variable path is a patch defined in the following python code:

import rs_parsepatch

patch = """
--- a/js/src/vm/Printer.cpp	2023-06-20 15:04:32.907323769 +0000
+++ b/js/src/vm/Printer.cpp	2023-06-20 15:05:18.491323769 +0000
@@ -52,7 +52,7 @@
 }

 bool GenericPrinter::put(mozilla::Span<const char16_t> str) {
-  for (char16_t c: str) {
+  for (char16_t c : str) {
     if (!putChar(c)) {
       return false;
     }
@@ -245,7 +245,7 @@
     return false;
   }

-  for (char16_t c: str) {
+  for (char16_t c : str) {
     MOZ_ASSERT(IsAsciiPrintable(c));
     *bp++ = char(c);
   }

--- a/js/src/vm/BytecodeUtil.cpp	2023-06-20 15:04:32.907323769 +0000
+++ b/js/src/vm/BytecodeUtil.cpp	2023-06-20 15:05:18.439323769 +0000
@@ -2308,9 +2308,7 @@
   MOZ_CRASH("No binding");
 }

-UniqueChars ExpressionDecompiler::getOutput() {
-  return sprinter.release();
-}
+UniqueChars ExpressionDecompiler::getOutput() { return sprinter.release(); }

 }  // anonymous namespace



"""

diffs = 0
for diff in rs_parsepatch.get_diffs(patch):
    diffs += 1
print(diffs)

Expected behaviour would be to have printed out 3 but in this case we have 2, which is wrong.
This has been tested and reproduced on the latest version: 0.3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions