vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
211 stars 18 forks source link

Update test-markdown.R #159

Closed florence-laflamme closed 8 months ago

florence-laflamme commented 9 months ago

Tests for bold columns, footnotes and missing value replacement in Markdown format.

vincentarelbundock commented 8 months ago

Looks great, thanks!

Before I merge, you would just need to generate the actual snapshot files. To do this, make sure you have the testing packages installed:

install.packages(c("tinytest", "tinysnapshot"))

Then, run this in your R console, making sure that the working directory is the base (root) of the tinytable repository:

library(tinytable)
library(tinytest)
run_test_file("inst/tinytest/test-markdown.R")

Finally, commit the new snapshot files to git, and push to Github.

Let me know if you have questions.

vincentarelbundock commented 8 months ago

Excellent! I merged it.

Can you continue to add a bunch of them? LaTeX files should be verified first in a Quarto document with format: pdf. And you can check HTML documents by using save_tt() to save them to a file, and look at them in the browser.

Ideally, I'd like to test all features of all functions in all output formats. I know that's a lot, and it'll not reasonable of me to expect full coverage but whatever you manage to do will be great.

I note: to test HTML files we need to call the print_html() function. See examples in test-html.R

florence-laflamme commented 8 months ago

Parfait, je vais travailler là-dessus!

florence-laflamme commented 8 months ago

Quick question:

I'm attempting to generate snapshots for tests in Latex using run_test_file("inst/tinytest/test-latex.R"), but I get this error message :Error in b@table_string : no applicable method for@applied to an object of class "tinytable". I think it's linked to the # Lazy style: group after style is respected test.

Do I have to run another command, or download another package, for tests in Latex ?

vincentarelbundock commented 8 months ago

Have you installed the very latest version of tinytable from github? In R:

library(remotes)
install_github("vincentarelbundock/tinytable")

Then, restart R and try again.