~bzg/org-merge-driver

0be446e24a6f1c8405f8fe9e4d2e522eb7cc7414 — Andrew Young 10 years ago 6a8a9e6
Add and fix test cases
2 files changed, 1215 insertions(+), 255 deletions(-)

M tests/Makefile.am
M tests/test.org
M tests/Makefile.am => tests/Makefile.am +11 -5
@@ 1,5 1,11 @@
## Process this file with automake to produce Makefile.in
TESTS = check_org-merge-driver check_merge_rules.sh
test_org_tests = heading_tests.sh heading_movement_tests.sh \
	text_tests.sh property_tests.sh

TESTS = check_org-merge-driver $(test_org_tests)

#test_suite_runner.sh 
#test_org_tests =  

## Check Unit Tests
check_PROGRAMS = check_org-merge-driver


@@ 14,11 20,11 @@ check_org_merge_driver_LDADD = @CHECK_LIBS@ $(top_srcdir)/gnulib/lib/libgnu.a
## Merge Rule Tests
#check_org-merge-driver
TEST_EXTENSIONS = .sh
SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
                       $(top_srcdir)/config/tap-driver.sh
SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' bash \
                      $(top_srcdir)/config/tap-driver.sh

# retangle the test files if the tests are updated
check_merge_rules.sh : test.org
retangle : test.org
	echo "Must re-tangle files"
	emacs --batch --file test.org --eval "(org-babel-tangle)"
	chmod 700 check_merge_rules.sh # make the generated test script executable
	chmod 700 test_suite_runner.sh # make the generated test script executable

M tests/test.org => tests/test.org +1204 -250
@@ 8,28 8,32 @@ org-merge-driver.

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

#+tblname: org-merge-driver-tests
| Test Group  | test           | Oks                                | Total | Pct |
|-------------+----------------+------------------------------------+-------+-----|
| [[Headlines]]   | heading_tests  | remote(heading_tests, Test Group)  |       |     |
| [[Text]]        | text_tests     | remote(text_tests, Test Group)     |       |     |
| [[Properties]]  | property_tests | remote(property_tests, Test Group) |       |     |
| [[Other Tests]] | other_tests    | remote(other_tests, Test Group)    |       |     |
|-------------+----------------+------------------------------------+-------+-----|
|             |                |                                    |       |     |
|------------------+------------------------+-----+-------+-----|
| Test Group       | test                   | Oks | Total | Pct |
|------------------+------------------------+-----+-------+-----|
| [[Headlines]]        | heading_tests          |     |       |     |
| [[Heading Movement]] | heading_movement_tests |     |       |     |
| [[Text]]             | text_tests             |     |       |     |
| [[Properties]]       | property_tests         |     |       |     |
| [[Other Tests]]      | other_tests            |     |       |     |
|------------------+------------------------+-----+-------+-----|
#+TBLFM: $3='(sbe "sum_oks" (list $2(@2$3..@>>$3)))
#+TBLFM: $5='(sbe "test-runner" (test $$4))

* Headlines
* Headlines (Basic)
#+tblname: heading_tests
| Test Name         | test-name       | Result | Notes |
|-------------------+-----------------+--------+-------|
| [[Adding Headings]]   | heading_add     | not ok |       |
| [[Removing Headings]] | heading_remove  | not ok |       |
| [[Moving Headings]]   | heading_move    | not ok |       |
| [[Matching Headings]] | heading_match   | not ok | TODO  |
| [[Cookies]]           | heading_cookies |        |       |
|-------------------+-----------------+--------+-------|
|--------------------------+-------------------------------+--------+-------|
| 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 |        |       |
|--------------------------+-------------------------------+--------+-------|
#+TBLFM:@>$4='(sbe "col_length" (list @2$3..@>>$3))::@>$3='(sbe "sum_oks" (list @2$3..@>>$3))::@2$3..@>>$3='(sbe "test-runner" (test $$2))

#+begin_src sh :tangle heading_tests.sh :var tests=heading_tests[2:-1,1] :var expects=heading_tests[2:-1,3]


@@ 38,7 42,6 @@ org-merge-driver.

** Adding Headings
Properly add new org-headings.
#+name: heading_add

*** Ancestor
#+begin_src org -n :tangle heading_add_anc.org


@@ 80,12 83,11 @@ Properly add new org-headings.
  ,*** Seed 2
#+end_src

*** Output

** Removing Headings
Properly remove new org-headings.

*** Ancestor
#+begin_src org -n :tangle heading_remove_anc.org
#+begin_src org :tangle heading_remove_anc.org
  ,* Basket
  ,** Green Apple
  ,*** Seed 1


@@ 96,7 98,7 @@ Properly remove new org-headings.
#+end_src

*** Local
#+begin_src org -n :tangle heading_remove_loc.org
#+begin_src org :tangle heading_remove_loc.org
  ,* Basket
  ,** Green Apple
  ,*** Seed 1


@@ 106,7 108,7 @@ Properly remove new org-headings.
#+end_src

*** Remote
#+begin_src org -n :tangle heading_remove_rem.org
#+begin_src org :tangle heading_remove_rem.org
  ,* Basket
  ,** Green Apple
  ,*** Seed 2


@@ 114,9 116,9 @@ Properly remove new org-headings.
  ,*** Seed 1
  ,*** Seed 2
#+end_src
  

*** Expected Output
#+begin_src org -n :tangle heading_remove_exp.org
#+begin_src org :tangle heading_remove_exp.org
  ,* Basket
  ,** Green Apple
  ,*** Seed 2


@@ 124,11 126,58 @@ Properly remove new org-headings.
  ,*** Seed 1
#+end_src

*** Output
** 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
#+begin_src org :tangle heading_parent_level_conflict_anc.org
  ,* Basket
  ,** Green Apple
  ,**** Seed 1
  ,*** Seed 2
  ,**** Red Apple
  ,*** Seed 1
#+end_src

*** Local
#+begin_src org :tangle heading_parent_level_conflict_loc.org
  ,** Basket
  ,*** Green Apple
  ,***** Seed 1
  ,**** Seed 2
  ,***** Red Apple
  ,**** Seed 1
#+end_src

*** Remote
#+begin_src org :tangle heading_parent_level_conflict_rem.org
  ,*** Basket
  ,**** Green Apple
  ,****** Seed 1
  ,***** Seed 2
  ,****** Red Apple
  ,***** Seed 1
#+end_src

*** Expected Output
#+begin_src org :tangle heading_parent_level_conflict_exp.org
  ,>>>>>>> Updated
  ,** Basket
  ,======= 
  ,*** Basket
  ,<<<<<<< Updated
  ,**** Green Apple
  ,****** Seed 1
  ,***** Seed 2
  ,****** Red Apple
  ,***** Seed 1
#+end_src

** Heading IDs
*** Ancestor
#+begin_src org -n :tangle heading_id_anc.org
#+begin_src org :tangle heading_id_anc.org
  ,* Matching ID Headings
  ,* Changing the order of headings
  ,** heading 1


@@ 154,7 203,7 @@ Properly remove new org-headings.
#+end_src

*** Local
#+begin_src org -n :tangle heading_id_loc.org
#+begin_src org :tangle heading_id_loc.org
  ,* Matching ID Headings
  ,* Changing the order of headings
  ,** heading aoe


@@ 180,7 229,7 @@ Properly remove new org-headings.
#+end_src

*** Remote
#+begin_src org -n :tangle heading_id_rem.org
#+begin_src org :tangle heading_id_rem.org
  ,* Matching ID Headings
  ,* Changing the order of headings
  ,** heading didi


@@ 203,13 252,303 @@ Properly remove new org-headings.
#+end_src

*** Expected Output
#+begin_src org -n :tangle heading_move_exp.org
#+begin_src org :tangle heading_id_exp.org

#+end_src
** Cookies
*** Ancestor
#+begin_src org :tangle heading_cookies_anc.org
  ,* 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
#+end_src

*** Local
#+begin_src org :tangle heading_cookies_loc.org
  ,* 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]
#+end_src

*** Remote
#+begin_src org :tangle heading_cookies_rem.org
  ,* 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]
#+end_src

*** Expected Output
#+begin_src org :tangle heading_cookies_exp.org
  ,* 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]
#+end_src

** Matching Headings
Properly remove new org-headings.
*** Ancestor
#+begin_src org :tangle heading_match_anc.org
  ,* 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:
#+end_src

*** Local
#+begin_src org :tangle heading_match_loc.org
  ,* 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:
#+end_src

*** Remote
#+begin_src org :tangle heading_match_rem.org
  ,* 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:
#+end_src

*** Expected Output
#+begin_src org :tangle heading_match_exp.org
  ,* 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:
#+end_src

** Multiple New Subheadings
New subheadings which were the children of other new subheadings were
not being added.
*** Ancestor
#+begin_src org :tangle heading_multiple_new_sub_anc.org
  ,* These are some types of fruits
  ,** Apples
  ,** Oranges
  ,note: don't compare with apples
  ,** Bananas
#+end_src

*** Local
#+begin_src org :tangle heading_multiple_new_sub_loc.org
  ,* These are some types of fruits
  ,** Apples
  ,** Pears
  ,** Oranges
  ,note: don't compare with apples
  ,** Bananas
  ,** Water Melon
  ,** Tomato
  ,note: might be a vegetable
#+end_src

*** Remote
#+begin_src org :tangle heading_multiple_new_sub_rem.org
  ,* 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
#+end_src

*** Expected Output
#+begin_src org :tangle heading_multiple_new_sub_exp.org
  ,* 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
#+end_src

* Headline Movement
#+tblname: heading_movement_tests
|-----------------------------------+------------------------------------------------+--------+-------+---|
| 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  |   |
|-----------------------------------+------------------------------------------------+--------+-------+---|

#+begin_src sh :tangle heading_movement_tests.sh :var tests=heading_movement_tests[2:-1,1] :var expects=heading_movement_tests[2:-1,3]
  <<check_merge_rules>>
#+end_src

** Moving Headings
*** Ancestor
#+begin_src org -n :tangle heading_move_anc.org
    #+begin_src org :tangle heading_movement_anc.org
  ,* Matching ID Headings
  ,* Changing the order of headings
  ,** heading 1


@@ 232,10 571,10 @@ Properly remove new org-headings.
  ,:END:
  ,* Moving Children and Parent
  ,* Deleting the 'moved to' heading
#+end_src
    #+end_src

*** Local
#+begin_src org -n :tangle heading_move_loc.org
    #+begin_src org :tangle heading_movement_loc.org
  ,* Matching ID Headings
  ,* Changing the order of headings
  ,** heading 4


@@ 260,282 599,812 @@ Properly remove new org-headings.
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
#+end_src
    #+end_src

*** Remote
#+begin_src org -n :tangle heading_move_rem.org
 #+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 in remote
  ,- 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
#+end_src

*** Expected Output
#+begin_src org -n :tangle heading_move_exp.org

#+end_src

** Circular Movement
*** Ancestor
#+begin_src org -n :tangle heading_circular_movement_anc.org
  ,* heading 1
#+begin_src org :tangle heading_movement_exp.org
  ,* Matching ID Headings
  ,* Changing the order of headings
  ,** heading 4
  ,:PROPERTIES:
  ,:ID: ABC
  ,:ID: 4
  ,:END:
  ,* heading 2
  ,- some new text under 4444444
  ,* Moving Children and Parent
  ,** new heading
  ,*** heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:ID: 2
  ,:END:
  ,* heading 3
  ,- 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: GHI
  ,:ID: 3
  ,:END:
  ,- some new text under 35555
  ,*** heading 1
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,- some new text under 113131
  ,======= 
  ,<<<<<<< Deleted
#+end_src

*** Local
#+begin_src org -n :tangle heading_circular_movement_loc.org
  ,* heading 1
** 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
#+begin_src org :tangle  heading_global_local_matching_anc.org
  ,* Heading 1
  ,** Apple
  ,:PROPERTIES:
  ,:ID: ABC
  ,:ID: Apple
  ,:END:
  ,** heading 2
  ,*** Seed
  ,:PROPERTIES:
  ,:ID: DEF
  ,:ID: Seed
  ,:END:
  ,*** heading 3
  ,* Heading 2
#+end_src

*** Local
#+begin_src org :tangle heading_global_local_matching_loc.org
  ,* Heading 1
  ,** Apple
  ,:PROPERTIES:
  ,:ID: GHI
  ,:ID: Apple
  ,:END:
  ,** Seed
  ,:PROPERTIES:
  ,:ID: Seed
  ,:END:
  ,* Heading 2
#+end_src

*** Remote
#+begin_src org -n :tangle heading_circular_movement_rem.org
  ,* heading 3
#+begin_src org :tangle heading_global_local_matching_rem.org
  ,* Heading 1
  ,* Heading 2
  ,** Apple
  ,:PROPERTIES:
  ,:ID: GHI
  ,:ID: Apple
  ,:END:
  ,** heading 2
  ,*** Seed
  ,:PROPERTIES:
  ,:ID: DEF
  ,:ID: Seed
  ,:END:
  ,*** heading 1
#+end_src

*** Expected
#+begin_src org :tangle heading_global_local_matching_exp.org
  ,* Heading 1
  ,** Seed
  ,:PROPERTIES:
  ,:ID: ABC
  ,:ID: Seed
  ,:END:
  ,* Heading 2
  ,** Apple
  ,:PROPERTIES:
  ,:ID: Apple
  ,:END:
#+end_src

** Double Movement Conflict
*** Ancestor
#+begin_src org :tangle heading_double_movement_conflict_anc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

*** Local
#+begin_src org :tangle heading_double_movement_conflict_loc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

*** Remote
#+begin_src org :tangle heading_double_movement_conflict_rem.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

*** Expected
#+begin_src org :tangle heading_double_movement_conflict_exp.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,>>>>>>> Moved
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,======= 
  ,<<<<<<< Moved
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
  ,>>>>>>> Moved
  ,======= 
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,<<<<<<< Moved
#+end_src

** Movement To Deleted Parent
*** Ancestor
#+begin_src org :tangle heading_movement_parent_deleted_conflict_anc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

*** Local
#+begin_src org :tangle heading_movement_parent_deleted_conflict_loc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

*** Remote
#+begin_src org :tangle heading_movement_parent_deleted_conflict_rem.org
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

*** Expected
#+begin_src org :tangle heading_movement_parent_deleted_conflict_exp.org
  ,>>>>>>> Updated
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,======= 
  ,<<<<<<< Deleted
#+end_src

** Movement To Two Deleted Parents
*** Ancestor
#+begin_src org :tangle heading_movement_double_parent_delete_conflict_anc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

*** Local
#+begin_src org :tangle heading_movement_double_parent_delete_conflict_loc.org
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,** Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
#+end_src

*** Remote
#+begin_src org :tangle heading_movement_double_parent_delete_conflict_rem.org
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
  ,** Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
#+end_src

*** Expected
#+begin_src org :tangle heading_movement_double_parent_delete_conflict_exp.org
  ,>>>>>>> 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
#+end_src

** Nested Movement
Moving two nodes below each other without a conflict.
*** Ancestor
#+begin_src org :tangle heading_nested_movement_anc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

*** Local
#+begin_src org :tangle heading_nested_movement_loc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,* Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

*** Remote
#+begin_src org :tangle heading_nested_movement_rem.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,** Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

*** Expected
#+begin_src org :tangle heading_nested_movement_exp.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
  ,*** Banana
  ,:PROPERTIES:
  ,:ID: 3
  ,:END:
#+end_src

** Nested Movement Conflict
Test for movement nested within conflicts.
*** Ancestor
#+begin_src org :tangle heading_nested_movement_conflict_anc.org
  ,* 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:
#+end_src

*** Local
#+begin_src org :tangle heading_nested_movement_conflict_loc.org
  ,* 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:
#+end_src

*** Remote
#+begin_src org :tangle heading_nested_movement_conflict_rem.org
  ,* 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:
#+end_src

*** Expected Output
#+begin_src org -n :tangle heading_move_exp.org
#+begin_src org :tangle heading_nested_movement_conflict_exp.org
  ,* 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
#+end_src

** Movement and Parent Heading Levels Updates
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.
*** Ancestor
#+begin_src org :tangle heading_movement_levels_anc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

** Cookies
Make sure that 
*** Local
#+begin_src org :tangle heading_movement_levels_loc.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,***** Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

*** Remote
#+begin_src org :tangle heading_movement_levels_rem.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,* Pear
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

*** Expected Output
#+begin_src org :tangle heading_movement_levels_exp.org
  ,* Apple
  ,:PROPERTIES:
  ,:ID: 1
  ,:END:
  ,>>>>>>> Updated
  ,**** Pear
  ,======= 
  ,* Pear
  ,<<<<<<< Updated
  ,:PROPERTIES:
  ,:ID: 2
  ,:END:
#+end_src

** 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
#+begin_src org -n :tangle heading_cookies_anc.org
  ,* 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
#+begin_src org :tangle heading_move_parent_level_conflict_anc.or
  ,* Basket
  ,* Green Apple
  ,  :PROPERTIES:
  ,  :ID: 1
  ,  :END:
#+end_src

*** Local
#+begin_src org -n :tangle heading_cookies_loc.org
  ,* 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]
#+begin_src org :tangle heading_move_parent_level_conflict_loc.org
  ,** Basket
  ,*** Green Apple
  ,    :PROPERTIES:
  ,    :ID: 1
  ,    :END:
#+end_src

*** Remote
#+begin_src org -n :tangle heading_cookies_rem.org
  ,* 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]
#+begin_src org :tangle heading_move_parent_level_conflict_rem.org
  ,*** Basket
  ,**** Green Apple
  ,     :PROPERTIES:
  ,     :ID: 1
  ,     :END:
#+end_src

*** Expected Output
#+begin_src org :tangle heading_move_parent_level_conflict_exp.org
  ,>>>>>>> Updated
  ,** Basket
  ,======= 
  ,*** Basket
  ,<<<<<<< Updated
  ,**** Green Apple
  ,  :PROPERTIES:
  ,  :ID: 1
  ,  :END:
#+end_src


** 2 Node Circular Movement
Circular movement happens when local and remote move nodes to be under
each other.  This cuts off both nodes from actually
*** Ancestor
#+begin_src org -n :tangle heading_circular_movement_anc.org
  ,* heading 1
  ,:PROPERTIES:
  ,:ID: ABC
  ,:END:
  ,* heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:END:
#+end_src

*** Local
#+begin_src org -n :tangle heading_circular_movement_loc.org
  ,* heading 1
  ,:PROPERTIES:
  ,:ID: ABC
  ,:END:
  ,** heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:END:
#+end_src

*** Remote
#+begin_src org -n :tangle heading_circular_movement_rem.org
  ,* heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:END:
  ,** heading 1
  ,:PROPERTIES:
  ,:ID: ABC
  ,:END:
#+end_src

*** Expected Output
#+begin_src org -n :tangle heading_tags_exp.org
#+begin_src org -n :tangle heading_circular_movement_exp.org

#+end_src

** Matching Headings
Properly remove new org-headings.
** 3 Node Circular Movement
*** Ancestor
#+begin_src org :tangle heading_match_anc.org
  ,* 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:
#+begin_src org -n :tangle heading_3node_circular_movement_anc.org
  ,* heading 1
  ,:PROPERTIES:
  ,:ID: ABC
  ,:END:
  ,* heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:END:
  ,* heading 3
  ,:PROPERTIES:
  ,:ID: GHI
  ,:END:
#+end_src

*** Local
#+begin_src org :tangle heading_match_loc.org
  ,* 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:
#+begin_src org -n :tangle heading_3node_circular_movement_loc.org
  ,* heading 1
  ,:PROPERTIES:
  ,:ID: ABC
  ,:END:
  ,** heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:END:
  ,*** heading 3
  ,:PROPERTIES:
  ,:ID: GHI
  ,:END:
#+end_src

*** Remote
#+begin_src org :tangle heading_match_rem.org
  ,* 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:
#+begin_src org -n :tangle heading_3node_circular_movement_rem.org
  ,* heading 3
  ,:PROPERTIES:
  ,:ID: GHI
  ,:END:
  ,** heading 2
  ,:PROPERTIES:
  ,:ID: DEF
  ,:END:
  ,*** heading 1
  ,:PROPERTIES:
  ,:ID: ABC
  ,:END:
#+end_src

*** Expected Output
#+begin_src org :tangle heading_remove_exp.org
  ,* Basket
  ,** Green Apple
  ,*** Seed 2
  ,** Red Apple
  ,*** Seed 1
#+begin_src org -n :tangle heading_3node_circular_movement_exp.org

#+end_src
** Cookies

** Circular Movement With Embedded Movement Conflict
*** Ancestor
#+begin_src org -n :tangle heading_cookies_anc.org
  ,* 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
#+begin_src org :tangle heading_circmove_and_movement_conflict_anc.org
  ,* 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:
#+end_src

*** Local
#+begin_src org -n :tangle heading_cookies_loc.org
  ,* 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]
#+begin_src org :tangle heading_circmove_and_movement_conflict_loc.org
  ,* 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:
#+end_src

*** Remote
#+begin_src org -n :tangle heading_cookies_rem.org
  ,* 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]
#+begin_src org :tangle heading_circmove_and_movement_conflict_rem.org
  ,* 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:
#+end_src

*** Expected Output
#+begin_src org -n :tangle heading_tags_exp.org
#+begin_src org :tangle heading_circmove_and_movement_conflict_exp.org

#+end_src

* Properties


@@ 547,6 1416,7 @@ Properly remove new org-headings.
| [[Property Remove]]      | property_remove      |        |       |
| [[Property Spacing]]     | property_spacing     |        | TODO  |
| [[Property Integration]] | property_integration |        | TODO  |
|----------------------+----------------------+--------+-------|

#+begin_src sh :tangle property_tests.sh :var tests=property_tests[2:-1,1] :var expects=property_tests[2:-1,3]
  <<check_merge_rules>>


@@ 622,6 1492,20 @@ Properly remove new org-headings.

*** Expected Output
#+begin_src org :tangle property_update_exp.org
  ,* Picnic Basket
  ,:PROPERTIES:
  ,>>>>>>> Updated
  ,:Bread: White
  ,======= 
  ,:Bread:    white
  ,<<<<<<< Updated
  ,>>>>>>> Updated
  ,:Apple:    yellow
  ,======= 
  ,:Apple:  red
  ,<<<<<<< Updated
  ,:Basket:     plastic
  ,:END:
#+end_src

** Property Remove


@@ 694,11 1578,29 @@ Properly remove new org-headings.

*** Expected Output
#+begin_src org :tangle property_spacing_exp.org
  ,* Picnic Basket
  ,:PROPERTIES:
  ,>>>>>>> Updated
  ,    :Bread:        White 
  ,======= 
  ,     :Bread:        white
  ,<<<<<<< Updated
  ,>>>>>>> Updated
  ,  :Apple:      yellow   
  ,======= 
  ,:Apple:  red
  ,<<<<<<< Updated
  ,>>>>>>> Updated
  ,:Basket:       wicker   
  ,======= 
  ,:Basket:     plastic
  ,<<<<<<< Updated
  ,:END:
#+end_src

** Property Integration
*** Ancestor
#+begin_src org  :tangle property_anc.org
#+begin_src org  :tangle property_integration_anc.org
  ,* Picnic Basket
  ,  :PROPERTIES:
  ,:Apple:    green


@@ 718,7 1620,7 @@ Properly remove new org-headings.
#+end_src

*** Local
#+begin_src org  :tangle property_loc.org
#+begin_src org  :tangle property_integration_loc.org
  ,* Picnic Basket
  ,:PROPERTIES:
  ,:Apple:    green


@@ 736,7 1638,7 @@ Properly remove new org-headings.
#+end_src

*** Remote
#+begin_src org :tangle property_rem.org
#+begin_src org :tangle property_integration_rem.org
  ,* Picnic Basket
  ,:PROPERTIES:
  ,  :Apple:         granny smith


@@ 755,10 1657,29 @@ Properly remove new org-headings.
#+end_src

*** Expected Output
#+begin_src org -n :tangle property_exp.org
#+begin_src org :tangle property_integration_exp.org
  ,* 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
#+end_src

*** Output

* Text
#+tblname: text_tests
| Test Name        | test-name        | Result | Notes |


@@ 820,10 1741,35 @@ Properly remove new org-headings.

*** Expected Output
#+begin_src org -n :tangle text_integration_exp.org
  ,+ 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
#+end_src

* Other Tests
* 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'


@@ 832,10 1778,13 @@ To update this file, and rerun all the tests do ??.

To run the tests the other way, do a make check.
** Org Merge Driver

#+end_src

Call org-merge-driver.
#+name: org-merge-driver
#+begin_src sh
  ./src/org-merge-driver ${test}_anc.org ${test}_loc.org ${test}_rem.org 1> ${test}_res.org
  ../src/org-merge-driver ${test}_anc.org ${test}_loc.org ${test}_rem.org
#+end_src

** TAP Test Runner


@@ 844,32 1793,43 @@ format.
#+name: test-runner
#+headers: :tangle test_runner.sh :noweb yes
#+begin_src sh :exports code :var test="heading_add"
    result="not ok"
    <<org-merge-driver>> > ${test}_res.org
    if diff ${test}_res.org ./${test}_exp.org > /dev/null
    then
        result="ok"
    fi
    echo -n "$result"
  if [ x$1 != "x" ]; then
    test=$1
    echo Test: $test
    cat ${test}_anc.org ${test}_loc.org ${test}_rem.org  
  fi
  result="not ok"
  <<org-merge-driver>> 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"
#+end_src

** Suite Runner
Run all tests in a table.
Run all tests in a table. This function takes all a list of tests,
adds a ,sh extension, and then executes them.
#+name: test-suite-runner
#+headers: :var tests=org-merge-driver-tests[2:-1,1] :results output :tangle test-suite-runner.sh
#+headers: :var tests=org-merge-driver-tests[2:-1,1] :results output :tangle test_suite_runner.sh
#+begin_src sh
  #!/bin/bash
  count=${#tests[@]}
  test_array=(${tests})
  count=${#test_array[@]}
  for i in ${tests}
  do
    $(echo ./${i}.sh)
    bash $(echo ./${i}.sh)
  done
#+end_src

** 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.
running make check. It prints the output in a different format then we
want in the table.

** Merge Rule Tester
#+name: check_merge_rules


@@ 878,7 1838,6 @@ we want in the table.
#+begin_src sh
  #!/bin/bash
  oldifs=$IFS
  echo tests = $tests
  IFS="
  " t_array=($tests)
  IFS="


@@ 888,15 1847,10 @@ we want in the table.
      echo 1..$count
      for i in $( seq 1 $count )
      do
          echo $i
          test=${t_array[i-1]}
          expect=${e_array[i-1]}
          echo test=$test expect=$expect
          expect=${expects[i-1]}
          <<test-runner>>
      echo -n " # "
      if [ "nil" != "$expect" ]; then echo -n "$expect"
      fi
      echo " $test"
      echo " # $test"
    done
    IFS=$oldifs
#+end_src