@@ -2292,24 +2292,26 @@ RHS = as.integer(DT$a)
22922292test(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
22982300DT = data.table(a=1:3)
22992301DT[,b:=as.character(a)]
23002302DT[, 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
23032305testFun = function(x) {
23042306 x[FALSE] = 1
23052307 x
23062308}
23072309DT = 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")
23092311DT = data.table(id=1:64, col1=0, col2=0)
23102312DT[, col1 := testFun(col2)]
23112313DT[, 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))
23132315rm(testFun)
23142316
23152317# Used to test warning on redundant by (#2282) but by=.EACHI has now superseded
0 commit comments