Skip to content

Commit

Permalink
Add unit tests for fancy lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Aug 18, 2022
1 parent 4a03457 commit f74dbd8
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/support/markdownthemewitiko_markdown_test.sty
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,43 @@
\TYPE{olBegin}},
olBeginTight = {%
\TYPE{olBeginTight}},
fancyOlBegin = {%
\TYPE{BEGIN fancyOlBegin}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{END fancyOlBegin}},
fancyOlBeginTight = {%
\TYPE{BEGIN fancyOlBeginTight}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{END fancyOlBeginTight}},
olItem = {%
\TYPE{olItem}},
olItemEnd = {%
\TYPE{olItemEnd}},
olItemWithNumber = {%
\TYPE{olItemWithNumber: #1}},
fancyOlItem = {%
\TYPE{BEGIN fancyOlItem}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{END fancyOlItem}},
fancyOlItemEnd = {%
\TYPE{FancyOlItemEnd}},
fancyOlItemWithNumber = {%
\TYPE{BEGIN fancyOlItemWithNumber}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{- number: #3}%
\TYPE{END fancyOlItemWithNumber}},
olEnd = {%
\TYPE{olEnd}},
olEndTight = {%
\TYPE{olEndTight}},
fancyOlEnd = {%
\TYPE{fancyOlEnd}},
fancyOlEndTight = {%
\TYPE{fancyOlEndTight}},
dlBegin = {%
\TYPE{dlBegin}},
dlBeginTight = {%
Expand Down
27 changes: 27 additions & 0 deletions tests/support/plain-setup.tex
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,43 @@
\TYPE{olBegin}}%
\def\markdownRendererOlBeginTight{%
\TYPE{olBeginTight}}%
\def\markdownRendererFancyOlBegin#1#2{%
\TYPE{BEGIN fancyOlBegin}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{END fancyOlBegin}}%
\def\markdownRendererFancyOlBeginTight#1#2{%
\TYPE{BEGIN fancyOlBeginTight}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{END fancyOlBeginTight}}%
\def\markdownRendererOlItem{%
\TYPE{olItem}}%
\def\markdownRendererOlItemEnd{%
\TYPE{olItemEnd}}%
\def\markdownRendererOlItemWithNumber#1{%
\TYPE{olItemWithNumber: #1}}%
\def\markdownRendererFancyOlItem#1#2{%
\TYPE{BEGIN fancyOlItem}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{END fancyOlItem}}%
\def\markdownRendererFancyOlItemEnd{%
\TYPE{fancyOlItemEnd}}%
\def\markdownRendererFancyOlItemWithNumber#1#2#3{%
\TYPE{BEGIN fancyOlItemWithNumber}%
\TYPE{- numstyle: #1}%
\TYPE{- numdelim: #2}%
\TYPE{- number: #3}%
\TYPE{END fancyOlItemWithNumber}}%
\def\markdownRendererOlEnd{%
\TYPE{olEnd}}%
\def\markdownRendererOlEndTight{%
\TYPE{olEndTight}}%
\def\markdownRendererFancyOlEnd{%
\TYPE{fancyOlEnd}}%
\def\markdownRendererFancyOlEndTight{%
\TYPE{fancyOlEndTight}}%
\def\markdownRendererDlBegin{%
\TYPE{dlBegin}}%
\def\markdownRendererDlBeginTight{%
Expand Down
127 changes: 127 additions & 0 deletions tests/testfiles/lunamark-markdown/fancy-lists.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
\def\markdownOptionFancyLists{true}
<<<
This test ensures that the Lua `fancyLists` option correctly propagates
through the plain TeX interface and that the `startNumber` and `tightLists`
options are enabled by default.

Fancy list (*roman, lower*)

iv. item

v. item

Fancy list (*roman, upper, tight*)

IV. item
V. item

Fancy list (*alpha, lower*)

d. item

e. item

Fancy list (*alpha, upper, tight*)

D. item
E. item

Fancy list (*paren*)

4) item

5) item
>>>
documentBegin
codeSpan: fancyLists
codeSpan: startNumber
codeSpan: tightLists
interblockSeparator
emphasis: roman, lower
interblockSeparator
BEGIN fancyOlBegin
- numstyle: LowerRoman
- numdelim: Period
END fancyOlBegin
BEGIN fancyOlItemWithNumber
- numstyle: LowerRoman
- numdelim: Period
- number: 4
END fancyOlItemWithNumber
fancyOlItemEnd
BEGIN fancyOlItemWithNumber
- numstyle: LowerRoman
- numdelim: Period
- number: 5
END fancyOlItemWithNumber
fancyOlItemEnd
fancyOlEnd
interblockSeparator
emphasis: roman, upper, tight
interblockSeparator
BEGIN fancyOlBeginTight
- numstyle: UpperRoman
- numdelim: Period
END fancyOlBeginTight
BEGIN fancyOlItemWithNumber
- numstyle: UpperRoman
- numdelim: Period
- number: 4
END fancyOlItemWithNumber
fancyOlItemEnd
fancyOlEndTight
interblockSeparator
emphasis: alpha, lower
interblockSeparator
BEGIN fancyOlBegin
- numstyle: LowerAlpha
- numdelim: Period
END fancyOlBegin
BEGIN fancyOlItemWithNumber
- numstyle: LowerAlpha
- numdelim: Period
- number: 4
END fancyOlItemWithNumber
fancyOlItemEnd
BEGIN fancyOlItemWithNumber
- numstyle: LowerAlpha
- numdelim: Period
- number: 5
END fancyOlItemWithNumber
fancyOlItemEnd
fancyOlEnd
interblockSeparator
emphasis: alpha, upper, tight
interblockSeparator
BEGIN fancyOlBeginTight
- numstyle: UpperAlpha
- numdelim: Period
END fancyOlBeginTight
BEGIN fancyOlItemWithNumber
- numstyle: UpperAlpha
- numdelim: Period
- number: 4
END fancyOlItemWithNumber
fancyOlItemEnd
fancyOlEndTight
interblockSeparator
emphasis: paren
interblockSeparator
BEGIN fancyOlBegin
- numstyle: Decimal
- numdelim: OneParen
END fancyOlBegin
BEGIN fancyOlItemWithNumber
- numstyle: Decimal
- numdelim: OneParen
- number: 4
END fancyOlItemWithNumber
fancyOlItemEnd
BEGIN fancyOlItemWithNumber
- numstyle: Decimal
- numdelim: OneParen
- number: 5
END fancyOlItemWithNumber
fancyOlItemEnd
fancyOlEnd
documentEnd
46 changes: 46 additions & 0 deletions tests/testfiles/lunamark-markdown/no-fancy-lists.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<<<
This test ensures that the Lua `fancyLists` option is disabled by default.

Fancy list (*roman, lower*)

i. item
i. item

Fancy list (*roman, upper*)

I. item
I. item

Fancy list (*alpha, lower*)

a. item
a. item

Fancy list (*alpha, upper*)

A. item
A. item

Fancy list (*paren*)

1) item
1) item
>>>
documentBegin
codeSpan: fancyLists
interblockSeparator
emphasis: roman, lower
interblockSeparator
interblockSeparator
emphasis: roman, upper
interblockSeparator
interblockSeparator
emphasis: alpha, lower
interblockSeparator
interblockSeparator
emphasis: alpha, upper
interblockSeparator
interblockSeparator
emphasis: paren
interblockSeparator
documentEnd

0 comments on commit f74dbd8

Please sign in to comment.