# WARNING - Generated by {fusen} from dev/flat_kwb_simulate_inflow.Rmd: do not edit by hand # nolint: line_length_linter.

test_that("removeColumns works correctly with explicit columns", {
  df <- data.frame(a = 1:3, b = letters[1:3], c = c(TRUE, FALSE, TRUE))

  # Remove single column
  result <- removeColumns(df, columns = "b")
  expect_equal(names(result), c("a", "c"))
  expect_equal(result$a, df$a)
  expect_equal(result$c, df$c)

  # Remove multiple columns
  result <- removeColumns(df, columns = c("a", "c"))
  expect_equal(names(result), "b")
  expect_equal(result$b, df$b)
})

test_that("removeColumns works correctly with pattern", {
  df <- data.frame(a = 1:3, b = letters[1:3], c = c(TRUE, FALSE, TRUE))

  # Remove columns matching pattern
  result <- removeColumns(df, pattern = "^[ac]$")
  expect_equal(names(result), "b")
  expect_equal(result$b, df$b)
})

test_that("removeColumns handles non-existent columns", {
  df <- data.frame(a = 1:3, b = letters[1:3])

  # Should return original data frame unchanged
  result <- removeColumns(df, columns = "x")
  expect_equal(result, df)

  # Should return original data frame unchanged
  result <- removeColumns(df, pattern = "x")
  expect_equal(result, df)
})

test_that("removeColumns maintains attributes", {
  df <- data.frame(a = 1:3, b = letters[1:3])
  attr(df, "my_attr") <- "test"

  result <- removeColumns(df, columns = "b")
  expect_equal(attr(result, "my_attr"), "test")
})

test_that("removeColumns handles deprecated columnsToRemove argument", {
  df <- data.frame(a = 1:3, b = letters[1:3])

  # Test warning is issued
  expect_warning(removeColumns(df, columnsToRemove = "b"))

  # Test functionality remains the same (deprecation warning already asserted above)
  result <- suppressWarnings(removeColumns(df, columnsToRemove = "b"))
  expect_equal(names(result), "a")
})

test_that("removeColumns requires either columns or pattern", {
  df <- data.frame(a = 1:3, b = letters[1:3])

  # Should throw error
  expect_error(removeColumns(df))
})

