Skip to content

Commit

Permalink
Correct printing output for topleft information (#956)
Browse files Browse the repository at this point in the history
Fixes #942

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: shajoezhu <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent 88428b3 commit 38fc099
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
sd-direction: upstream
deps-installation-method: setup-r-dependencies
lookup-refs: |
insightsengineering/formatters
default-landing-page: latest-tag
additional-unit-test-report-directories: unit-test-report-non-cran
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ URL: https://github.com/insightsengineering/rtables,
https://insightsengineering.github.io/rtables/
BugReports: https://github.com/insightsengineering/rtables/issues
Depends:
formatters (>= 0.5.9),
formatters (>= 0.5.9.9004),
magrittr (>= 1.5),
methods,
R (>= 2.10)
Expand Down
18 changes: 13 additions & 5 deletions tests/testthat/test-printing.R
Original file line number Diff line number Diff line change
Expand Up @@ -656,17 +656,25 @@ test_that("row label indentation is kept even if there are newline characters",

test_that("Support for newline characters in all the parts", {
out <- strsplit(toString(tt_for_nl, hsep = "-"), "\\n")[[1]]
mf <- matrix_form(tt_for_nl, TRUE)

# topleft is correctly aligned
expect_equal(
mf$strings[seq(mf_nlheader(mf)), 1],
unlist(strsplit(paste0(top_left(tt_for_nl), collapse = "\n"), "\n"))
)

expected <- c(
"why not",
"also here",
"",
"---------------------------------",
" ",
" ARM ",
" ",
"a A ",
"b A wo",
"d TWO ",
"a ARM ",
"b ",
"d A ",
" A wo",
" TWO ",
"c words rd ",
"---------------------------------",
"m ",
Expand Down

0 comments on commit 38fc099

Please sign in to comment.