reconcile/tests/examples
2025-07-05 10:13:51 +01:00
..
deletes.yml Add mergeTextWithHistory function 2025-06-22 20:49:11 +01:00
deletes_and_inserts.yml Merge crates 2025-06-15 11:30:07 +01:00
idempotent_inserts.yml Merge crates 2025-06-15 11:30:07 +01:00
multiline.yml Merge crates 2025-06-15 11:30:07 +01:00
README.md Generate docs 2025-07-05 10:13:51 +01:00
replacing.yml Fix cursors 2025-06-22 13:06:36 +01:00
utf-8.yml Merge crates 2025-06-15 11:30:07 +01:00
various.yml Fix wrapping 2025-07-04 02:16:17 +01:00

Test Examples

This directory contains YAML test cases that demonstrate various reconcile scenarios.

Format

Each YAML file contains test documents with the following structure:

parent: "Original text"
left: 
  text: "Left version"
  cursors:
    - id: 1
      char_index: 5
right:
  text: "Right version"  
  cursors:
    - id: 2
      char_index: 10
expected:
  text: "Expected result"
  cursors:
    - id: 1
      char_index: 8
    - id: 2
      char_index: 12

Cursor Position Notation

In some test cases, the | character is used to denote cursor positions within the text. These characters are stripped before the actual reconcile logic is run, making it easier to visualize where cursors should be positioned.

Running Tests

These examples are automatically tested as part of the test suite:

cargo test

The tests verify that:

  1. Text is merged correctly without conflicts
  2. Cursor positions are updated accurately
  3. The merge result is consistent regardless of argument order (left/right swap)