tests/testthat/test_submit.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("submit")

test_that("submit file does not exist", {
  expect_error(submit("/hi/there"))
})

test_that("submit empty", {
  expect_error(submit())
})

test_that("submit fake job no intern", {
  fake <- try(.submit.job("echo fake > /dev/null"))
  expect_true(is.na(fake))
})

test_that("submit fake job str intern", {
  fake <- try(.submit.job("echo fake", intern=T))
  expect_equal(fake, "fake")
})

test_that("submit fake job int intern", {
  fake <- try(.submit.job("echo fake > /dev/null", intern=F))
  expect_equal(fake, 0)
})

test_that("submit fake job no intern", {
  fake <- try(.submit.job("echo fake > /dev/null"))
  expect_true(is.na(fake))
})

test_that("submit function error", {
  expect_error(submit(mean))
})
dirmeier/submitr documentation built on May 15, 2019, 8:51 a.m.