Merge crates

This commit is contained in:
Andras Schmelczer 2025-06-15 11:30:07 +01:00
parent 82e77eec89
commit bcbac03228
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
60 changed files with 73 additions and 248 deletions

1
tests/examples/README.md Normal file
View file

@ -0,0 +1 @@
The `|` characters denote cursor positions which are stripped before the actual reconcile logic is run

View file

@ -0,0 +1,31 @@
# Both delete the same range
parent: original_1 original_2 original_3 original_4 original_5
left: original_1 original_5|
right: "|original_1 original_5"
expected: "|original_1 original_5|"
---
# Both delete a range and one range contains the other
parent: original_1 original_2 original_3 original_4 original_5
left: original_1 original_5
right: original_1 original_4 original_5
expected: original_1 original_5
---
# Deleting overlapping ranges
parent: original_1 original_2 original_3 original_4 original_5
left: original_1 original_4| original_5
right: original_1 original_2| original_5
expected: original_1|| original_5
---
parent: long text with one big delete and many small
left: long small
right: long with big and small
expected: long small
---
parent: long text where the cursor has to be clamped after delete
left: long text where the cursor has to be clamped after delete|
right: long text where the cursor
expected: long text where the cursor|

View file

@ -0,0 +1,12 @@
# One deleted a large range, the other deleted subranges and inserted as well
parent: original_1 original_2 original_3 original_4 original_5
left: original_1 original_5
right: original_1 edit_1 original_3 edit_2 original_5
expected: original_1 edit_1 edit_2 original_5
---
# One deleted a large range, the other inserted and deleted a partially overlapping range
parent: original_1 original_2 original_3 original_4 original_5
left: original_1 original_5
right: original_1 edit_1 original_3 edit_2
expected: original_1 edit_1 edit_2

View file

@ -0,0 +1,24 @@
# Both inserted the same prefix; this should get deduplicateed
parent: "hi "
left: "hi there "
right: "hi there my friend "
expected: "hi there my friend "
---
# The prefix of the 2nd appears on the 1st so it shouldn't get duplicatelicated
parent: "hi "
left: "hi there you "
right: "hi there my friend "
expected: "hi there my friend you "
---
parent: a
left: a b c
right: a b c d
expected: a b c d
---
parent: a
left: abc
right: abcd
expected: abcabcd

View file

@ -0,0 +1,63 @@
parent: Hello!
left: |
Hello there!
How are you?
right: |
Hello there!
Best,
Andras
expected: |
Hello there!
Best,
Andras
How are you?
---
parent: |
- my list
- 2nd item
- 3rd item
left: |
- my list
- 2nd item
- nested list
- very nested list
- 3rd item
right: |
- my list
- nested list
- 2nd item
- 3rd item
- another nested list
expected: |
- my list
- nested list
- 2nd item
- nested list
- very nested list
- 3rd item
- another nested list
---
parent: |
a
a
left: |
a|
a
right: |
a|
a
expected: |
a||
a

View file

@ -0,0 +1,19 @@
# Both replaced one token but the tokens are different
parent: original_1 original_2 original_3
left: original_1 edit_1| original_3
right: original_1 original_2| edit_2
expected: original_1 edit_1|| edit_2
---
# Both replace the same token with the same value
parent: original_1 original_2 original_3
left: original_1 edit_1| original_3
right: original_1 edit_1 original_3|
expected: original_1 edit_1| original_3|
---
# Both replace the same token with different value
parent: original_1 original_2 original_3
left: original_1 edit_1| original_3
right: original_1 conflicting_edit_1| original_3
expected: original_1 conflicting_edit_1| edit_1| original_3

10
tests/examples/utf-8.yml Normal file
View file

@ -0,0 +1,10 @@
parent: Meeting at 2pm in 会议室
left: Meeting at |3pm in 会议室
right: Team meeting at 2pm in conference room|
expected: Team meeting at |3pm in conference room|
---
parent: " "
left: "it|s utf-8!"
right: " "
expected: "it|s utf-8!"

130
tests/examples/various.yml Normal file
View file

@ -0,0 +1,130 @@
parent: You're Annual Savings Statement is available in our online portal
left: Your| annual record is available in our online portal|
right: You're Annual Savings information| is available online
expected: Your| annual record information| is available online|
---
parent: Party A shall pay Party B
left: Party C shall pay Party B
right: Party A shall receive from Party B
expected: Party C shall receive from Party B
---
parent:
left: hi my friend|
right: hi there|
expected: hi my friend| there|
---
parent: ""
left: ""
right: ""
expected: ""
---
parent: ""
left: "|"
right: "|"
expected: "||"
---
parent: Buy milk and eggs
left: Buy organic milk| and eggs|
right: Buy milk and eggs| and bread
expected: Buy organic milk| and eggs|| and bread
---
parent: Send the report to the team
left: Send the |detailed report to the |entire |team
right: Send the |quarterly |detailed report to the team
expected: Send the |detailed |quarterly |detailed report to the |entire |team
---
parent: Ready, Set go
left: Ready! Set go|
right: Ready, Set, go!|
expected: Ready! Set, go!||
---
parent: "Total: $100"
left: "Total: |$150"
right: "Total: |€100"
expected: "Total: |$150 |€100"
---
parent: Start middle end
left: Start [important] middle end|
right: Start middle [critical] end|
expected: Start [important] middle [critical] end||
---
parent: marketplace
left: market| place
right: market|space
expected: market| placemarket|space
---
parent: A B C D
left: A X B D|
right: A B Y|
expected: A X B |Y|
---
parent: Please submit your assignment by Friday
left: Please submit your |completed |assignment by Friday
right: Please submit your assignment |online |by Friday
expected: Please submit your |completed |assignment |online |by Friday
---
parent: "a b "
left: "c d "
right: "a b c d "
expected: "c d c d "
---
parent: a b c d e
left: a e|
right: a c e|
expected: a e||
---
parent: a 0 1 2 b
left: a 0 1| 2 b
right: a b|
expected: a| b|
---
parent: a 0 1 2 b
left: "|a b"
right: "|a E 1 F b"
expected: "||a E F b"
---
parent: a this one delete b
left: a b|
right: a my one change b|
expected: a my change b||
---
parent: this stays, this is one big delete, don't touch this
left: this stays, don't touch this|
right: this stays, my one change, don't touch this|
expected: this stays, my change, don't touch this||
---
parent: 1 2 3 4 5 6
left: 1| 6
right: 1 2 4|
expected: 1||
---
parent: hello world
left: hi, world
right: hello my friend!
expected: hi, my friend!
---
parent: a a
left: a
right: a
expected: a