Merge pull request #1541 from lightpanda-io/range_compare_boundary_points

Fix Range.compareBoundaryPoint
This commit is contained in:
Karl Seguin
2026-02-14 07:01:52 +08:00
committed by GitHub
2 changed files with 16 additions and 16 deletions

View File

@@ -743,11 +743,11 @@
// range1 start is before range2 start // range1 start is before range2 start
testing.expectEqual(-1, range1.compareBoundaryPoints(Range.START_TO_START, range2)); testing.expectEqual(-1, range1.compareBoundaryPoints(Range.START_TO_START, range2));
// range1 start is before range2 end
testing.expectEqual(-1, range1.compareBoundaryPoints(Range.START_TO_END, range2));
// range1 end is after range2 start // range1 end is after range2 start
testing.expectEqual(1, range1.compareBoundaryPoints(Range.END_TO_START, range2)); testing.expectEqual(1, range1.compareBoundaryPoints(Range.START_TO_END, range2));
// range1 start is before range2 end
testing.expectEqual(-1, range1.compareBoundaryPoints(Range.END_TO_START, range2));
// range1 end is before range2 end // range1 end is before range2 end
testing.expectEqual(-1, range1.compareBoundaryPoints(Range.END_TO_END, range2)); testing.expectEqual(-1, range1.compareBoundaryPoints(Range.END_TO_END, range2));
@@ -767,11 +767,11 @@
testing.expectEqual(0, range.compareBoundaryPoints(Range.START_TO_START, range)); testing.expectEqual(0, range.compareBoundaryPoints(Range.START_TO_START, range));
testing.expectEqual(0, range.compareBoundaryPoints(Range.END_TO_END, range)); testing.expectEqual(0, range.compareBoundaryPoints(Range.END_TO_END, range));
// Start is before end
testing.expectEqual(-1, range.compareBoundaryPoints(Range.START_TO_END, range));
// End is after start // End is after start
testing.expectEqual(1, range.compareBoundaryPoints(Range.END_TO_START, range)); testing.expectEqual(1, range.compareBoundaryPoints(Range.START_TO_END, range));
// Start is before end
testing.expectEqual(-1, range.compareBoundaryPoints(Range.END_TO_START, range));
} }
</script> </script>

View File

@@ -150,10 +150,10 @@ pub fn compareBoundaryPoints(self: *const Range, how_raw: i32, source_range: *co
source_range._proto._start_offset, source_range._proto._start_offset,
), ),
1 => AbstractRange.compareBoundaryPoints( // START_TO_END 1 => AbstractRange.compareBoundaryPoints( // START_TO_END
self._proto._start_container, self._proto._end_container,
self._proto._start_offset, self._proto._end_offset,
source_range._proto._end_container, source_range._proto._start_container,
source_range._proto._end_offset, source_range._proto._start_offset,
), ),
2 => AbstractRange.compareBoundaryPoints( // END_TO_END 2 => AbstractRange.compareBoundaryPoints( // END_TO_END
self._proto._end_container, self._proto._end_container,
@@ -162,10 +162,10 @@ pub fn compareBoundaryPoints(self: *const Range, how_raw: i32, source_range: *co
source_range._proto._end_offset, source_range._proto._end_offset,
), ),
3 => AbstractRange.compareBoundaryPoints( // END_TO_START 3 => AbstractRange.compareBoundaryPoints( // END_TO_START
self._proto._end_container, self._proto._start_container,
self._proto._end_offset, self._proto._start_offset,
source_range._proto._start_container, source_range._proto._end_container,
source_range._proto._start_offset, source_range._proto._end_offset,
), ),
else => unreachable, else => unreachable,
}; };