test.org 39 KB

Overview

This document holds some examples of the behavior and features of the org-merge-driver.

to run this file, either do make check at the command line, or C-c C-c on the table.

Test Group test Oks Total Pct
Headlines heading_tests
Heading Movement heading_movement_tests
Text text_tests
Properties property_tests
Other Tests other_tests

Headlines (Basic)

Test Name test-name Result Notes
Adding Headings heading_add not ok
Removing Headings heading_remove not ok
Cookies heading_cookies
Matching Headings heading_match not ok
Multiple New Subheadings heading_multiple_new_sub
Parent Level Conflict heading_parent_level_conflict

<>

Adding Headings

Properly add new org-headings.

Ancestor

,* Basket ,** Green Apple ,*** Seed 2 ,** Red Apple ,*** Seed 1

Local

,* Basket ,** Green Apple ,*** Seed 1 ,*** Seed 2 ,** Red Apple ,*** Seed 1

Remote

,* Basket ,** Green Apple ,*** Seed 2 ,** Red Apple ,*** Seed 1 ,*** Seed 2

Expected Output

,* Basket ,** Green Apple ,*** Seed 1 ,*** Seed 2 ,** Red Apple ,*** Seed 1 ,*** Seed 2

Removing Headings

Properly remove new org-headings.

Ancestor

,* Basket ,** Green Apple ,*** Seed 1 ,*** Seed 2 ,** Red Apple ,*** Seed 1 ,*** Seed 2

Local

,* Basket ,** Green Apple ,*** Seed 1 ,*** Seed 2 ,** Red Apple ,*** Seed 1

Remote

,* Basket ,** Green Apple ,*** Seed 2 ,** Red Apple ,*** Seed 1 ,*** Seed 2

Expected Output

,* Basket ,** Green Apple ,*** Seed 2 ,** Red Apple ,*** Seed 1

Parent Level Conflict

Make sure that subheadings levels are properly set when a parent has a content conflict caused by updating the amount of stars operly remove new org-headings.

Ancestor

,* Basket ,** Green Apple ,**** Seed 1 ,*** Seed 2 ,**** Red Apple ,*** Seed 1

Local

,** Basket ,*** Green Apple ,***** Seed 1 ,**** Seed 2 ,***** Red Apple ,**** Seed 1

Remote

,*** Basket ,**** Green Apple ,****** Seed 1 ,***** Seed 2 ,****** Red Apple ,***** Seed 1

Expected Output

,>>>>>>> Updated ,** Basket ,======= ,*** Basket ,<<<<<<< Updated ,**** Green Apple ,****** Seed 1 ,***** Seed 2 ,****** Red Apple ,***** Seed 1

Heading IDs

Ancestor

,* Matching ID Headings ,* Changing the order of headings ,** heading 1 ,:PROPERTIES: ,:ID: 1 ,:END: ,** heading 2 ,:PROPERTIES: ,:ID: 222 ,:END: ,*** sub heading ,- some text ,** heading 3 ,:PROPERTIES: ,:ID: 33333 ,:END: ,** heading 4 ,:PROPERTIES: ,:ID: 4444444 ,:END: ,* Moving Children and Parent ,* Deleting the 'moved to' heading

Local

,* Matching ID Headings ,* Changing the order of headings ,** heading aoe ,:PROPERTIES: ,:ID: 1 ,:END: ,** heading aoei ,:PROPERTIES: ,:ID: 222 ,:END: ,*** sub heading ,- some text ,** heading bdbibi ,:PROPERTIES: ,:ID: 33333 ,:END: ,** heading bdibdib ,:PROPERTIES: ,:ID: 4444444 ,:END: ,* Moving Children and Parent ,* Deleting the 'moved to' heading

Remote

,* Matching ID Headings ,* Changing the order of headings ,** heading didi ,:PROPERTIES: ,:ID: 33333 ,:END: ,** heading aoao ,:PROPERTIES: ,:ID: 4444444 ,:END: ,** heading aeou ,:PROPERTIES: ,:ID: 1 ,:END: ,* Moving Children and Parent ,** heading aoeuau ,:PROPERTIES: ,:ID: 222 ,:END:

Expected Output

Cookies

Ancestor

,* Front Cookies ,** Updated in one file ,** Updated in both files ,** Same update in both file ,* Middle Cookies ,** Updated [#B] in one file ,** Updated in both files ,** Same update in both files ,* Back Cookies ,** Updated in one file ,** Updated in both files [#B] ,** Same update in both file

Local

,* Front Cookies ,** [#B] Updated in one file ,** [#C] Updated in both files ,** [#B] Same update in both file ,* Middle Cookies ,** Updated [#A] in one file ,** Updated [#A] in both files ,** Same update [#A] in both files ,* Back Cookies ,** Updated in one file ,** Updated in both files [#C] ,** Same update in both file [#C]

Remote

,* Front Cookies ,** Updated in one file ,** [#A] Updated in both files ,** [#B] Same update in both file ,* Middle Cookies ,** Updated [#B] in one file ,** Updated in both [#B] files ,** Same update [#A] in both files ,* Back Cookies ,** Updated in one file [#B] ,** Updated in both files [#A] ,** Same update in both file [#C]

Expected Output

,* Front Cookies ,** [#B] Updated in one file ,>>>>>>> Updated ,** [#C] Updated in both files ,======= ,** [#A] Updated in both files ,<<<<<<< Updated ,** [#B] Same update in both file ,* Middle Cookies ,** Updated [#A] in one file ,>>>>>>> Updated ,** Updated [#A] in both files ,======= ,** Updated in both [#B] files ,<<<<<<< Updated ,** Same update [#A] in both files ,* Back Cookies ,** Updated in one file [#B] ,>>>>>>> Updated ,** Updated in both files [#C] ,======= ,** Updated in both files [#A] ,<<<<<<< Updated ,** Same update in both file [#C]

Matching Headings

Ancestor

Properly remove new org-headings.

,* Todo state updates ,** Updated in one file ,** Updated in both files ,** Same update in both files ,* Cookies ,** Updated in one file ,** Updated in both files ,** Same update in both file ,* Tags ,** Updated in one file :oldtag: ,** Updated in both files :oldtag:keeper: ,** Same update in both files :keeper: ,* Other Examples ,** Spacing doesn't matter ,** spacingkindofmatters ,** Cookies [5/3] are [75%] stripped [#A] out ,* Horribly Annoying Example ,**** TODO Seed 1 [#A] 1 :Some: ,**** TODO [#B] Seed 2 [#A] 1 :Some: ,**** [#C] Seed 3 [#A] 1 [] [/] :Some: ,**** TODO Seed 4 [#A] 1 :Some:

Local

,* Todo state updates ,** TODO Updated in one file ,** DONE Updated in both files ,** TODO Same update in both files ,* Cookies ,** [#B] Updated in one file ,** [#C] Updated in both files ,** [#B] Same update in both file ,* Tags ,** Updated in one file :NEWTAG:NEWTAG2: ,** Updated in both files :NewTag:keeper: ,** Same update in both file :SAME: ,* Other Examples ,** Spacing doesn't matter ,** spacing[#B]kindofmatters ,** Cookies are stripped out ,* Horribly Annoying Example ,**** TODO Seed 1 [#A] 1 :Some:NewTag: ,**** TODO [#B] Seed 2 [#A] 1 :Some: :difftag: ,**** [#D] Seed 3 [#C] 1 [] [/] [#C] : notag:Some: ,**** TODO Seed 4 [#A] 1 :Some: Tag:

Remote

,* Todo state updates ,** Updated in one file ,** TODO Updated in both files ,** TODO Same update in both files ,* Cookies ,** Updated in one file ,** [#A] Updated in both files ,** [#B] Same update in both file ,* Tags ,** Updated in one file ,** Updated in both files :file2:keeper: ,** Same update in both file :SAME: ,* Other Examples ,** Spacing doesn't matter ,** spacing kindofmatters ,** Cookies [5/3] are [75%] stripped [#A] out ,* Horribly Annoying Example ,**** TODO Seed 1 [#B] 1 :Some: ,**** TODO [#B] Seed 2 [#A] 1 :moretag:Some: ,**** TODO [#C] Seed 3 [#A] 1 [] [/] :Some: ,**** TODO Seed 4 [#D] 1 :Some:

Expected Output

,* Todo state updates ,** TODO Updated in one file ,>>>>>>> Updated ,** DONE Updated in both files ,======= ,** TODO Updated in both files ,<<<<<<< Updated ,** TODO Same update in both files ,* Cookies ,** [#B] Updated in one file ,>>>>>>> Updated ,** [#C] Updated in both files ,======= ,** [#A] Updated in both files ,<<<<<<< Updated ,** [#B] Same update in both file ,* Tags ,** Updated in one file :NEWTAG:NEWTAG2: ,** Updated in both files :keeper:file2:NewTag: ,** Same update in both file :SAME: ,* Other Examples ,>>>>>>> Updated ,** Spacing doesn't matter ,======= ,** Spacing doesn't matter ,<<<<<<< Updated ,** spacing kindofmatters ,>>>>>>> Updated ,** spacing[#B]kindofmatters ,======= ,<<<<<<< Deleted ,** Cookies are stripped out ,* Horribly Annoying Example ,>>>>>>> Updated ,**** TODO Seed 1 [#A] 1 :Some:NewTag: ,======= ,**** TODO Seed 1 [#B] 1 :Some: ,<<<<<<< Updated ,**** TODO [#B] Seed 2 [#A] 1 :Some: :difftag: ,**** [#D] Seed 3 [#C] 1 [] [/] [#C] : notag:Some: ,**** TODO Seed 4 [#A] 1 :Some: Tag: ,>>>>>>> ,======= ,**** TODO [#B] Seed 2 [#A] 1 :moretag:Some: ,<<<<<<< Updated ,>>>>>>> ,======= ,**** TODO [#C] Seed 3 [#A] 1 [] [/] :Some: ,<<<<<<< Updated ,**** TODO Seed 4 [#D] 1 :Some:

Multiple New Subheadings

Ancestor

New subheadings which were the children of other new subheadings were not being added.

,* These are some types of fruits ,** Apples ,** Oranges ,note: don't compare with apples ,** Bananas

Local

,* These are some types of fruits ,** Apples ,** Pears ,** Oranges ,note: don't compare with apples ,** Bananas ,** Water Melon ,** Tomato ,note: might be a vegetable

Remote

,* These are some types of fruits ,** Kiwi ,** Apples ,** Grapes ,*** Red Grapes ,*** Green Grapes ,** Oranges ,note: don't compare with apples ,** Bananas ,** Blue Berries ,** Water Melon ,very tasty

Expected Output

,* These are some types of fruits ,** Kiwi ,** Apples ,** Grapes ,*** Red Grapes ,*** Green Grapes ,** Pears ,** Oranges ,note: don't compare with apples ,** Bananas ,** Blue Berries ,** Water Melon ,very tasty ,** Tomato ,note: might be a vegetable

Headline Movement

Test Name test-name Result Notes
Moving Headings heading_movement
Heading Global and Local Matching heading_global_local_matching
Movement Conflict heading_double_movement_conflict
Movement To Deleted Parent heading_movement_parent_deleted_conflict
Movement To Two Deleted Parents heading_movement_double_parent_delete_conflict
Nested Movement heading_nested_movement
Nested Movement Conflict heading_nested_movement_conflict
Movement and Parent Level Update heading_movement_levels
Movement to Parent Level Conflict heading_move_parent_level_conflict
heading_circular_movement TODO
heading_3node_circular_movement TODO
heading_circmove_and_movement_conflict TODO

<>

Moving Headings

Ancestor

#+begin_src org :tangle heading_movement_anc.org ,* Matching ID Headings ,* Changing the order of headings ,** heading 1 ,:PROPERTIES: ,:ID: 1 ,:END: ,** heading 2 ,:PROPERTIES: ,:ID: 2 ,:END: ,*** sub heading ,- some text ,** heading 3 ,:PROPERTIES: ,:ID: 3 ,:END: ,** heading 4 ,:PROPERTIES: ,:ID: 4 ,:END: ,* Moving Children and Parent ,* Deleting the 'moved to' heading #+end_src

Local

#+begin_src org :tangle heading_movement_loc.org ,* Matching ID Headings ,* Changing the order of headings ,** heading 4 ,:PROPERTIES: ,:ID: 4 ,:END: ,* Moving Children and Parent ,** new heading ,*** heading 2 ,:PROPERTIES: ,:ID: 2 ,:END: ,**** sub heading ,- some text ,- a new line in local ,* Deleting the 'moved to' heading ,** heading 3 ,:PROPERTIES: ,:ID: 3 ,:END: ,*** heading 1 ,:PROPERTIES: ,:ID: 1 ,:END: #+end_src

Remote

#+begin_src org :tangle heading_movement_rem.org ,* Matching ID Headings ,* Changing the order of headings ,** heading 1 ,:PROPERTIES: ,:ID: 1 ,:END: ,- some new text under 113131 ,** heading 2 ,:PROPERTIES: ,:ID: 2 ,:END: ,- some new text under 222222 ,** heading 3 ,:PROPERTIES: ,:ID: 3 ,:END: ,- some new text under 35555 ,** heading 4 ,:PROPERTIES: ,:ID: 4 ,:END: ,- some new text under 4444444 ,* Moving Children and Parent

Expected Output

,* Matching ID Headings ,* Changing the order of headings ,** heading 4 ,:PROPERTIES: ,:ID: 4 ,:END: ,- some new text under 4444444 ,* Moving Children and Parent ,** new heading ,*** heading 2 ,:PROPERTIES: ,:ID: 2 ,:END: ,- some new text under 222222 ,>>>>>>> Updated ,**** sub heading ,- some text ,- a new line in local ,======= ,<<<<<<< Deleted ,>>>>>>> Updated ,* Deleting the 'moved to' heading ,** heading 3 ,:PROPERTIES: ,:ID: 3 ,:END: ,- some new text under 35555 ,*** heading 1 ,:PROPERTIES: ,:ID: 1 ,:END: ,- some new text under 113131 ,======= ,<<<<<<< Deleted

Heading Global and Local Matching

This test makes sure that an element , which is first globally mapped, can later be reconciled with a local match, if it didn't actually move.

Ancestor

,* Heading 1 ,** Apple ,:PROPERTIES: ,:ID: Apple ,:END: ,*** Seed ,:PROPERTIES: ,:ID: Seed ,:END: ,* Heading 2

Local

,* Heading 1 ,** Apple ,:PROPERTIES: ,:ID: Apple ,:END: ,** Seed ,:PROPERTIES: ,:ID: Seed ,:END: ,* Heading 2

Remote

,* Heading 1 ,* Heading 2 ,** Apple ,:PROPERTIES: ,:ID: Apple ,:END: ,*** Seed ,:PROPERTIES: ,:ID: Seed ,:END:

Expected

,* Heading 1 ,** Seed ,:PROPERTIES: ,:ID: Seed ,:END: ,* Heading 2 ,** Apple ,:PROPERTIES: ,:ID: Apple ,:END:

Double Movement Conflict

Ancestor

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Local

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Remote

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Expected

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,>>>>>>> Moved ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,======= ,<<<<<<< Moved ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,>>>>>>> Moved ,======= ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,<<<<<<< Moved

Movement To Deleted Parent

Ancestor

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Local

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Remote

,* Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Expected

,>>>>>>> Updated ,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,======= ,<<<<<<< Deleted

Movement To Two Deleted Parents

Ancestor

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Local

,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,** Apple ,:PROPERTIES: ,:ID: 1 ,:END:

Remote

,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,** Apple ,:PROPERTIES: ,:ID: 1 ,:END:

Expected

,>>>>>>> Updated ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,>>>>>>> Moved ,** Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,======= ,<<<<<<< Moved ,<<<<<<< Deleted ,>>>>>>> Deleted ,======= ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,>>>>>>> Moved ,======= ,** Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,<<<<<<< Moved ,<<<<<<< Updated

Nested Movement

Ancestor

Moving two nodes below each other without a conflict.

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Local

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Remote

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,** Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Expected

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,*** Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Nested Movement Conflict

Ancestor

Test for movement nested within conflicts.

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,* Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,* Kiwi ,:PROPERTIES: ,:ID: 5 ,:END:

Local

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,** Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,** Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,*** Kiwi ,:PROPERTIES: ,:ID: 5 ,:END:

Remote

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,*** Kiwi ,:PROPERTIES: ,:ID: 5 ,:END: ,** Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Expected Output

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,>>>>>>> Moved ,======= ,** Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,>>>>>>> Moved ,======= ,*** Kiwi ,:PROPERTIES: ,:ID: 5 ,:END: ,<<<<<<< Moved ,<<<<<<< Moved ,>>>>>>> Moved ,======= ,** Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,>>>>>>> Moved ,*** Kiwi ,:PROPERTIES: ,:ID: 5 ,:END: ,======= ,<<<<<<< Moved ,<<<<<<< Moved ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,>>>>>>> Moved ,** Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,>>>>>>> Moved ,======= ,*** Kiwi ,:PROPERTIES: ,:ID: 5 ,:END: ,<<<<<<< Moved ,======= ,<<<<<<< Moved ,>>>>>>> Moved ,** Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,>>>>>>> Moved ,*** Kiwi ,:PROPERTIES: ,:ID: 5 ,:END: ,======= ,<<<<<<< Moved ,======= ,<<<<<<< Moved

Movement and Parent Heading Levels Updates

Ancestor

Check to see if a movement of a heading, and an update to the level of a heading will produce a heading with the wrong level.

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Local

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,***** Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Remote

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END:

Expected Output

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,>>>>>>> Updated ,**** Pear ,======= ,* Pear ,<<<<<<< Updated ,:PROPERTIES: ,:ID: 2 ,:END:

Movement to Parent Level Conflict

Make sure that subheadings levels are properly set when a parent has a content conflict caused by updating the amount of stars operly remove new org-headings.

Ancestor

,* Basket ,* Green Apple , :PROPERTIES: , :ID: 1 , :END:

Local

,** Basket ,*** Green Apple , :PROPERTIES: , :ID: 1 , :END:

Remote

,*** Basket ,**** Green Apple , :PROPERTIES: , :ID: 1 , :END:

Expected Output

,>>>>>>> Updated ,** Basket ,======= ,*** Basket ,<<<<<<< Updated ,**** Green Apple , :PROPERTIES: , :ID: 1 , :END:

2 Node Circular Movement

Ancestor

Circular movement happens when local and remote move nodes to be under each other. This cuts off both nodes from actually

,* heading 1 ,:PROPERTIES: ,:ID: ABC ,:END: ,* heading 2 ,:PROPERTIES: ,:ID: DEF ,:END:

Local

,* heading 1 ,:PROPERTIES: ,:ID: ABC ,:END: ,** heading 2 ,:PROPERTIES: ,:ID: DEF ,:END:

Remote

,* heading 2 ,:PROPERTIES: ,:ID: DEF ,:END: ,** heading 1 ,:PROPERTIES: ,:ID: ABC ,:END:

Expected Output

3 Node Circular Movement

Ancestor

,* heading 1 ,:PROPERTIES: ,:ID: ABC ,:END: ,* heading 2 ,:PROPERTIES: ,:ID: DEF ,:END: ,* heading 3 ,:PROPERTIES: ,:ID: GHI ,:END:

Local

,* heading 1 ,:PROPERTIES: ,:ID: ABC ,:END: ,** heading 2 ,:PROPERTIES: ,:ID: DEF ,:END: ,*** heading 3 ,:PROPERTIES: ,:ID: GHI ,:END:

Remote

,* heading 3 ,:PROPERTIES: ,:ID: GHI ,:END: ,** heading 2 ,:PROPERTIES: ,:ID: DEF ,:END: ,*** heading 1 ,:PROPERTIES: ,:ID: ABC ,:END:

Expected Output

Circular Movement With Embedded Movement Conflict

Ancestor

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,* Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,* Grape ,:PROPERTIES: ,:ID: 5 ,:END:

Local

,* Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,** Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Banana ,:PROPERTIES: ,:ID: 3 ,:END: ,** Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,*** Grape ,:PROPERTIES: ,:ID: 5 ,:END:

Remote

,* Pear ,:PROPERTIES: ,:ID: 2 ,:END: ,* Orange ,:PROPERTIES: ,:ID: 4 ,:END: ,*** Apple ,:PROPERTIES: ,:ID: 1 ,:END: ,* Grape ,:PROPERTIES: ,:ID: 5 ,:END: ,** Banana ,:PROPERTIES: ,:ID: 3 ,:END:

Expected Output

Properties

Test Name test-name Result Notes
Property Add property_add
Property Update property_update TODO
Property Remove property_remove
Property Spacing property_spacing TODO
Property Integration property_integration TODO

<>

Property Add

Ancestor

,* Picnic Basket ,:PROPERTIES: ,:Apple: green ,:END:

Local

,* Picnic Basket ,:PROPERTIES: ,:Apple: green ,:Basket: wicker ,:END:

Remote

,* Picnic Basket ,:PROPERTIES: ,:Bread: Brown ,:Apple: green ,:END:

Expected Output

,* Picnic Basket ,:PROPERTIES: ,:Bread: Brown ,:Apple: green ,:Basket: wicker ,:END:

Property Update

Ancestor

,* Picnic Basket ,:PROPERTIES: ,:Bread: Brown ,:Apple: green ,:Basket: wicker ,:END:

Local

,* Picnic Basket ,:PROPERTIES: ,:Bread: White ,:Apple: yellow ,:Basket: wicker ,:END:

Remote

,* Picnic Basket ,:PROPERTIES: ,:Bread: white ,:Apple: red ,:Basket: plastic ,:END:

Expected Output

,* Picnic Basket ,:PROPERTIES: ,>>>>>>> Updated ,:Bread: White ,======= ,:Bread: white ,<<<<<<< Updated ,>>>>>>> Updated ,:Apple: yellow ,======= ,:Apple: red ,<<<<<<< Updated ,:Basket: plastic ,:END:

Property Remove

Ancestor

,* Picnic Basket ,:PROPERTIES: ,:Bread: Brown ,:Apple: green ,:Basket: wicker ,:END:

Local

,* Picnic Basket ,:PROPERTIES: ,:Apple: green ,:Basket: wicker ,:END:

Remote

,* Picnic Basket ,:PROPERTIES: ,:Bread: Brown ,:Apple: green ,:END:

Expected Output

,* Picnic Basket ,:PROPERTIES: ,:Apple: green ,:END:

Property Spacing

Ancestor

,* Picnic Basket ,:PROPERTIES: ,:Bread: Brown ,:Apple: green ,:Basket: wicker ,:END:

Local

,* Picnic Basket ,:PROPERTIES: , :Bread: White , :Apple: yellow ,:Basket: wicker ,:END:

Remote

,* Picnic Basket ,:PROPERTIES: , :Bread: white ,:Apple: red ,:Basket: plastic ,:END:

Expected Output

,* Picnic Basket ,:PROPERTIES: ,>>>>>>> Updated , :Bread: White ,======= , :Bread: white ,<<<<<<< Updated ,>>>>>>> Updated , :Apple: yellow ,======= ,:Apple: red ,<<<<<<< Updated ,>>>>>>> Updated ,:Basket: wicker ,======= ,:Basket: plastic ,<<<<<<< Updated ,:END:

Property Integration

Ancestor

,* Picnic Basket , :PROPERTIES: ,:Apple: green ,:END:

,At lunch we will have a picnic. ,* Bag , :Apple: red ,This bag is from grocery shopping. ,* Shopping , :banana: green bananas , :bag: plastic ,- I need to go shopping later ,Groceries: ,- I need a banana ,- I might need more apples

Local

,* Picnic Basket ,:PROPERTIES: ,:Apple: green ,:END: ,At lunch we will have a picnic. ,* Bag , :Apple: yellow ,This bag is from grocery shopping. ,* Shopping , :banana: yellow bananas ,- I need to go shopping later ,Groceries: ,- I need a banana ,- I might need more apples

Remote

,* Picnic Basket ,:PROPERTIES: , :Apple: granny smith ,:END: ,At lunch we will have a picnic. ,* Bag , :Apple: golden ,This bag is from grocery shopping. ,* Shopping , :bag: plastic ,- I need to go shopping later ,Groceries: ,- I need a banana ,- update this text? ,- I might need more apples

Expected Output

,* Picnic Basket , :PROPERTIES: , :Apple: granny smith ,:END: ,At lunch we will have a picnic. ,* Bag ,>>>>>>> Updated , :Apple: yellow ,======= , :Apple: golden ,<<<<<<< Updated ,This bag is from grocery shopping. ,* Shopping , :banana: yellow bananas , :bag: plastic ,Groceries: ,- I need a banana ,- update this text? ,- I might need more apples

Text

Test Name test-name Result Notes
Text Integration text_integration ok TODO

<>

Text Integration

Ancestor

,Some text. ,* Heading 1 ,Some text. ,This text will be updated. ,This is a different element. ,more text ,* Heading 2 ,apple ,banana ,orange

Local

,+ new in local ,Some text. ,* Heading 1 ,new in local ,Some text. ,This text will be updated blah. ,This is a different element, or is it? ,more text ,new in local ,* Heading 2 ,apple ,+ green apple ,banana ,+ brown banana ,orange

Remote

,Some text. ,+ New in remote ,* Heading 1 ,Some text. ,This text will be updated blahah. ,This is a different element, or is it? ,new in remote ,more text ,* Heading 2 ,+ I hate fruit ,banana

Expected Output

,+ new in local ,Some text. ,+ New in remote ,* Heading 1 ,new in local ,Some text. ,>>>>>>> Updated ,This text will be updated blah. ,This is a different element, or is it? ,======= ,This text will be updated blahah. ,This is a different element, or is it? ,new in remote ,<<<<<<< Updated ,more text ,new in local ,* Heading 2 ,>>>>>>> Updated ,apple ,+ green apple ,======= ,+ I hate fruit ,<<<<<<< Updated ,banana ,+ brown banana

Testing Code

    This file can be used in two ways:
  1. Update the table of test results
  2. Create and run tests at 'make check'

To update this file, and rerun all the tests do ??.

Org Merge Driver

To run the tests the other way, do a make check.

Call org-merge-driver.

../src/org-merge-driver ${test}_anc.org ${test}_loc.org ${test}_rem.org

TAP Test Runner

This function runs an individual test, and outputs the results in TAP format.

if [ x$1 != "x" ]; then test=$1 echo Test: $test cat ${test}_anc.org ${test}_loc.org ${test}_rem.org fi result="not ok" <> 1> ${test}_res.org if [ x$1 != "x" ]; then cat ./${test}_exp.org cat ./${test}_res.org fi if diff ${test}_res.org ./${test}_exp.org then result="ok" fi echo -n "$result"

Suite Runner

Run all tests in a table. This function takes all a list of tests, adds a ,sh extension, and then executes them.

#!/bin/bash test_array=(${tests}) count=${#test_array[@]} for i in ${tests} do bash $(echo ./${i}.sh) done

TAP Suite Runner

This is used by the automake test harness, to run all tests when running make check. It prints the output in a different format then we want in the table.

Merge Rule Tester

#!/bin/bash oldifs=$IFS IFS=" " t_array=($tests) IFS=" " e_array=($expects) e_array=("${expects}") count=${#t_array[@]} echo 1..$count for i in $( seq 1 $count ) do test=${t_array[i-1]} expect=${expects[i-1]} <> echo " # $test" done IFS=$oldifs

Table Help Functions

(let ((ok-sum 0)) (mapcar '(lambda (string) (if (string= string "ok") (incf ok-sum))) list) ok-sum)

(length list)