From 1a46f693b95e384d12911f01e4ac250235bb7c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Novotn=C3=BD?= Date: Fri, 19 Aug 2022 00:02:01 +0200 Subject: [PATCH] Add unit tests for fancy lists --- .../markdownthemewitiko_markdown_test.sty | 27 ++++ tests/support/plain-setup.tex | 27 ++++ .../lunamark-markdown/fancy-lists.test | 127 ++++++++++++++++++ .../lunamark-markdown/no-fancy-lists.test | 46 +++++++ 4 files changed, 227 insertions(+) create mode 100644 tests/testfiles/lunamark-markdown/fancy-lists.test create mode 100644 tests/testfiles/lunamark-markdown/no-fancy-lists.test diff --git a/tests/support/markdownthemewitiko_markdown_test.sty b/tests/support/markdownthemewitiko_markdown_test.sty index b0c926900..d238450df 100644 --- a/tests/support/markdownthemewitiko_markdown_test.sty +++ b/tests/support/markdownthemewitiko_markdown_test.sty @@ -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 = {% diff --git a/tests/support/plain-setup.tex b/tests/support/plain-setup.tex index 92d7314db..b05610eec 100644 --- a/tests/support/plain-setup.tex +++ b/tests/support/plain-setup.tex @@ -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{% diff --git a/tests/testfiles/lunamark-markdown/fancy-lists.test b/tests/testfiles/lunamark-markdown/fancy-lists.test new file mode 100644 index 000000000..a92bfd001 --- /dev/null +++ b/tests/testfiles/lunamark-markdown/fancy-lists.test @@ -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 diff --git a/tests/testfiles/lunamark-markdown/no-fancy-lists.test b/tests/testfiles/lunamark-markdown/no-fancy-lists.test new file mode 100644 index 000000000..8fe2595d3 --- /dev/null +++ b/tests/testfiles/lunamark-markdown/no-fancy-lists.test @@ -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