tests/testthat/test_build.R

# submitr: submit jobs to a grid engine easily
#
# Copyright (C) 2016 Simon Dirmeier
#
# This file is part of submitr.
#
# submitr is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# submitr is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with submitr. If not, see <http://www.gnu.org/licenses/>.

context("build")

test_that("build char", {
  cmd <- build(".", sargs=c("a", "b"), gargs=c("c", "d"))
  testthat::expect_equal(cmd, "bsub c d Rscript . a b")
})

test_that("build funrror e", {
  testthat::expect_error(build(mean, sargs=c("a", "b"), gargs=c("c", "d")))
})

test_that("build other false", {
  testthat::expect_error(build(1, sargs=c("a", "b"), gargs=c("c", "d")))
})

test_that("build job", {
  cmd <- .build.job(".", sargs=c("a", "b"), gargs=c("c", "d"))
  testthat::expect_equal(cmd, "bsub c d . a b")
})

test_that("build w/o gargs", {
  cmd <- .build.job(".", sargs=c("a", "b"))
  testthat::expect_equal(cmd, "bsub . a b")
})

test_that("build w/o sargs", {
  cmd <- .build.job(".", gargs=c("a", "b"))
  testthat::expect_equal(cmd, "bsub a b .")
})

test_that("build missing", {
  expect_error(.build.job())
})

test_that("build empty", {
  cmd <- .build.job(".")
  testthat::expect_equal(cmd, "bsub .")
})

test_that("build false sargs", {
  expect_error(build.job(".", sargs=c(1, 1)))
})

test_that("build false gargs", {
  expect_error(build.job(".", gargs=c(1, 1)))
})


test_that("build false file", {
  expect_error(build("asdas"))
})
dirmeier/submitr documentation built on May 15, 2019, 8:51 a.m.