Skip to content

Commit

Permalink
complete regression fixes from #49
Browse files Browse the repository at this point in the history
  • Loading branch information
brodieG committed Aug 1, 2016
1 parent 9bc590b commit cf0c58b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 4 additions & 3 deletions R/core.R
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,11 @@ line_diff <- function(
Map(dat.up, cur.dat, diff.word$cur.dat, MoreArgs=list(ind=cur.rh))

# Mark the lines that were wrapped diffed; necessary b/c tar/cur.rh are
# defined even if other conditions to get in this loop are not
# defined even if other conditions to get in this loop are not, and also
# because the addition of the fill lines moves everything around

tar.wrap.diff <- tar.rh
cur.wrap.diff <- cur.rh
tar.wrap.diff <- seq_along(tar.dat$fill)[!tar.dat$fill][tar.rh]
cur.wrap.diff <- seq_along(cur.dat$fill)[!cur.dat$fill][cur.rh]
}
# Actual line diff

Expand Down
12 changes: 5 additions & 7 deletions tests/testthat/testthat.atomic.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ test_that("Basic Tests", {
)
})
test_that("Word wrap in atomic", {
A <- B <- c(letters, LETTERS)
A <- A.1 <- B <- c(letters, LETTERS)
B[15] <- "Alabama"
A.1[5] <- "Ee"
C <- A[-15]
D <- C
E <- B[-45]

# Test simple changes to vectors; at 80 columns removing 1:8 corresponds to
# row deletion
Expand All @@ -64,21 +68,15 @@ test_that("Word wrap in atomic", {
)
# Different wrap frequency and removed words that span lines

A.1 <- A
A.1[5] <- "Ee"
expect_equal_to_reference(
as.character(diffPrint(A, A.1[-(13:18)])), rdsf(1425)
)
# Removing words

C <- A[-15]
expect_equal_to_reference(as.character(diffPrint(C, B)), rdsf(1450))

# Two hunks

D <- C
E <- B[-45]

expect_equal_to_reference(as.character(diffPrint(D, E)), rdsf(1500))
expect_equal_to_reference(as.character(diffPrint(E, D)), rdsf(1600))

Expand Down

0 comments on commit cf0c58b

Please sign in to comment.