@@ -21303,3 +21303,21 @@ local({
2130321303 test(2326.2, key(d), "x")
2130421304 test(2326.3, indices(d), c("y", "z"))
2130521305})
21306+
21307+ # Test for spurious min/max warnings in cube(), #6964
21308+ SimData = data.table(var = rep(c("a", "b", "c"), each = 3), value = 1:9)
21309+ # Test 1: Checking that cube() with min() no longer warns
21310+ test(2327.1,tryCatch({ cube(SimData, .(min(value)), "var"); "no warning" },
21311+ warning = function(w) conditionMessage(w)),"no warning")
21312+ # Test 2: Checking that the result of cube() with min() is still correct
21313+ test(2327.2, sort(cube(SimData, .(V1 = min(value)), "var")$V1), c(1, 1, 4, 7))
21314+ # Test 3: Checking that cube() with max() no longer warns
21315+ test(2327.3,tryCatch({ cube(SimData, .(max(value)), "var"); "no warning" },
21316+ warning = function(w) conditionMessage(w)),"no warning")
21317+ # Test 4: Checking that the result of cube() with max() is still correct
21318+ test(2327.4, sort(cube(SimData, .(V1 = max(value)), "var")$V1), c(3, 6, 9, 9))
21319+ # Test 5: Checking with NA values present
21320+ SimData2 = data.table(var = c("a", "a", "b", "b"), value = c(NA_real_, NA_real_, 5, 6))
21321+ test(2327.5,tryCatch({ cube(SimData2, .(min(value)), "var"); "no warning" },
21322+ warning = function(w) conditionMessage(w)),"no warning")
21323+
0 commit comments