Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct printing output for topleft information #956

Merged
merged 4 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading