tests/testthat/test-repipe.R

test_that("repiping works", {
  tst <- "df %>%
  group_by(my.groups) %>%
  filter(this.col == \"bad.news\") %>%
  .$new.col %>%
  grepl(\"has.dots...\", .) %>%
  paste(collapse = \" \") %>%
  .[['more.dots']] %>%
  foo(...=~ .) %>%
  sum() |>
  exp() %>% plogis() %>% grepl(\"text\", .) %>%
  .exp()"

  rslt <- "df |>
  group_by(my.groups) |>
  filter(this.col == \"bad.news\") %>%
  .$new.col %>%
  grepl(\"has.dots...\", .) |>
  paste(collapse = \" \") %>%
  .[['more.dots']] %>%
  foo(...=~ .) |>
  sum() |>
  exp() |> plogis() %>% grepl(\"text\", .) |>
  .exp()"

  expect_equal(.change_pipe_text(tst), rslt)
})
tsostarics/repipe documentation built on Dec. 23, 2021, 12:59 p.m.