Skip to content

wrapping usage #265

Closed
Closed

Description

@schloerke

Hello,

I ran into a case where the usage section does not wrap when an argument is defaulted to "\"'".

I've included a gist that shows this issue: https://gist.github.com/schloerke/ed2fc2947e97480b4946

Thanks,
Barret

Activity

  1. added a commit that references this issue on Aug 29, 2014
  2. hadley commented on Aug 29, 2014

    @hadley
    Member

    Test case if I try again in the future.

    test_that("breaking works after escapes (#265)", {
    
      out <- roc_proc_text(rd_roclet(), "
        #' Long args
        f <- function(
          xxxxxxxxxxxxxxxxxx1,
          xxxxxxxxxxxxxxxxxx2,
          xxxxxxxxxxxxxxxxxx3,
          x = \"\\\"'\",
          xxxxxxxxxxxxxxxxxx4,
          xxxxxxxxxxxxxxxxxx5,
          xxxxxxxxxxxxxxxxxx6,
          xxxxxxxxxxxxxxxxxx7
      ){}")[[1]]
      usage <- format(get_tag(out, "usage"))
      expect_equal(str_count(usage, "\n"), 5)
    })
  3. reopened this on Aug 29, 2014
  4. hadley commented on Oct 6, 2015

    @hadley
    Member

    This seems ok to me now:

    x <- "xxxxxxxxxxxxxxxxxx1,\nxxxxxxxxxxxxxxxxxx2,\nxxxxxxxxxxxxxxxxxx3,\nx = \"\\\"'\",\nxxxxxxxxxxxxxxxxxx4,\nxxxxxxxxxxxxxxxxxx5,\nxxxxxxxxxxxxxxxxxx6,\nxxxxxxxxxxxxxxxxxx7"
    width <- function(x) nchar(strsplit(x, "\n")[[1]])
    width(wrapString(x))
    #> [1] 73 64 21
  5. hadley commented on Oct 6, 2015

    @hadley
    Member

    Ooops, no it's not:

    out <- roc_proc_text(rd_roclet(), "\n  #' Long args\n    f <- function(\n    xxxxxxxxxxxxxxxxxx1,\n    xxxxxxxxxxxxxxxxxx2,\n    xxxxxxxxxxxxxxxxxx3,\n    x = \"\\\"'\",\n    xxxxxxxxxxxxxxxxxx4,\n    xxxxxxxxxxxxxxxxxx5,\n    xxxxxxxxxxxxxxxxxx6,\n    xxxxxxxxxxxxxxxxxx7\n    ){}")[[1]]
    usage <- format(get_tag(out, "usage"))
    cat(usage)
    #> \usage{
    #> f(xxxxxxxxxxxxxxxxxx1, xxxxxxxxxxxxxxxxxx2, xxxxxxxxxxxxxxxxxx3,
    #>   x = "\\"'", xxxxxxxxxxxxxxxxxx4, xxxxxxxxxxxxxxxxxx5, xxxxxxxxxxxxxxxxxx6, xxxxxxxxxxxxxxxxxx7)
    #> }
  6. reopened this on Oct 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions