From abc04691a0dd68e8c2318cf98017704ed00a1046 Mon Sep 17 00:00:00 2001 From: Vincent Arel-Bundock Date: Mon, 22 Jan 2024 21:36:16 -0500 Subject: [PATCH] more tests --- .../_tinysnapshot/escape_label_title.txt | 1 - .../_tinysnapshot/rbind-add_rows_rbind.txt | 38 +++++++++---------- inst/tinytest/test-escape.R | 17 +++++---- inst/tinytest/test-rbind.R | 3 +- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/inst/tinytest/_tinysnapshot/escape_label_title.txt b/inst/tinytest/_tinysnapshot/escape_label_title.txt index ff4a91493..ce21eb0e6 100644 --- a/inst/tinytest/_tinysnapshot/escape_label_title.txt +++ b/inst/tinytest/_tinysnapshot/escape_label_title.txt @@ -1,7 +1,6 @@ \begin{table} \centering \caption{Blah\_blah \label{tab:blah-blah}} -\centering \begin{tabular}[t]{lc} \toprule & (1)\\ diff --git a/inst/tinytest/_tinysnapshot/rbind-add_rows_rbind.txt b/inst/tinytest/_tinysnapshot/rbind-add_rows_rbind.txt index 1a9881216..a550f1b18 100644 --- a/inst/tinytest/_tinysnapshot/rbind-add_rows_rbind.txt +++ b/inst/tinytest/_tinysnapshot/rbind-add_rows_rbind.txt @@ -1,21 +1,21 @@ -| | (1) | (2) | -|:------------|---------:|---------:| -| (Intercept) | 20.091 | -5.114 | -| | (1.065) | (10.030) | -| qsec | | 1.412 | -| | | (0.559) | -| R2 | 0.000 | 0.175 | -| Info | ??? | XYZ | -| Num.Obs. | 32 | 32 | -| RMSE | 5.93 | 5.39 | -|:------------|---------:|---------:| -| (Intercept) | 146.687 | 631.704 | -| | (12.120) | (88.700) | -| qsec | | -27.174 | -| | | (4.946) | -| R2 | 0.000 | 0.502 | -| Num.Obs. | 32 | 32 | -| RMSE | 67.48 | 47.64 | -|:------------|---------:|---------:| +| | (1) | (2) | +|:------------|--------:|--------:| +| (Intercept) | 20.09 | -5.11 | +| | (1.07) | (10.03) | +| qsec | | 1.41 | +| | | (0.56) | +| R2 | 0.000 | 0.175 | +| Info | ??? | XYZ | +| Num.Obs. | 32 | 32 | +| RMSE | 5.93 | 5.39 | +|:------------|--------:|--------:| +| (Intercept) | 146.69 | 631.70 | +| | (12.12) | (88.70) | +| qsec | | -27.17 | +| | | (4.95) | +| R2 | 0.000 | 0.502 | +| Num.Obs. | 32 | 32 | +| RMSE | 67.48 | 47.64 | +|:------------|--------:|--------:| diff --git a/inst/tinytest/test-escape.R b/inst/tinytest/test-escape.R index 7fcce7756..ae0cb0cb6 100644 --- a/inst/tinytest/test-escape.R +++ b/inst/tinytest/test-escape.R @@ -154,13 +154,6 @@ expect_snapshot_print( "escape-panel_escape_TRUE") -# Issue #594: escape LaTeX label -if (!requiet("tinysnapshot")) exit_file("tinysnapshot") -using("tinysnapshot") -mod <- lm(mpg ~ hp, mtcars) -expect_snapshot_print( - modelsummary(mod, "latex", title = "Blah_blah \\label{tab:blah-blah}"), - "escape_label_title") # Issue #560 and #693 mod <- lm(mpg ~ I(wt^2) * disp, data = mtcars) @@ -177,3 +170,13 @@ est_comb <- feols(y ~ x1 | fe1 +fe2 +fe3, data = base, cluster= "fe1^fe2") expect_snapshot_print( modelsummary(est_comb, output = "latex", escape = TRUE), "escape-hat_fixest") + + +exit_file("minor snapshot diff, possibly related to kableExtra version") +# Issue #594: escape LaTeX label +if (!requiet("tinysnapshot")) exit_file("tinysnapshot") +using("tinysnapshot") +mod <- lm(mpg ~ hp, mtcars) +expect_snapshot_print( + modelsummary(mod, "latex", title = "Blah_blah \\label{tab:blah-blah}"), + "escape_label_title") diff --git a/inst/tinytest/test-rbind.R b/inst/tinytest/test-rbind.R index d0e9f36d9..a19eee1d8 100644 --- a/inst/tinytest/test-rbind.R +++ b/inst/tinytest/test-rbind.R @@ -115,9 +115,10 @@ panels <- list( expect_snapshot_print( modelsummary( panels, + fmt = 2, # tolerance output = "markdown", shape = "rbind", gof_map = gm, add_rows = rows), "rbind-add_rows_rbind" -) \ No newline at end of file +)