public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* TDD for Lua filters
@ 2022-06-17 21:19 ` denis.maier-NSENcxR/0n0
       [not found]   ` <e60c5df6203a41b8862f7a360b479ea8-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-06-17 21:19 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi
Is there any way to use tests when developing Lua filters? Of course, you can just compare the document produced with the filter against the expected output with diff or so, but maybe there's a better approach...?

All the best,
Denis 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: TDD for Lua filters
       [not found]   ` <e60c5df6203a41b8862f7a360b479ea8-NSENcxR/0n0@public.gmane.org>
@ 2022-06-17 22:08     ` Bastien DUMONT
  2022-06-18 14:52     ` jcr
  1 sibling, 0 replies; 5+ messages in thread
From: Bastien DUMONT @ 2022-06-17 22:08 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I tried to do this for the last filter I wrote. I wrote a separate file with my assert() functions and wrote a Makefile to concatenate it automatically with the filter file (removing the return instruction) and run it with pandoc. Except that I have to alternate between the main script and the temporary file when correcting bugs, I am rather satisfied with this setup. Here it is:
https://bastien-dumont.onmypc.net/git/bdumont/pandoc-lua-filters/src/branch/master/margin-notes

Le Friday 17 June 2022 à 09:19:08PM, denis.maier-NSENcxR/0n0@public.gmane.org a écrit :
> Hi
> Is there any way to use tests when developing Lua filters? Of course, you can just compare the document produced with the filter against the expected output with diff or so, but maybe there's a better approach...?
> 
> All the best,
> Denis 
> 
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e60c5df6203a41b8862f7a360b479ea8%40unibe.ch.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/Yqz7S/qegYB7yXAG%40localhost.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: TDD for Lua filters
       [not found]   ` <e60c5df6203a41b8862f7a360b479ea8-NSENcxR/0n0@public.gmane.org>
  2022-06-17 22:08     ` Bastien DUMONT
@ 2022-06-18 14:52     ` jcr
       [not found]       ` <105db0c3-2956-4915-ba6a-dc3048b324c7n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: jcr @ 2022-06-18 14:52 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1374 bytes --]

I use shelltestrunner <https://github.com/simonmichael/shelltestrunner> for 
this: the input is a simple markdown document, the command runs pandoc with 
the filter, and the output is the expected markdown. Of course, it would be 
easy to use any other text-based input or output format that pandoc 
supports. I also use this to test the CSL style I developed: I can supply a 
reference to format in a YAML block in the input, and use 
`markdown-citations` as the output format to check the formatted result.

The only disadvantage is that testing is a bit slow, because pandoc is 
invoked once for every test case.

On Friday, June 17, 2022 at 11:19:15 PM UTC+2 denis...-NSENcxR/0n0@public.gmane.org wrote:

> Hi
> Is there any way to use tests when developing Lua filters? Of course, you 
> can just compare the document produced with the filter against the expected 
> output with diff or so, but maybe there's a better approach...?
>
> All the best,
> Denis 

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/105db0c3-2956-4915-ba6a-dc3048b324c7n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1929 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* AW: TDD for Lua filters
       [not found]       ` <105db0c3-2956-4915-ba6a-dc3048b324c7n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-06-20  9:01         ` denis.maier-NSENcxR/0n0
       [not found]           ` <24ebd7f15f2c49828d138e404924b589-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-06-20  9:01 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2546 bytes --]

Thanks for the hints. I will have a look. Shelltestrunner looks quite interesting, but a simple makefile as described by Bastien might be already enough. (At least, this is also what seems to be used in the pandoc-lua-filters repo...)

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von jcr
Gesendet: Samstag, 18. Juni 2022 16:52
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Re: TDD for Lua filters

I use shelltestrunner<https://github.com/simonmichael/shelltestrunner> for this: the input is a simple markdown document, the command runs pandoc with the filter, and the output is the expected markdown. Of course, it would be easy to use any other text-based input or output format that pandoc supports. I also use this to test the CSL style I developed: I can supply a reference to format in a YAML block in the input, and use `markdown-citations` as the output format to check the formatted result.

The only disadvantage is that testing is a bit slow, because pandoc is invoked once for every test case.

On Friday, June 17, 2022 at 11:19:15 PM UTC+2 denis...-NSENcxR/0n0@public.gmane.org<mailto:denis...-NSENcxR/0n0@public.gmane.org> wrote:
Hi
Is there any way to use tests when developing Lua filters? Of course, you can just compare the document produced with the filter against the expected output with diff or so, but maybe there's a better approach...?

All the best,
Denis
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/105db0c3-2956-4915-ba6a-dc3048b324c7n%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/105db0c3-2956-4915-ba6a-dc3048b324c7n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/24ebd7f15f2c49828d138e404924b589%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 5880 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AW: TDD for Lua filters
       [not found]           ` <24ebd7f15f2c49828d138e404924b589-NSENcxR/0n0@public.gmane.org>
@ 2022-06-20  9:24             ` Bastien DUMONT
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien DUMONT @ 2022-06-20  9:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Actually it is a bit different, since I test the functions individually. For the whole filter, I only have a sample file that does not cover all possible cases.

Le Monday 20 June 2022 à 09:01:15AM, denis.maier-NSENcxR/0n0@public.gmane.org a écrit :
> Thanks for the hints. I will have a look. Shelltestrunner looks quite
> interesting, but a simple makefile as described by Bastien might be already
> enough. (At least, this is also what seems to be used in the pandoc-lua-filters
> repo...)
> 
>  
> 
> Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im
> Auftrag von jcr
> Gesendet: Samstag, 18. Juni 2022 16:52
> An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> Betreff: Re: TDD for Lua filters
> 
>  
> 
> I use [1] shelltestrunner for this: the input is a simple markdown document,
> the command runs pandoc with the filter, and the output is the expected
> markdown. Of course, it would be easy to use any other text-based input or
> output format that pandoc supports. I also use this to test the CSL style I
> developed: I can supply a reference to format in a YAML block in the input, and
> use `markdown-citations` as the output format to check the formatted result.
> 
>  
> 
> The only disadvantage is that testing is a bit slow, because pandoc is invoked
> once for every test case.
> 
>  
> 
> On Friday, June 17, 2022 at 11:19:15 PM UTC+2 [2]denis...-NSENcxR/0n0@public.gmane.org wrote:
> 
>     Hi
>     Is there any way to use tests when developing Lua filters? Of course, you
>     can just compare the document produced with the filter against the expected
>     output with diff or so, but maybe there's a better approach...?
> 
>     All the best,
>     Denis
> 
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to [3]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [4]https://groups.google.com/d/msgid/
> pandoc-discuss/105db0c3-2956-4915-ba6a-dc3048b324c7n%40googlegroups.com.
> 
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [6]https://groups.google.com/d/msgid/
> pandoc-discuss/24ebd7f15f2c49828d138e404924b589%40unibe.ch.
> 
> References:
> 
> [1] https://github.com/simonmichael/shelltestrunner
> [2] mailto:denis...-NSENcxR/0n0@public.gmane.org
> [3] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [4] https://groups.google.com/d/msgid/pandoc-discuss/105db0c3-2956-4915-ba6a-dc3048b324c7n%40googlegroups.com?utm_medium=email&utm_source=footer
> [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [6] https://groups.google.com/d/msgid/pandoc-discuss/24ebd7f15f2c49828d138e404924b589%40unibe.ch?utm_medium=email&utm_source=footer

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YrA8vJ6imlkuUHf3%40localhost.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-20  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AQHYgo+TK9VdmT6SQ0qqtZh51kr5pA==>
2022-06-17 21:19 ` TDD for Lua filters denis.maier-NSENcxR/0n0
     [not found]   ` <e60c5df6203a41b8862f7a360b479ea8-NSENcxR/0n0@public.gmane.org>
2022-06-17 22:08     ` Bastien DUMONT
2022-06-18 14:52     ` jcr
     [not found]       ` <105db0c3-2956-4915-ba6a-dc3048b324c7n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-20  9:01         ` AW: " denis.maier-NSENcxR/0n0
     [not found]           ` <24ebd7f15f2c49828d138e404924b589-NSENcxR/0n0@public.gmane.org>
2022-06-20  9:24             ` Bastien DUMONT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).