Compare commits
143 Commits
v0.1.9
...
dd009498dd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd009498dd | ||
|
|
17c745ee71 | ||
|
|
41aa0349a0 | ||
|
|
a6adeee40b | ||
|
|
a32cea8139 | ||
|
|
37bc5ef712 | ||
|
|
1a2f0856da | ||
|
|
3f707149e3 | ||
|
|
e9276e35ca | ||
|
|
3041a575f9 | ||
|
|
42dbda494a | ||
|
|
0e791e67ab | ||
|
|
ba55e0df4f | ||
|
|
d987b9b75b | ||
|
|
aa253c38dd | ||
|
|
ceb5376b21 | ||
|
|
b64c1c944b | ||
|
|
8bc79f9ef3 | ||
|
|
488372b070 | ||
|
|
120a06055f | ||
|
|
bbcafef8bf | ||
|
|
038535174b | ||
|
|
1bbe8fc688 | ||
|
|
ba8115c648 | ||
|
|
0030ef4459 | ||
|
|
20a8683894 | ||
|
|
3aa84c1743 | ||
|
|
7196e10b69 | ||
|
|
0c34df159f | ||
|
|
ddb09a1805 | ||
|
|
c58b850570 | ||
|
|
a55694176c | ||
|
|
6973d5a2c0 | ||
|
|
592e773920 | ||
|
|
be553aefb1 | ||
|
|
5694f80f41 | ||
|
|
36327e92d7 | ||
|
|
c70eb69ed6 | ||
|
|
8d9ff77799 | ||
|
|
029791e0b2 | ||
|
|
8d621b32dc | ||
|
|
dfad7b7888 | ||
|
|
56348a6d54 | ||
|
|
65e142a215 | ||
|
|
aa0a0b890e | ||
|
|
ab33730830 | ||
|
|
4c8828b91b | ||
|
|
2ba5156ee1 | ||
|
|
ae3a6ff919 | ||
|
|
4716e1ce5b | ||
|
|
89fcf6cb54 | ||
|
|
f220fd63e5 | ||
|
|
7cf1f7b7bb | ||
|
|
135ca133ea | ||
|
|
d126488891 | ||
|
|
51748afd41 | ||
|
|
e84135985e | ||
|
|
448902bb05 | ||
|
|
65df18171a | ||
|
|
e2bc58a469 | ||
|
|
fbe3c76ab7 | ||
|
|
368c6a457e | ||
|
|
c7dbe596b3 | ||
|
|
3da52a0826 | ||
|
|
ae11e390d1 | ||
|
|
45dd38ac2d | ||
|
|
7af18e2312 | ||
|
|
1b603f3a05 | ||
|
|
d06e4de7b0 | ||
|
|
e686666ea0 | ||
|
|
672848d06a | ||
|
|
627c785e24 | ||
|
|
758e224e6d | ||
|
|
f79606047e | ||
|
|
dd3de67a8c | ||
|
|
823426a4f1 | ||
|
|
fa97124186 | ||
|
|
885fefd060 | ||
|
|
efac73798f | ||
|
|
68e392811e | ||
|
|
343af41f78 | ||
|
|
f49a1853ad | ||
|
|
6bd8d9efd7 | ||
|
|
18ad80e018 | ||
|
|
34a0858473 | ||
|
|
4ba9d7439a | ||
|
|
6f0439bb6d | ||
|
|
b478b6f5d7 | ||
|
|
02af3d0081 | ||
|
|
40685f05cc | ||
|
|
e21701b97c | ||
|
|
ef8a6884fe | ||
|
|
ac7125d9b6 | ||
|
|
58ca9569a6 | ||
|
|
1da521b08a | ||
|
|
386ad5091d | ||
|
|
5f84cd974d | ||
|
|
d8ea450a46 | ||
|
|
3742f4fa08 | ||
|
|
11a7234900 | ||
|
|
50a3631b79 | ||
|
|
da2d7535e8 | ||
|
|
1351577c5a | ||
|
|
65eda08843 | ||
|
|
b82d4c0eca | ||
|
|
93fe46e4e7 | ||
|
|
5b308ea76f | ||
|
|
ab4a0c1224 | ||
|
|
786521ad4a | ||
|
|
d8102b7bc2 | ||
|
|
a26640355c | ||
|
|
057c8a1387 | ||
|
|
4fc81e983a | ||
|
|
258e9485de | ||
|
|
87ac18e6b2 | ||
|
|
e1e4ac75e4 | ||
|
|
c877116540 | ||
|
|
8e70773b15 | ||
|
|
f046b16c11 | ||
|
|
1ab7d2f2d7 | ||
|
|
a548c7e170 | ||
|
|
b556f4617f | ||
|
|
13163f2468 | ||
|
|
da5dcd4c1b | ||
|
|
d059afef07 | ||
|
|
bcade66e68 | ||
|
|
301a6db83e | ||
|
|
32da06776c | ||
|
|
169bf69f5e | ||
|
|
7ee48ff65c | ||
|
|
afb43ff34f | ||
|
|
b56d847cfa | ||
|
|
1503054994 | ||
|
|
03028889bd | ||
|
|
317293f0f2 | ||
|
|
3d7f411cf9 | ||
|
|
650cbc17db | ||
|
|
1d7770e590 | ||
|
|
bf038db31c | ||
|
|
4cdf88a632 | ||
|
|
2eaef82fdb | ||
|
|
00dc7b636c | ||
|
|
e6c809ab03 |
7
Makefile
7
Makefile
@@ -46,6 +46,13 @@ dockertest:
|
|||||||
> $(MAKE) -C docker/organic_test
|
> $(MAKE) -C docker/organic_test
|
||||||
> docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS)
|
> docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS)
|
||||||
|
|
||||||
|
.PHONY: buildtest
|
||||||
|
buildtest:
|
||||||
|
> cargo build --no-default-features
|
||||||
|
> cargo build --no-default-features --features compare
|
||||||
|
> cargo build --no-default-features --features tracing
|
||||||
|
> cargo build --no-default-features --features compare,tracing
|
||||||
|
|
||||||
.PHONY: foreign_document_test
|
.PHONY: foreign_document_test
|
||||||
foreign_document_test:
|
foreign_document_test:
|
||||||
> $(MAKE) -C docker/organic_test run_foreign_document_test
|
> $(MAKE) -C docker/organic_test run_foreign_document_test
|
||||||
|
|||||||
17
org_mode_samples/affiliated_keyword/all_name.org
Normal file
17
org_mode_samples/affiliated_keyword/all_name.org
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#+name: foo
|
||||||
|
: bar
|
||||||
|
|
||||||
|
#+source: foo
|
||||||
|
: bar
|
||||||
|
|
||||||
|
#+tblname: foo
|
||||||
|
: bar
|
||||||
|
|
||||||
|
#+resname: foo
|
||||||
|
: bar
|
||||||
|
|
||||||
|
#+srcname: foo
|
||||||
|
: bar
|
||||||
|
|
||||||
|
#+label: foo
|
||||||
|
: bar
|
||||||
8
org_mode_samples/affiliated_keyword/case_insensitive.org
Normal file
8
org_mode_samples/affiliated_keyword/case_insensitive.org
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
bar
|
||||||
|
|
||||||
|
#+NaMe: baz
|
||||||
|
cat
|
||||||
|
|
||||||
|
#+name: lorem
|
||||||
|
ipsum
|
||||||
6
org_mode_samples/affiliated_keyword/multiple_name.org
Normal file
6
org_mode_samples/affiliated_keyword/multiple_name.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#+name: foo
|
||||||
|
#+source: bar
|
||||||
|
#+name: baz
|
||||||
|
#+tblname: lorem
|
||||||
|
#+label: ipsum
|
||||||
|
: dolar
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#+tblname: foo
|
||||||
|
: bar
|
||||||
10
org_mode_samples/greater_element/drawer/name.org
Normal file
10
org_mode_samples/greater_element/drawer/name.org
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
* Headline
|
||||||
|
before
|
||||||
|
#+NAME: foo
|
||||||
|
:candle:
|
||||||
|
inside
|
||||||
|
|
||||||
|
the drawer
|
||||||
|
:end:
|
||||||
|
|
||||||
|
after
|
||||||
7
org_mode_samples/greater_element/dynamic_block/name.org
Normal file
7
org_mode_samples/greater_element/dynamic_block/name.org
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+BEGIN: clocktable :scope file :maxlevel 2
|
||||||
|
#+CAPTION: Clock summary at [2023-08-25 Fri 05:34]
|
||||||
|
| Headline | Time |
|
||||||
|
|--------------+--------|
|
||||||
|
| *Total time* | *0:00* |
|
||||||
|
#+END:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#+begin_center
|
||||||
|
|
||||||
|
#+end_center
|
||||||
|
|
||||||
|
#+begin_center
|
||||||
|
#+NAME: foo
|
||||||
|
|
||||||
|
#+end_center
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_center
|
||||||
|
|
||||||
|
#+end_center
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_quote
|
||||||
|
|
||||||
|
#+end_quote
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_defun
|
||||||
|
foo
|
||||||
|
|
||||||
|
{{{bar(baz)}}}
|
||||||
|
#+end_defun
|
||||||
2
org_mode_samples/greater_element/plain_list/name.org
Normal file
2
org_mode_samples/greater_element/plain_list/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
1. bar
|
||||||
2
org_mode_samples/greater_element/table/name.org
Normal file
2
org_mode_samples/greater_element/table/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
| foo | bar |
|
||||||
3
org_mode_samples/lesser_element/babel_call/empty.org
Normal file
3
org_mode_samples/lesser_element/babel_call/empty.org
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#+call:
|
||||||
|
|
||||||
|
#+call:
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+call: foo[inside](bar="baz")[outside]
|
||||||
|
|
||||||
|
#+call: foo[](bar="baz")[]
|
||||||
@@ -1 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
#+call: foo(bar="baz")
|
#+call: foo(bar="baz")
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+call: foo[inside](bar="baz")[outside]
|
||||||
|
|
||||||
|
#+call: foo[[inside]](bar="baz")[outside]
|
||||||
|
|
||||||
|
#+call: foo[inside]((bar="baz"))[outside]
|
||||||
|
|
||||||
|
#+call: foo[inside](bar="baz")[[outside]]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#+call: foo(bar="baz"
|
||||||
7
org_mode_samples/lesser_element/babel_call/simple.org
Normal file
7
org_mode_samples/lesser_element/babel_call/simple.org
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#+call: foo(bar="baz")
|
||||||
|
|
||||||
|
#+call: lorem ipsum
|
||||||
|
|
||||||
|
#+call: dolar cat(dog)
|
||||||
|
|
||||||
|
#+call: (bat)
|
||||||
3
org_mode_samples/lesser_element/babel_call/spaces.org
Normal file
3
org_mode_samples/lesser_element/babel_call/spaces.org
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#+call: foo [inside] (bar="baz") [outside]
|
||||||
|
|
||||||
|
#+call: foo (bar="baz") [outside]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CLOCK: [2023-04-21 Fri 19:32]--[2023-04-21 Fri 19:35]
|
||||||
3
org_mode_samples/lesser_element/clock/name.org
Normal file
3
org_mode_samples/lesser_element/clock/name.org
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
CLOCK: [2023-04-21 Fri 19:32]--[2023-04-21 Fri 19:35] => 0:03
|
||||||
|
#+NAME: foo
|
||||||
|
CLOCK: [2023-04-21 Fri 19:43]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CLOCK: [2023-04-21 Fri 19:43] => 0:03
|
||||||
2
org_mode_samples/lesser_element/clock/time_range.org
Normal file
2
org_mode_samples/lesser_element/clock/time_range.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
CLOCK: [1970-01-01 Thu 8:15-13:15otherrest +1w -1d] => 0:03
|
||||||
|
CLOCK: [1970-01-01 Thu 8:15-13:15otherrest +1w -1d]
|
||||||
2
org_mode_samples/lesser_element/comment/name.org
Normal file
2
org_mode_samples/lesser_element/comment/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
# Comments cannot have affiliated keywords.
|
||||||
2
org_mode_samples/lesser_element/diary_sexp/name.org
Normal file
2
org_mode_samples/lesser_element/diary_sexp/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
%%(foo)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
: bar
|
||||||
2
org_mode_samples/lesser_element/horizontal_rule/name.org
Normal file
2
org_mode_samples/lesser_element/horizontal_rule/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
-----
|
||||||
2
org_mode_samples/lesser_element/keyword/name.org
Normal file
2
org_mode_samples/lesser_element/keyword/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+FOO: BAR
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
\begin{foo}
|
||||||
|
bar
|
||||||
|
\end{foo}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#+begin_comment
|
||||||
|
,* foo
|
||||||
|
,,,** bar
|
||||||
|
,*** baz
|
||||||
|
lorem
|
||||||
|
, ipsum
|
||||||
|
,#+begin_src dolar
|
||||||
|
|
||||||
|
,#+end_src
|
||||||
|
#+end_comment
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_comment text
|
||||||
|
bar
|
||||||
|
#+end_comment
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+begin_comment
|
||||||
|
This is a comment
|
||||||
|
,* with an escaped line.
|
||||||
|
#+end_comment
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_comment -n 20
|
||||||
|
foo
|
||||||
|
#+end_comment
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#+begin_example
|
||||||
|
,* foo
|
||||||
|
,,,** bar
|
||||||
|
,*** baz
|
||||||
|
lorem
|
||||||
|
, ipsum
|
||||||
|
,#+begin_src dolar
|
||||||
|
|
||||||
|
,#+end_src
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+begin_example python :exports results
|
||||||
|
print("foo")
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example python -n :exports results
|
||||||
|
print("foo")
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_example elisp -n 5
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+begin_example -n -10
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example +n -15
|
||||||
|
bar
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+begin_example -n 0
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example +n 0
|
||||||
|
bar
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#+begin_example -n 5
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
# Line numbering starts at 15 for the example below since it uses +n.
|
||||||
|
#+begin_example +n 10
|
||||||
|
bar
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_example text
|
||||||
|
bar
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_example foo -k
|
||||||
|
bar
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_example foo -n bar -k baz
|
||||||
|
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#+begin_example text -i
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example text -n -i
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example text
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example text -n -r -k
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#+begin_example text
|
||||||
|
foo
|
||||||
|
bar (ref:here)
|
||||||
|
baz
|
||||||
|
#+end_example
|
||||||
|
Link to the reference: [[(here)]]
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#+begin_example
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#+BEGIN_EXAMPLE elisp -n -r -l "((%s))"
|
||||||
|
foo
|
||||||
|
#+END_EXAMPLE
|
||||||
|
|
||||||
|
#+BEGIN_EXAMPLE elisp -k -n -r -l "((%s))"
|
||||||
|
foo
|
||||||
|
#+END_EXAMPLE
|
||||||
|
|
||||||
|
#+BEGIN_EXAMPLE elisp -k 8 -n -r -l "((%s))"
|
||||||
|
foo
|
||||||
|
#+END_EXAMPLE
|
||||||
|
|
||||||
|
#+BEGIN_EXAMPLE elisp -n -r -k -l "((%s))"
|
||||||
|
foo
|
||||||
|
#+END_EXAMPLE
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_example +n 10
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#+begin_export html
|
||||||
|
,* foo
|
||||||
|
,,,** bar
|
||||||
|
,*** baz
|
||||||
|
lorem
|
||||||
|
, ipsum
|
||||||
|
,#+begin_src dolar
|
||||||
|
|
||||||
|
,#+end_src
|
||||||
|
#+end_export
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_export text
|
||||||
|
bar
|
||||||
|
#+end_export
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_export latex
|
||||||
|
This would be LaTeX code.
|
||||||
|
#+end_export
|
||||||
6
org_mode_samples/lesser_element/lesser_block/nested.org
Normal file
6
org_mode_samples/lesser_element/lesser_block/nested.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Verse blocks are the only lesser blocks that contain objects
|
||||||
|
#+begin_verse
|
||||||
|
#+begin_comment
|
||||||
|
This is a comment.
|
||||||
|
#+end_comment
|
||||||
|
#+end_verse
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+begin_src python :exports results
|
||||||
|
print("foo")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src python -n :exports results
|
||||||
|
print("foo")
|
||||||
|
#+end_src
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_src text
|
||||||
|
bar
|
||||||
|
#+end_src
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+begin_src python :exports results
|
||||||
|
print("foo")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src python -n :exports results
|
||||||
|
print("foo")
|
||||||
|
#+end_src
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#+begin_src foo -n bar -k baz
|
||||||
|
|
||||||
|
#+end_src
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#+begin_src text -i
|
||||||
|
foo
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src text -n -i
|
||||||
|
foo
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src text
|
||||||
|
foo
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src text -n -r -k
|
||||||
|
foo
|
||||||
|
#+end_src
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#+begin_src text
|
||||||
|
foo
|
||||||
|
bar (ref:here)
|
||||||
|
baz
|
||||||
|
#+end_src
|
||||||
|
Link to the reference: [[(here)]]
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
#+begin_verse text
|
||||||
|
bar
|
||||||
|
#+end_verse
|
||||||
2
org_mode_samples/lesser_element/paragraph/name.org
Normal file
2
org_mode_samples/lesser_element/paragraph/name.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#+NAME: foo
|
||||||
|
bar
|
||||||
2
org_mode_samples/object/angle_link/application.org
Normal file
2
org_mode_samples/object/angle_link/application.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<file+sys://foo>
|
||||||
|
<file+emacs://foo>
|
||||||
13
org_mode_samples/object/angle_link/code_ref_link.org
Normal file
13
org_mode_samples/object/angle_link/code_ref_link.org
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<(foo)>
|
||||||
|
|
||||||
|
<((bar))>
|
||||||
|
|
||||||
|
<((baz)>
|
||||||
|
|
||||||
|
<(lo
|
||||||
|
rem)>
|
||||||
|
|
||||||
|
# These become fuzzy
|
||||||
|
<(foo) >
|
||||||
|
< (foo)>
|
||||||
|
<(foo)::3>
|
||||||
6
org_mode_samples/object/angle_link/custom_id_link.org
Normal file
6
org_mode_samples/object/angle_link/custom_id_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<#foo>
|
||||||
|
|
||||||
|
<#fo
|
||||||
|
o>
|
||||||
|
|
||||||
|
<#foo::3>
|
||||||
1
org_mode_samples/object/angle_link/elisp.org
Normal file
1
org_mode_samples/object/angle_link/elisp.org
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<elisp:(local-set-key "\M-\x" 'foo-bar-baz)>
|
||||||
21
org_mode_samples/object/angle_link/file_link.org
Normal file
21
org_mode_samples/object/angle_link/file_link.org
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<./simple.org>
|
||||||
|
<../simple.org>
|
||||||
|
</simple.org>
|
||||||
|
<file:simple.org>
|
||||||
|
<file:sim ple.org>
|
||||||
|
|
||||||
|
<file:simp
|
||||||
|
le.org>
|
||||||
|
|
||||||
|
<file:simple.org::3>
|
||||||
|
<file:simple.org::foo>
|
||||||
|
<file:simple.org::#foo>
|
||||||
|
<file:simple.org::foo bar>
|
||||||
|
<file:simple.org::foo
|
||||||
|
bar>
|
||||||
|
<file:simple.org::foo
|
||||||
|
bar>
|
||||||
|
<file:simple.org::foo
|
||||||
|
bar>
|
||||||
|
<file:simple.org::foo::bar>
|
||||||
|
<file:simple.org::/foo/>
|
||||||
6
org_mode_samples/object/angle_link/fuzzy_link.org
Normal file
6
org_mode_samples/object/angle_link/fuzzy_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<elisp.org>
|
||||||
|
|
||||||
|
<eli
|
||||||
|
sp.org>
|
||||||
|
|
||||||
|
<elisp.org::3>
|
||||||
6
org_mode_samples/object/angle_link/id_link.org
Normal file
6
org_mode_samples/object/angle_link/id_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<id:83986bdf-987c-465d-8851-44cb4c02a86c>
|
||||||
|
|
||||||
|
<id:83986bdf-987c-465d
|
||||||
|
-8851-44cb4c02a86c>
|
||||||
|
|
||||||
|
<id:83986bdf-987c-465d-8851-44cb4c02a86c::foo>
|
||||||
20
org_mode_samples/object/angle_link/multiple_slashes.org
Normal file
20
org_mode_samples/object/angle_link/multiple_slashes.org
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<file:foo>
|
||||||
|
<file:/bar>
|
||||||
|
<file://baz>
|
||||||
|
<file:///lorem>
|
||||||
|
<file:////ipsum>
|
||||||
|
<file://///dolar>
|
||||||
|
|
||||||
|
<foo>
|
||||||
|
</bar>
|
||||||
|
<//baz>
|
||||||
|
<///lorem>
|
||||||
|
<////ipsum>
|
||||||
|
</////dolar>
|
||||||
|
|
||||||
|
<https:foo>
|
||||||
|
<https:/bar>
|
||||||
|
<https://baz>
|
||||||
|
<https:///lorem>
|
||||||
|
<https:////ipsum>
|
||||||
|
<https://///dolar>
|
||||||
6
org_mode_samples/object/angle_link/protocol_link.org
Normal file
6
org_mode_samples/object/angle_link/protocol_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<shell:foo>
|
||||||
|
|
||||||
|
<shell:fo
|
||||||
|
o>
|
||||||
|
|
||||||
|
<shell:foo::3>
|
||||||
16
org_mode_samples/object/angle_link/search_option.org
Normal file
16
org_mode_samples/object/angle_link/search_option.org
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<file:simple.org::foo>
|
||||||
|
|
||||||
|
<file:simple.org::#foo>
|
||||||
|
<file:simple.org::foo bar>
|
||||||
|
<file:simple.org::foo
|
||||||
|
bar>
|
||||||
|
<file:simple.org::foo::bar>
|
||||||
|
<file:simple.org::/foo/>
|
||||||
|
|
||||||
|
<file://en.wikipedia.org/wiki/Shebang_(Uni::x)>
|
||||||
|
|
||||||
|
|
||||||
|
<file:simple.org::*>
|
||||||
|
<file:simple.org::* foo>
|
||||||
|
<file:simple.org::*bar>
|
||||||
|
<file:simple.org::b*az>
|
||||||
1
org_mode_samples/object/angle_link/simple.org
Normal file
1
org_mode_samples/object/angle_link/simple.org
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<https://fizz.buzz/>
|
||||||
6
org_mode_samples/object/angle_link/template.org
Normal file
6
org_mode_samples/object/angle_link/template.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#+LINK: foo https://foo.bar/baz#%s
|
||||||
|
<foo::lorem>
|
||||||
|
|
||||||
|
<cat::bat>
|
||||||
|
#+LINK: cat dog%s
|
||||||
|
<cat:bat>
|
||||||
1
org_mode_samples/object/angle_link/with_parenthesis.org
Normal file
1
org_mode_samples/object/angle_link/with_parenthesis.org
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<https://en.wikipedia.org/wiki/Shebang_(Unix)>
|
||||||
7
org_mode_samples/object/macro/escape.org
Normal file
7
org_mode_samples/object/macro/escape.org
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{{{foo}}}
|
||||||
|
|
||||||
|
{{{fo\o}}}
|
||||||
|
|
||||||
|
{{{foo(b\ar)}}}
|
||||||
|
|
||||||
|
{{{foo(b\,r)}}}
|
||||||
4
org_mode_samples/object/macro/whitespace_in_args.org
Normal file
4
org_mode_samples/object/macro/whitespace_in_args.org
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{{{foo(bar baz)}}}
|
||||||
|
|
||||||
|
{{{foo(bar
|
||||||
|
baz)}}}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
non-link text::foo
|
||||||
|
eww://foo::foo
|
||||||
|
rmail://foo::foo
|
||||||
|
mhe://foo::foo
|
||||||
|
irc://foo::foo
|
||||||
|
info://foo::foo
|
||||||
|
gnus://foo::foo
|
||||||
|
docview://foo::foo
|
||||||
|
bibtex://foo::foo
|
||||||
|
bbdb://foo::foo
|
||||||
|
w3m://foo::foo
|
||||||
|
doi://foo::foo
|
||||||
|
file+sys://foo::foo
|
||||||
|
file+emacs://foo::foo
|
||||||
|
shell://foo::foo
|
||||||
|
news://foo::foo
|
||||||
|
mailto://foo::foo
|
||||||
|
https://foo::foo
|
||||||
|
http://foo::foo
|
||||||
|
ftp://foo::foo
|
||||||
|
help://foo::foo
|
||||||
|
file://foo::foo
|
||||||
|
elisp://foo::foo
|
||||||
|
randomfakeprotocl://foo::foo
|
||||||
|
non-link text::foo
|
||||||
13
org_mode_samples/object/plain_link/multiple_slashes.org
Normal file
13
org_mode_samples/object/plain_link/multiple_slashes.org
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
file:foo
|
||||||
|
file:/bar
|
||||||
|
file://baz
|
||||||
|
file:///lorem
|
||||||
|
file:////ipsum
|
||||||
|
file://///dolar
|
||||||
|
|
||||||
|
https:foo
|
||||||
|
https:/bar
|
||||||
|
https://baz
|
||||||
|
https:///lorem
|
||||||
|
https:////ipsum
|
||||||
|
https://///dolar
|
||||||
4
org_mode_samples/object/plain_link/relative_path.org
Normal file
4
org_mode_samples/object/plain_link/relative_path.org
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# These do not become links
|
||||||
|
./simple.org::foo
|
||||||
|
../simple.org::foo
|
||||||
|
/simple.org::foo
|
||||||
15
org_mode_samples/object/plain_link/search_option.org
Normal file
15
org_mode_samples/object/plain_link/search_option.org
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
file:simple.org::foo
|
||||||
|
|
||||||
|
file:simple.org::#foo
|
||||||
|
file:simple.org::foo bar
|
||||||
|
file:simple.org::foo
|
||||||
|
bar
|
||||||
|
file:simple.org::foo::bar
|
||||||
|
file:simple.org::/foo/
|
||||||
|
|
||||||
|
file://en.wikipedia.org/wiki/Shebang_(Uni::x)
|
||||||
|
|
||||||
|
|
||||||
|
file:simple.org::* foo
|
||||||
|
file:simple.org::*bar
|
||||||
|
file:simple.org::b*az
|
||||||
8
org_mode_samples/object/plain_link/template.org
Normal file
8
org_mode_samples/object/plain_link/template.org
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# None of these end up as links.
|
||||||
|
|
||||||
|
#+LINK: foo https://foo.bar/baz#%s
|
||||||
|
foo::lorem
|
||||||
|
|
||||||
|
cat::bat
|
||||||
|
#+LINK: cat https://dog%s
|
||||||
|
cat:bat
|
||||||
25
org_mode_samples/object/regular_link/all_default_links.org
Normal file
25
org_mode_samples/object/regular_link/all_default_links.org
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
non-link text
|
||||||
|
[[eww://foo]]
|
||||||
|
[[rmail://foo]]
|
||||||
|
[[mhe://foo]]
|
||||||
|
[[irc://foo]]
|
||||||
|
[[info://foo]]
|
||||||
|
[[gnus://foo]]
|
||||||
|
[[docview://foo]]
|
||||||
|
[[bibtex://foo]]
|
||||||
|
[[bbdb://foo]]
|
||||||
|
[[w3m://foo]]
|
||||||
|
[[doi://foo]]
|
||||||
|
[[file+sys://foo]]
|
||||||
|
[[file+emacs://foo]]
|
||||||
|
[[shell://foo]]
|
||||||
|
[[news://foo]]
|
||||||
|
[[mailto://foo]]
|
||||||
|
[[https://foo]]
|
||||||
|
[[http://foo]]
|
||||||
|
[[ftp://foo]]
|
||||||
|
[[help://foo]]
|
||||||
|
[[file://foo]]
|
||||||
|
[[elisp://foo]]
|
||||||
|
[[randomfakeprotocl://foo]]
|
||||||
|
non-link text
|
||||||
2
org_mode_samples/object/regular_link/application.org
Normal file
2
org_mode_samples/object/regular_link/application.org
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[[file+sys://foo]]
|
||||||
|
[[file+emacs://foo]]
|
||||||
13
org_mode_samples/object/regular_link/code_ref_link.org
Normal file
13
org_mode_samples/object/regular_link/code_ref_link.org
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[[(foo)]]
|
||||||
|
|
||||||
|
[[((bar))]]
|
||||||
|
|
||||||
|
[[((baz)]]
|
||||||
|
|
||||||
|
[[(lo
|
||||||
|
rem)]]
|
||||||
|
|
||||||
|
# These become fuzzy
|
||||||
|
[[(foo) ]]
|
||||||
|
[[ (foo)]]
|
||||||
|
[[(foo)::3]]
|
||||||
6
org_mode_samples/object/regular_link/custom_id_link.org
Normal file
6
org_mode_samples/object/regular_link/custom_id_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[[#foo]]
|
||||||
|
|
||||||
|
[[#fo
|
||||||
|
o]]
|
||||||
|
|
||||||
|
[[#foo::3]]
|
||||||
21
org_mode_samples/object/regular_link/file_link.org
Normal file
21
org_mode_samples/object/regular_link/file_link.org
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
[[./simple.org]]
|
||||||
|
[[../simple.org]]
|
||||||
|
[[/simple.org]]
|
||||||
|
[[file:simple.org]]
|
||||||
|
[[file:sim ple.org]]
|
||||||
|
|
||||||
|
[[file:simp
|
||||||
|
le.org]]
|
||||||
|
|
||||||
|
[[file:simple.org::3]]
|
||||||
|
[[file:simple.org::foo]]
|
||||||
|
[[file:simple.org::#foo]]
|
||||||
|
[[file:simple.org::foo bar]]
|
||||||
|
[[file:simple.org::foo
|
||||||
|
bar]]
|
||||||
|
[[file:simple.org::foo
|
||||||
|
bar]]
|
||||||
|
[[file:simple.org::foo
|
||||||
|
bar]]
|
||||||
|
[[file:simple.org::foo::bar]]
|
||||||
|
[[file:simple.org::/foo/]]
|
||||||
6
org_mode_samples/object/regular_link/fuzzy_link.org
Normal file
6
org_mode_samples/object/regular_link/fuzzy_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[[elisp.org]]
|
||||||
|
|
||||||
|
[[eli
|
||||||
|
sp.org]]
|
||||||
|
|
||||||
|
[[elisp.org::3]]
|
||||||
6
org_mode_samples/object/regular_link/id_link.org
Normal file
6
org_mode_samples/object/regular_link/id_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[[id:83986bdf-987c-465d-8851-44cb4c02a86c]]
|
||||||
|
|
||||||
|
[[id:83986bdf-987c-465d
|
||||||
|
-8851-44cb4c02a86c]]
|
||||||
|
|
||||||
|
[[id:83986bdf-987c-465d-8851-44cb4c02a86c::foo]]
|
||||||
20
org_mode_samples/object/regular_link/multiple_slashes.org
Normal file
20
org_mode_samples/object/regular_link/multiple_slashes.org
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[[file:foo]]
|
||||||
|
[[file:/bar]]
|
||||||
|
[[file://baz]]
|
||||||
|
[[file:///lorem]]
|
||||||
|
[[file:////ipsum]]
|
||||||
|
[[file://///dolar]]
|
||||||
|
|
||||||
|
[[foo]]
|
||||||
|
[[/bar]]
|
||||||
|
[[//baz]]
|
||||||
|
[[///lorem]]
|
||||||
|
[[////ipsum]]
|
||||||
|
[[/////dolar]]
|
||||||
|
|
||||||
|
[[https:foo]]
|
||||||
|
[[https:/bar]]
|
||||||
|
[[https://baz]]
|
||||||
|
[[https:///lorem]]
|
||||||
|
[[https:////ipsum]]
|
||||||
|
[[https://///dolar]]
|
||||||
6
org_mode_samples/object/regular_link/protocol_link.org
Normal file
6
org_mode_samples/object/regular_link/protocol_link.org
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[[shell:foo]]
|
||||||
|
|
||||||
|
[[shell:fo
|
||||||
|
o]]
|
||||||
|
|
||||||
|
[[shell:foo::3]]
|
||||||
16
org_mode_samples/object/regular_link/search_option.org
Normal file
16
org_mode_samples/object/regular_link/search_option.org
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[[file:simple.org::foo]]
|
||||||
|
|
||||||
|
[[file:simple.org::#foo]]
|
||||||
|
[[file:simple.org::foo bar]]
|
||||||
|
[[file:simple.org::foo
|
||||||
|
bar]]
|
||||||
|
[[file:simple.org::foo::bar]]
|
||||||
|
[[file:simple.org::/foo/]]
|
||||||
|
|
||||||
|
[[file://en.wikipedia.org/wiki/Shebang_(Uni::x)]]
|
||||||
|
|
||||||
|
|
||||||
|
[[file:simple.org::*]]
|
||||||
|
[[file:simple.org::* foo]]
|
||||||
|
[[file:simple.org::*bar]]
|
||||||
|
[[file:simple.org::b*az]]
|
||||||
7
org_mode_samples/object/regular_link/template.org
Normal file
7
org_mode_samples/object/regular_link/template.org
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#+LINK: foo https://foo.bar/baz#%s
|
||||||
|
[[foo::lorem]]
|
||||||
|
[[foo::ipsum][dolar]]
|
||||||
|
|
||||||
|
[[cat::bat]]
|
||||||
|
#+LINK: cat dog%s
|
||||||
|
[[cat:bat]]
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::compare::diff::compare_document;
|
use crate::compare::diff::compare_document;
|
||||||
|
use crate::compare::diff::DiffResult;
|
||||||
use crate::compare::parse::emacs_parse_anonymous_org_document;
|
use crate::compare::parse::emacs_parse_anonymous_org_document;
|
||||||
use crate::compare::parse::emacs_parse_file_org_document;
|
use crate::compare::parse::emacs_parse_file_org_document;
|
||||||
use crate::compare::parse::get_emacs_version;
|
use crate::compare::parse::get_emacs_version;
|
||||||
@@ -43,6 +44,12 @@ pub fn run_anonymous_compare_with_settings<P: AsRef<str>>(
|
|||||||
|
|
||||||
if diff_result.is_bad() {
|
if diff_result.is_bad() {
|
||||||
Err("Diff results do not match.")?;
|
Err("Diff results do not match.")?;
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"{color}Entire document passes.{reset}",
|
||||||
|
color = DiffResult::foreground_color(0, 255, 0),
|
||||||
|
reset = DiffResult::reset_color(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -83,6 +90,12 @@ pub fn run_compare_on_file_with_settings<P: AsRef<Path>>(
|
|||||||
|
|
||||||
if diff_result.is_bad() {
|
if diff_result.is_bad() {
|
||||||
Err("Diff results do not match.")?;
|
Err("Diff results do not match.")?;
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"{color}Entire document passes.{reset}",
|
||||||
|
color = DiffResult::foreground_color(0, 255, 0),
|
||||||
|
reset = DiffResult::reset_color(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
161
src/compare/compare_field.rs
Normal file
161
src/compare/compare_field.rs
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use super::diff::DiffStatus;
|
||||||
|
use super::sexp::unquote;
|
||||||
|
use super::sexp::Token;
|
||||||
|
use super::util::get_property;
|
||||||
|
use super::util::get_property_quoted_string;
|
||||||
|
use super::util::get_property_unquoted_atom;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub(crate) enum EmacsField<'s> {
|
||||||
|
Required(&'s str),
|
||||||
|
#[allow(dead_code)]
|
||||||
|
Optional(&'s str),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Do no comparison.
|
||||||
|
///
|
||||||
|
/// This is for when you want to acknowledge that a field exists in the emacs token, but you do not have any validation for it when using the compare_properties!() macro. Ideally, this should be kept to a minimum since this represents untested values.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub(crate) fn compare_noop<'b, 's, 'x, R, RG>(
|
||||||
|
_emacs: &'b Token<'s>,
|
||||||
|
_rust_node: R,
|
||||||
|
_emacs_field: &'x str,
|
||||||
|
_rust_value_getter: RG,
|
||||||
|
) -> Result<Option<(DiffStatus, Option<String>)>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Do no comparison.
|
||||||
|
///
|
||||||
|
/// This is for when you want to acknowledge that a field exists in the emacs token, but you do not have any validation for it when using the compare_properties!() macro. Ideally, this should be kept to a minimum since this represents untested values.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub(crate) fn compare_identity() -> () {
|
||||||
|
()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Assert that the emacs value is always nil or absent.
|
||||||
|
///
|
||||||
|
/// This is usually used for fields which, in my testing, are always nil. Using this compare function instead of simply doing a compare_noop will enable us to be alerted when we finally come across an org-mode document that has a value other than nil for the property.
|
||||||
|
pub(crate) fn compare_property_always_nil<'b, 's, 'x, R, RG>(
|
||||||
|
emacs: &'b Token<'s>,
|
||||||
|
_rust_node: R,
|
||||||
|
emacs_field: &'x str,
|
||||||
|
_rust_value_getter: RG,
|
||||||
|
) -> Result<Option<(DiffStatus, Option<String>)>, Box<dyn std::error::Error>> {
|
||||||
|
let value = get_property(emacs, emacs_field)?;
|
||||||
|
if value.is_some() {
|
||||||
|
let this_status = DiffStatus::Bad;
|
||||||
|
let message = Some(format!(
|
||||||
|
"{} was expected to always be nil: {:?}",
|
||||||
|
emacs_field, value
|
||||||
|
));
|
||||||
|
Ok(Some((this_status, message)))
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn compare_property_quoted_string<
|
||||||
|
'b,
|
||||||
|
's,
|
||||||
|
'x,
|
||||||
|
R,
|
||||||
|
RV: AsRef<str> + std::fmt::Debug,
|
||||||
|
RG: Fn(R) -> Option<RV>,
|
||||||
|
>(
|
||||||
|
emacs: &'b Token<'s>,
|
||||||
|
rust_node: R,
|
||||||
|
emacs_field: &'x str,
|
||||||
|
rust_value_getter: RG,
|
||||||
|
) -> Result<Option<(DiffStatus, Option<String>)>, Box<dyn std::error::Error>> {
|
||||||
|
let value = get_property_quoted_string(emacs, emacs_field)?;
|
||||||
|
let rust_value = rust_value_getter(rust_node);
|
||||||
|
if rust_value.as_ref().map(|s| s.as_ref()) != value.as_ref().map(String::as_str) {
|
||||||
|
let this_status = DiffStatus::Bad;
|
||||||
|
let message = Some(format!(
|
||||||
|
"{} mismatch (emacs != rust) {:?} != {:?}",
|
||||||
|
emacs_field, value, rust_value
|
||||||
|
));
|
||||||
|
Ok(Some((this_status, message)))
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn compare_property_unquoted_atom<'b, 's, 'x, R, RG: Fn(R) -> Option<&'s str>>(
|
||||||
|
emacs: &'b Token<'s>,
|
||||||
|
rust_node: R,
|
||||||
|
emacs_field: &'x str,
|
||||||
|
rust_value_getter: RG,
|
||||||
|
) -> Result<Option<(DiffStatus, Option<String>)>, Box<dyn std::error::Error>> {
|
||||||
|
let value = get_property_unquoted_atom(emacs, emacs_field)?;
|
||||||
|
let rust_value = rust_value_getter(rust_node);
|
||||||
|
if rust_value != value {
|
||||||
|
let this_status = DiffStatus::Bad;
|
||||||
|
let message = Some(format!(
|
||||||
|
"{} mismatch (emacs != rust) {:?} != {:?}",
|
||||||
|
emacs_field, value, rust_value
|
||||||
|
));
|
||||||
|
Ok(Some((this_status, message)))
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn compare_property_list_of_quoted_string<
|
||||||
|
'b,
|
||||||
|
's,
|
||||||
|
'x,
|
||||||
|
R,
|
||||||
|
RV: AsRef<str> + std::fmt::Debug,
|
||||||
|
RI: Iterator<Item = RV>,
|
||||||
|
RG: Fn(R) -> Option<RI>,
|
||||||
|
>(
|
||||||
|
emacs: &'b Token<'s>,
|
||||||
|
rust_node: R,
|
||||||
|
emacs_field: &'x str,
|
||||||
|
rust_value_getter: RG,
|
||||||
|
) -> Result<Option<(DiffStatus, Option<String>)>, Box<dyn std::error::Error>> {
|
||||||
|
let value = get_property(emacs, emacs_field)?
|
||||||
|
.map(Token::as_list)
|
||||||
|
.map_or(Ok(None), |r| r.map(Some))?;
|
||||||
|
let rust_value = rust_value_getter(rust_node);
|
||||||
|
// TODO: Seems we are needlessly coverting to a vec here.
|
||||||
|
let rust_value: Option<Vec<RV>> = rust_value.map(|it| it.collect());
|
||||||
|
match (value, &rust_value) {
|
||||||
|
(None, None) => {}
|
||||||
|
(None, Some(_)) | (Some(_), None) => {
|
||||||
|
let this_status = DiffStatus::Bad;
|
||||||
|
let message = Some(format!(
|
||||||
|
"{} mismatch (emacs != rust) {:?} != {:?}",
|
||||||
|
emacs_field, value, rust_value
|
||||||
|
));
|
||||||
|
return Ok(Some((this_status, message)));
|
||||||
|
}
|
||||||
|
(Some(el), Some(rl)) if el.len() != rl.len() => {
|
||||||
|
let this_status = DiffStatus::Bad;
|
||||||
|
let message = Some(format!(
|
||||||
|
"{} mismatch (emacs != rust) {:?} != {:?}",
|
||||||
|
emacs_field, value, rust_value
|
||||||
|
));
|
||||||
|
return Ok(Some((this_status, message)));
|
||||||
|
}
|
||||||
|
(Some(el), Some(rl)) => {
|
||||||
|
for (e, r) in el.iter().zip(rl) {
|
||||||
|
let e = unquote(e.as_atom()?)?;
|
||||||
|
let r = r.as_ref();
|
||||||
|
if e != r {
|
||||||
|
let this_status = DiffStatus::Bad;
|
||||||
|
let message = Some(format!(
|
||||||
|
"{} mismatch (emacs != rust) {:?} != {:?}. Full list: {:?} != {:?}",
|
||||||
|
emacs_field, e, r, value, rust_value
|
||||||
|
));
|
||||||
|
return Ok(Some((this_status, message)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
1176
src/compare/diff.rs
1176
src/compare/diff.rs
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user