|
@@ -1,30 +1,46 @@
|
|
|
#+title: Org Merge Driver Testing
|
|
|
#+author: Andrew Young
|
|
|
-#+properties :tangle
|
|
|
+#+property: noweb yes
|
|
|
|
|
|
* 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.*
|
|
|
+#+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) | | |
|
|
|
+|-------------+----------------+------------------------------------+-------+-----|
|
|
|
+| | | | | |
|
|
|
+#+TBLFM: $3='(sbe "sum_oks" (list $2(@2$3..@>>$3)))
|
|
|
+#+TBLFM: $5='(sbe "test-runner" (test $$4))
|
|
|
|
|
|
- This document holds some examples of the behavior and
|
|
|
-features of the org-merge-driver. To run the file, do C-c C-v t to
|
|
|
-produce the output files, and then 'make check' or something to run
|
|
|
-them.
|
|
|
+* Headlines
|
|
|
+#+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 | | |
|
|
|
+|-------------------+-----------------+--------+-------|
|
|
|
+#+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))
|
|
|
|
|
|
-* Tests
|
|
|
-#+tblname: org-merge-driver-tests
|
|
|
-| Test Name | test-name | Result | Notes |
|
|
|
-|------------------+----------------+--------+-------|
|
|
|
-| Expected_Fail | expected_fail | not ok | TODO |
|
|
|
-| Adding heading | heading_add | ok | |
|
|
|
-| Removing heading | heading_remove | ok | |
|
|
|
-#+TBLFM: $3='(sbe "test-runner" (test $$2))
|
|
|
-
|
|
|
-* Org Heading
|
|
|
-** Adding Heading
|
|
|
+#+begin_src sh :tangle heading_tests.sh :var tests=heading_tests[2:-1,1] :var expects=heading_tests[2:-1,3]
|
|
|
+ <<check_merge_rules>>
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Adding Headings
|
|
|
Properly add new org-headings.
|
|
|
+#+name: heading_add
|
|
|
+
|
|
|
*** Ancestor
|
|
|
-#+name: heading_add_anc
|
|
|
#+begin_src org -n :tangle heading_add_anc.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -34,7 +50,6 @@ Properly add new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Local
|
|
|
-#+name: heading_add_loc
|
|
|
#+begin_src org -n :tangle heading_add_loc.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -45,7 +60,6 @@ Properly add new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Remote
|
|
|
-#+name: heading_add_rem
|
|
|
#+begin_src org -n :tangle heading_add_rem.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -54,9 +68,8 @@ Properly add new org-headings.
|
|
|
,*** Seed 1
|
|
|
,*** Seed 2
|
|
|
#+end_src
|
|
|
-
|
|
|
+
|
|
|
*** Expected Output
|
|
|
-#+name: heading_add_exp
|
|
|
#+begin_src org -n :tangle heading_add_exp.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -68,13 +81,10 @@ Properly add new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Output
|
|
|
- #+CALL: <name>(<arguments>)
|
|
|
|
|
|
-*** Summary
|
|
|
-** Removing Heading
|
|
|
+** Removing Headings
|
|
|
Properly remove new org-headings.
|
|
|
*** Ancestor
|
|
|
-#+name: heading_add_exp
|
|
|
#+begin_src org -n :tangle heading_remove_anc.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -86,7 +96,6 @@ Properly remove new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Local
|
|
|
-#+name: heading_add_loc
|
|
|
#+begin_src org -n :tangle heading_remove_loc.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -97,7 +106,6 @@ Properly remove new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Remote
|
|
|
-#+name: heading_add_rem
|
|
|
#+begin_src org -n :tangle heading_remove_rem.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -108,7 +116,6 @@ Properly remove new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Expected Output
|
|
|
-#+name: heading_add_anc
|
|
|
#+begin_src org -n :tangle heading_remove_exp.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
@@ -118,50 +125,704 @@ Properly remove new org-headings.
|
|
|
#+end_src
|
|
|
|
|
|
*** Output
|
|
|
-#+call: org-merge-driver(test="heading_remove") :results verbatim
|
|
|
|
|
|
-* Other Tests
|
|
|
-Testing the test-suite with a failing test.
|
|
|
+** Heading IDs
|
|
|
*** Ancestor
|
|
|
-#+begin_src org -n :tangle heading_add_anc.org
|
|
|
- ,* Basket
|
|
|
- ,** Green Apple
|
|
|
- ,*** Seed 2
|
|
|
- ,** Red Apple
|
|
|
- ,*** Seed 1
|
|
|
+#+begin_src org -n :tangle heading_id_anc.org
|
|
|
+ ,* 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
|
|
|
#+end_src
|
|
|
|
|
|
*** Local
|
|
|
-#+begin_src org -n :tangle expected_fail_loc.org
|
|
|
- ,* Basket
|
|
|
- ,** Green Apple
|
|
|
- ,** Red Apple
|
|
|
+#+begin_src org -n :tangle heading_id_loc.org
|
|
|
+ ,* 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
|
|
|
#+end_src
|
|
|
|
|
|
*** Remote
|
|
|
-#+begin_src org -n :tangle expected_fail_rem.org
|
|
|
+#+begin_src org -n :tangle heading_id_rem.org
|
|
|
+ ,* 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:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org -n :tangle heading_move_exp.org
|
|
|
+
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Moving Headings
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org -n :tangle heading_move_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 -n :tangle heading_move_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 -n :tangle heading_move_rem.org
|
|
|
+ ,* Matching ID Headings
|
|
|
+ ,* Changing the order of headings
|
|
|
+ ,** heading 1
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: 1
|
|
|
+ ,:END:
|
|
|
+ ,** heading 2
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: 2
|
|
|
+ ,:END:
|
|
|
+ ,- some new text in remote
|
|
|
+ ,** heading 3
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: 3
|
|
|
+ ,:END:
|
|
|
+ ,** heading 4
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: 4
|
|
|
+ ,:END:
|
|
|
+ ,* 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
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: ABC
|
|
|
+ ,:END:
|
|
|
+ ,* heading 2
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: DEF
|
|
|
+ ,:END:
|
|
|
+ ,* heading 3
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: GHI
|
|
|
+ ,: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:
|
|
|
+ ,*** heading 3
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:ID: GHI
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org -n :tangle heading_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 -n :tangle heading_move_exp.org
|
|
|
+
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Cookies
|
|
|
+Make sure that
|
|
|
+*** 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
|
|
|
+#+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]
|
|
|
+#+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]
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org -n :tangle heading_tags_exp.org
|
|
|
+#+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_remove_exp.org
|
|
|
,* Basket
|
|
|
,** Green Apple
|
|
|
,*** Seed 2
|
|
|
- ,- new text
|
|
|
,** Red Apple
|
|
|
,*** Seed 1
|
|
|
- ,*** Seed 2
|
|
|
#+end_src
|
|
|
+** Cookies
|
|
|
+
|
|
|
+*** 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
|
|
|
+#+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]
|
|
|
+#+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]
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org -n :tangle heading_tags_exp.org
|
|
|
+#+end_src
|
|
|
+
|
|
|
+* Properties
|
|
|
+#+tblname: property_tests
|
|
|
+| 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 |
|
|
|
+
|
|
|
+#+begin_src sh :tangle property_tests.sh :var tests=property_tests[2:-1,1] :var expects=property_tests[2:-1,3]
|
|
|
+ <<check_merge_rules>>
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Property Add
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org :tangle property_add_anc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Apple: green
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Local
|
|
|
+#+begin_src org :tangle property_add_loc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Apple: green
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org :tangle property_add_rem.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: Brown
|
|
|
+ ,:Apple: green
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org -n :tangle property_add_exp.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: Brown
|
|
|
+ ,:Apple: green
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Property Update
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org :tangle property_update_anc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: Brown
|
|
|
+ ,:Apple: green
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Local
|
|
|
+#+begin_src org :tangle property_update_loc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: White
|
|
|
+ ,:Apple: yellow
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org :tangle property_update_rem.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: white
|
|
|
+ ,:Apple: red
|
|
|
+ ,:Basket: plastic
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org :tangle property_update_exp.org
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Property Remove
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org :tangle property_remove_anc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: Brown
|
|
|
+ ,:Apple: green
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Local
|
|
|
+#+begin_src org :tangle property_remove_loc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Apple: green
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org :tangle property_remove_rem.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: Brown
|
|
|
+ ,:Apple: green
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org :tangle property_remove_exp.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Apple: green
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Property Spacing
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org :tangle property_spacing_anc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ ,:Bread: Brown
|
|
|
+ ,:Apple: green
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Local
|
|
|
+#+begin_src org :tangle property_spacing_loc.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ , :Bread: White
|
|
|
+ , :Apple: yellow
|
|
|
+ ,:Basket: wicker
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org :tangle property_spacing_rem.org
|
|
|
+ ,* Picnic Basket
|
|
|
+ ,:PROPERTIES:
|
|
|
+ , :Bread: white
|
|
|
+ ,:Apple: red
|
|
|
+ ,:Basket: plastic
|
|
|
+ ,:END:
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org :tangle property_spacing_exp.org
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Property Integration
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org :tangle property_anc.org
|
|
|
+ ,* 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
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Local
|
|
|
+#+begin_src org :tangle property_loc.org
|
|
|
+ ,* 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
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org :tangle property_rem.org
|
|
|
+ ,* 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
|
|
|
+#+end_src
|
|
|
+
|
|
|
*** Expected Output
|
|
|
-#+begin_src org -n :tangle expected_fail_exp.org
|
|
|
- ,* Basket
|
|
|
- ,** Green Apple
|
|
|
- ,*** Seed 1
|
|
|
- ,*** Seed 2
|
|
|
- ,** Red Apple
|
|
|
- ,*** Seed 1
|
|
|
- ,*** Seed 2
|
|
|
+#+begin_src org -n :tangle property_exp.org
|
|
|
#+end_src
|
|
|
|
|
|
*** Output
|
|
|
- #+CALL: <name>(<arguments>)
|
|
|
+* Text
|
|
|
+#+tblname: text_tests
|
|
|
+| Test Name | test-name | Result | Notes |
|
|
|
+|------------------+------------------+--------+-------|
|
|
|
+| [[Text Integration]] | text_integration | ok | TODO |
|
|
|
+
|
|
|
+#+begin_src sh :tangle text_tests.sh :var tests=text_tests[2:-1,1] :var expects=text_tests[2:-1,3]
|
|
|
+ <<check_merge_rules>>
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Text Integration
|
|
|
+*** Ancestor
|
|
|
+#+begin_src org :tangle text_integration_anc.org
|
|
|
+ ,Some text.
|
|
|
+ ,* Heading 1
|
|
|
+ ,Some text.
|
|
|
+ ,This text will be updated.
|
|
|
+ ,This is a different element.
|
|
|
+ ,more text
|
|
|
+ ,* Heading 2
|
|
|
+ ,apple
|
|
|
+ ,banana
|
|
|
+ ,orange
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Local
|
|
|
+#+begin_src org -n :tangle text_integration_loc.org
|
|
|
+ ,+ 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
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Remote
|
|
|
+#+begin_src org -n :tangle text_integration_rem.org
|
|
|
+ ,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
|
|
|
+#+end_src
|
|
|
+
|
|
|
+*** Expected Output
|
|
|
+#+begin_src org -n :tangle text_integration_exp.org
|
|
|
+#+end_src
|
|
|
+
|
|
|
+* Other Tests
|
|
|
* Testing Code
|
|
|
This file can be used in two ways:
|
|
|
1. Update the table of test results
|
|
@@ -170,24 +831,39 @@ This file can be used in two ways:
|
|
|
To update this file, and rerun all the tests do ??.
|
|
|
|
|
|
To run the tests the other way, do a make check.
|
|
|
-** Merge Driver
|
|
|
-Call the org-merge-driver program.
|
|
|
+** Org Merge Driver
|
|
|
+Call org-merge-driver.
|
|
|
#+name: org-merge-driver
|
|
|
-#+begin_src sh :var test="heading_remove"
|
|
|
- ../src/org-merge-driver ${test}_anc.org ${test}_loc.org ${test}_rem.org
|
|
|
+#+begin_src sh
|
|
|
+ ./src/org-merge-driver ${test}_anc.org ${test}_loc.org ${test}_rem.org 1> ${test}_res.org
|
|
|
#+end_src
|
|
|
|
|
|
-** Test Runner
|
|
|
-This function runs an individual test.
|
|
|
+** TAP Test Runner
|
|
|
+This function runs an individual test, and outputs the results in TAP
|
|
|
+format.
|
|
|
#+name: test-runner
|
|
|
#+headers: :tangle test_runner.sh :noweb yes
|
|
|
-#+begin_src sh :exports code :var test="expected_fail"
|
|
|
- result="not ok"
|
|
|
- if <<org-merge-driver>> | diff ./${test}_exp.org - > /dev/null
|
|
|
- then
|
|
|
- result="ok"
|
|
|
- fi
|
|
|
- echo -n "$result"
|
|
|
+#+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"
|
|
|
+#+end_src
|
|
|
+
|
|
|
+** Suite Runner
|
|
|
+Run all tests in a table.
|
|
|
+#+name: test-suite-runner
|
|
|
+#+headers: :var tests=org-merge-driver-tests[2:-1,1] :results output :tangle test-suite-runner.sh
|
|
|
+#+begin_src sh
|
|
|
+ #!/bin/bash
|
|
|
+ count=${#tests[@]}
|
|
|
+ for i in ${tests}
|
|
|
+ do
|
|
|
+ $(echo ./${i}.sh)
|
|
|
+ done
|
|
|
#+end_src
|
|
|
|
|
|
** TAP Suite Runner
|
|
@@ -195,30 +871,45 @@ 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.
|
|
|
|
|
|
-*** Extract Columns
|
|
|
-To make sure that the extracted column is embedded in the tangled
|
|
|
-script, it has to be the result of an evaluated piece of code.
|
|
|
+** Merge Rule Tester
|
|
|
+#+name: check_merge_rules
|
|
|
+#+headers: :tangle check_merge_rules.sh :results value verbatim
|
|
|
+#+headers: :var tests=heading_tests[2:-1,1] :var expects=heading_tests[2:-1,3]
|
|
|
+#+begin_src sh
|
|
|
+ #!/bin/bash
|
|
|
+ oldifs=$IFS
|
|
|
+ echo tests = $tests
|
|
|
+ IFS="
|
|
|
+ " t_array=($tests)
|
|
|
+ IFS="
|
|
|
+ " e_array=($expects)
|
|
|
+ e_array=("${expects}")
|
|
|
+ count=${#t_array[@]}
|
|
|
+ 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
|
|
|
+ <<test-runner>>
|
|
|
+ echo -n " # "
|
|
|
+ if [ "nil" != "$expect" ]; then echo -n "$expect"
|
|
|
+ fi
|
|
|
+ echo " $test"
|
|
|
+ done
|
|
|
+ IFS=$oldifs
|
|
|
+#+end_src
|
|
|
|
|
|
-#+name: extract-column
|
|
|
-#+begin_src emacs-lisp :var column=org-merge-driver-tests[2:4,1]
|
|
|
- column
|
|
|
+** Table Help Functions
|
|
|
+#+name: sum_oks
|
|
|
+#+begin_src emacs-lisp :var list=heading_tests[2:-1,1]
|
|
|
+ (let ((ok-sum 0))
|
|
|
+ (mapcar '(lambda (string) (if (string= string "ok") (incf ok-sum))) list)
|
|
|
+ ok-sum)
|
|
|
#+end_src
|
|
|
|
|
|
-*** Suite Runner
|
|
|
-Run a test, and print the results in TAP format.
|
|
|
-#+name: check_merge_rules :var tests=org-merge-driver-tests[0:2,1]
|
|
|
-#+headers: :tangle check_merge_rules.sh :exports code :results value :noweb yes
|
|
|
-#+begin_src sh
|
|
|
- #!/bin/bash
|
|
|
- tests=<<extract-column(column=org-merge-driver-tests[2:4,1])>>
|
|
|
- expects=<<extract-column(column=org-merge-driver-tests[2:4,3])>>
|
|
|
- count=${#tests[@]}
|
|
|
- echo 1..$count
|
|
|
- for i in seq 1 $count
|
|
|
- do
|
|
|
- test=${tests[i-1]}
|
|
|
- expect=${expects[i-1]}
|
|
|
- <<test-runner>>
|
|
|
- echo "# $expect $test"
|
|
|
- done
|
|
|
+#+name: col_length
|
|
|
+#+begin_src emacs-lisp :var list='(1 2 3)
|
|
|
+ (length list)
|
|
|
#+end_src
|