Skip to content

Commit 201a1f8

Browse files
add a new forward-compatibility test
1 parent 2c9f3bd commit 201a1f8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

inst/tests/tests.Rraw

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,24 +2292,26 @@ RHS = as.integer(DT$a)
22922292
test(754.06, DT[,a:=RHS,verbose=TRUE], output="RHS for item 1 has been duplicated")
22932293
# Expand ALTREPS in assign.c, #5400
22942294
# String conversion gets deferred
2295-
test(754.07, DT[,a:=as.character(a),verbose=TRUE], output="RHS for item 1 has been duplicated")
2295+
## first, a regression test of R itself -- we want to make sure our own test continues to be useful & testing its intended purpose
2296+
test(754.07, { a = 1:10; .Internal(inspect(a)); b = as.character(a); .Internal(inspect(b))}, output = "\\bcompact\\b.*\\bdeferred string conversion\\b")
2297+
test(754.08, DT[,a:=as.character(a),verbose=TRUE], output="RHS for item 1 has been duplicated")
22962298
# Executing the code inside of test expands the ALTREP so we repeat the code
22972299
# in order to check the result after a further assignment
22982300
DT = data.table(a=1:3)
22992301
DT[,b:=as.character(a)]
23002302
DT[, a:=5L]
2301-
test(754.08, DT, data.table(a=5L, b=as.character(1:3)))
2303+
test(754.09, DT, data.table(a=5L, b=as.character(1:3)))
23022304
# This function returns an ALTREP wrapper if the input is at least length 64
23032305
testFun = function(x) {
23042306
x[FALSE] = 1
23052307
x
23062308
}
23072309
DT = data.table(id=1:64, col1=0, col2=0)
2308-
test(754.09, DT[, col1 := testFun(col2), verbose = TRUE], output="RHS for item 1 has been duplicated")
2310+
test(754.10, DT[, col1 := testFun(col2), verbose = TRUE], output="RHS for item 1 has been duplicated")
23092311
DT = data.table(id=1:64, col1=0, col2=0)
23102312
DT[, col1 := testFun(col2)]
23112313
DT[, col2 := 999]
2312-
test(754.10, DT, data.table(id=1:64, col1=0, col2=999))
2314+
test(754.11, DT, data.table(id=1:64, col1=0, col2=999))
23132315
rm(testFun)
23142316

23152317
# Used to test warning on redundant by (#2282) but by=.EACHI has now superseded

0 commit comments

Comments
 (0)