Running ‘test-00-class-interfaces.R’ [3s/4s]
Running the tests in ‘tests/test-00-class-interfaces.R’ failed.
Complete output:
  > library("jsr223")
  > source("utility.R")
  > cat("Begin Test - ScriptEngine and CompiledScript Class Interfaces\n\n")
  Begin Test - ScriptEngine and CompiledScript Class Interfaces
  
  > 
  > # ScriptEngine constructor parameter validation -------------------------------
  > 
  > cat("ScriptEngine constructor parameter validation\n")
  ScriptEngine constructor parameter validation
  > 
  > assertMessage(
  +   {
  +     js <- ScriptEngine$new()
  +   }
  +   , 'argument "engine.name" is missing, with no default'
  + )
  > 
  > assertMessage(
  +   {
  +     js <- ScriptEngine$new(1)
  +   }
  +   , "'engine.name' must be a character vector of length 1 containing a valid engine script name."
  + )
  > 
  > assertMessage(
  +   {
  +     js <- ScriptEngine$new(c("a", "b"))
  +   }
  +   , "'engine.name' must be a character vector of length 1 containing a valid engine script name."
  + )
  > 
  > assertMessage(
  +   {
  +     js <- ScriptEngine$new("jsx")
  +   }
  +   , "java.lang.Exception: Failed to instantiate engine 'jsx'. Make sure the engine dependencies are in the class path."
  + )
  > 
  > assertMessage(
  +   {
  +     js <- ScriptEngine$new("javascript", class.path = 1)
  +   }
  +   , "'class.path' must be a character vector."
  + )
  > 
  > assertMessage(
  +   {
  +     js <- ScriptEngine$new("javascript", class.path = sprintf(" %s badfile %s b ", .Platform$path.sep, .Platform$path.sep))
  +   }
  +   , "The file 'badfile' specified in the class path does not exist."
  + )
  > 
  > js <- ScriptEngine$new("  javascript  ") # Intentionally using spaces for testing trim...
  > assertIdentical(TRUE, js$isInitialized())
  > 
  > 
  > # set / $<- / get / $ -----------------------------------------------------
  > 
  > cat("set / $<- / get / $\n")
  set / $<- / get / $
  > 
  > # Does not allow any of the ScriptEngine method/property names to be used
  > # in set/get methods.
  > assertMessage(
  +   {
  +     js$set("set", 1)
  +   }
  +   , "The identifier 'set' is reserved."
  + )
  > 
  > assertMessage(
  +   {
  +     js$set("R", 1)
  +   }
  +   , "The identifier 'R' is reserved."
  + )
  > 
  > assertMessage(
  +   {
  +     js$get("get")
  +   }
  +   , "The identifier 'get' is reserved."
  + )
  > 
  > assertMessage(
  +   {
  +     js$get("R")
  +   }
  +   , "The identifier 'R' is reserved."
  + )
  > 
  > assertMessage(
  +   {
  +     js$set("a", function() {})
  +   }
  +   , "Values of class 'function' are not supported."
  + )
  > 
  > # Comprehensive tests for data types are done elsewhere.
  > js$set("a", 1)
  > assertIdentical(1, js$get("a"))
  > js$b <- 2L
  > assertIdentical(2L, js$b)
  > js$c <- NULL
  > assertIdentical(NULL, js$c)
  > assertIdentical(NULL, js$get("doesNotExist"))
  > assertIdentical(NULL, js$doesNotExist)
  > js %~% "var a = undefined;"
  > assertIdentical(NULL, js$a)
  > 
  > 
  > # remove ------------------------------------------------------------------
  > 
  > cat("remove\n")
  remove
  > 
  > assertIdentical(FALSE, js$remove("doesNotExist"))
  > js$a <- 1
  > assertIdentical(TRUE, js$remove("a"))
  > 
  > assertMessage(
  +   {
  +     js$remove("R")
  +   }
  +   , "The identifier 'R' is reserved."
  + )
  > 
  > assertMessage(
  +   {
  +     js$remove("remove")
  +   }
  +   , "The identifier 'remove' is reserved."
  + )
  > 
  > 
  > # getBindings ------------------------------------------------------------
  > 
  > cat("getBindings\n")
  getBindings
  > 
  > js$setDataFrameRowMajor(FALSE)
  > js$d <- list(1, 2, 3)
  > js$c <- mtcars
  > js$b <- letters
  > js$a <- 1
  > v <- js$getBindings()
  > # Make sure they are sorted coming back...
  > compare <- list(
  +   a = "java.lang.Double"
  +   , b = "[Ljava.lang.String;"
  +   , c = "java.util.LinkedHashMap"
  +   , d = "java.util.ArrayList"
  +   , R = "org.fgilbert.jsr223.RClient"
  + )
  > assertIdentical(compare, v)
  > invisible(js$remove("d"))
  > compare$d <- NULL
  > v <- js$getBindings()
  > assertIdentical(compare, v)
  > js$setDataFrameRowMajor(jsr223:::DEFAULT_DATA_FRAME_ROW_MAJOR)
  > 
  > # getClassPath ------------------------------------------------------------
  > 
  > cat("getClassPath\n")
  getClassPath
  > 
  > if (length(js$getClassPath()) < 3L) stop("getClassPath returned an unexpected value.")
  > 
  > 
  > # eval / %~% / %@% --------------------------------------------------------
  > 
  > cat("eval / %~% / %@%\n")
  eval / %~% / %@%
  > 
  > assertMessage(
  +   {
  +     js$eval(1)
  +   }
  +   , "'script' must be a character vector of length 1."
  + )
  > 
  > assertMessage(
  +   {
  +     js$eval(c("a", "b"))
  +   }
  +   , "'script' must be a character vector of length 1."
  + )
  > 
  > assertMessage(
  +   {
  +     js$eval("a", discard.return.value = "a")
  +   }
  +   , "method putEvaluationRequest with signature (Ljava/lang/String;Ljava/lang/String;)V not found"
  + )
  > 
  > assertMessage(
  +   {
  +     js$eval("a", bindings = 1)
  +   }
  +   , "'bindings' requires a named list."
  + )
  > 
  > assertMessage(
  +   {
  +     js$eval("a", bindings = list())
  +   }
  +   , "'bindings' requires a named list."
  + )
  > 
  > assertMessage(
  +   {
  +     js$eval("a", bindings = list(1))
  +   }
  +   , "'bindings' requires a named list."
  + )
  > 
  > assertMessage(
  +   {
  +     js$eval("a", bindings = list(R = 1))
  +   }
  +   , "The identifier 'R' is reserved."
  + )
  > 
  > # Comprehensive tests for data types and callbacks are done elsewhere.
  > assertIdentical(NULL, js$eval("var a = 1;"))
  > assertIdentical(1L, js$eval("a;"))
  Error in assertIdentical(1L, js$eval("a;")) : 
    Expected value '1' but received '1'.
  Execution halted