"Eval with semicolon at end returns NULL"
"Warnings and normal output are both transferred and stable"
# TODO problems with non-ascii-characters
'println(22); @warn "This might be serious"; 17'
"A return value of nothing is not printed"
"Test loading and importing a complex package"
'begin
                 using Pkg;
                 try
                    @eval import StatsBase
                 catch ex
                    Pkg.add("StatsBase")
                 end
             end
             '
"Error when trying to import a non-existent package or module"
"Error when passing multiple strings to import or using"
"Echo: 1-element vector of Int in Julia"
"UInt32, Float16, and Float32 translated to doubles in R"
"Echo: 0-element vector of Float64 in Julia"
"Echo: 1-element vector of Float64 in Julia"
"Echo: 2-element vector of Float64/double"
"Echo: 1-element vector of Float32 in Julia"
"Echo: 1-element vector of String in Julia"
"Echo: 0-element vector of String in Julia"
"Echo: 2-element vector of String in Julia"
"Union{Int32,Missing}[1 missing 3; 3 missing 4 ]"
"Union{Int16,Missing}[-1 missing 3; 3 missing 4 ]"
"Echo: Double vector with missing values"
"Union{Float32,Missing}[1.0f0 missing 3.0f0; 3.0f0 missing 4.0f0 ]"
"global reftestvar = 1; Ref(reftestvar)"
"Complex values are handled first class"
'mutable struct TestMutableStruct
                x::Int
             end'
"Immutable struct usable by reference and translated"
"Arrays with undef entries are translated"
"mutable struct MutableTestStruct
                f::Float64
             end"
"x = Vector{MutableTestStruct}(undef, 3);
             x[1] = MutableTestStruct(x1);
             x[2] = MutableTestStruct(x2);
            x"
"x = Array{MutableTestStruct}(undef, 2, 3, 4);
             x[1,1,1] = MutableTestStruct(x1);
            x[2,2,2] = MutableTestStruct(x2);
            x"
"Undefined strings are transferred as empty strings"
"String with null can be translated back to Julia"
"Let: must error with no named argument"
"Let: Simple example from documentation works"
"Let: arguments without names not accepted"
"Complex Julia object with different member type"
'function TestTypeWithAllKindsOfStuff()
               TestTypeWithAllKindsOfStuff(
                     nothing,
                     rand(Float16), rand(Float32), rand(Float64),
                     rand(Bool),
                     rand(Int8), rand(UInt8),
                     rand(Int16), rand(UInt16),
                     rand(Int32), rand(UInt32),
                     rand(Char),
                     rand(Int64), rand(UInt64),
                     rand(Int128), rand(UInt128),
                     rand(Float16, 2), rand(Float32, 2), rand(Float64, 2),
                     rand(Bool, 2),
                     rand(Int8, 2), rand(UInt8, 2),
                     rand(Int16, 2), rand(UInt16, 2),
                     rand(Int32, 2), rand(UInt32, 2),
                     rand(Char, 2),
                     rand(Int64, 2), rand(UInt64, 2),
                     rand(Int128, 2), rand(UInt128, 2))
             end'
'struct MyPrivateX
            x::Int
            function MyPrivateX()
               new(5)
            end
          end'
'module ImportTestModule1
               export f
               f(x)=1
             end'
"Vectors of objects can be accessed by index via proxy"
'function testNestedFun(ts::Vector{TestStruct}) map(t -> t.f(), ts) end'
'function testNestedFunNamed(;ts::Vector{TestStruct}) map(t -> t.f(), ts) end'
'function testNestedFun2(ts::Vector{TestStruct}) for i = 1:2 map(t -> t.f(), ts) end end'
'function testNestedFunArgs(ts::Vector{TestStruct}, args...) map(t -> t.f(args...), ts) end'
'function testNestedAndUnnested(f::Function, ts::Vector{TestStruct}, args...)
             testNestedFunArgs(ts, args...)
             f(args...)
             end'
"Callback function calling Julia erroring in Julia"
"Builtin functions can be used as callback functions"
"Callback function might have error in R"
"Julia functions as members are transferred and usable in R"
"juliaCall checks given name before running"
"juliaCall can handle keyword arguments with key \"name\""
'module TestTypeModule
                export TestType
                struct TestType end
             end'
"module ParametricTypeTestModule
               export MyParametricType
               struct MyParametricType{T}
                  i::T
               end
             end"
"library(JuliaConnectoR); juliaEval('global x = 1')"
'Base.depwarn("there is a deprecation warning", :foo)'
"JULIACONNECTOR_SERVER environment variable and Killing Julia works"
"Circular references do not lead to a crash"
'mutable struct TestRecur
                  r::Union{TestRecur, Int}
                  end'
"r1 = TestRecur(2); r2 = TestRecur(r1); r1.r = r2; r1"
"Anonymous functions can be transferred"
"Test BigInt: a Julia object with external pointers"
# references in sharedheap must survive this
# after one command, the references from R should be cleaned up
"Serialized mutable struct can be restored"
"mutable struct TestSerializationStruct
               i::Int
             end"
# copy of the serialized copy is cleaned up
"Object with unexported function defined in different modules"
'
   module FirstModule
      struct FirstType
         f::Function
      end
      f(x::FirstType) = 1
   end

   module SecondModule

      import ..FirstModule.f
      struct SecondType
         f::Function
      end

      f(x::SecondType) = 2
   end #module'
"AbstractArrays are transferred by reference and can be translated to struct"
"Boltzmann machine can be trained and used"
'using Pkg;
              try
                 @eval import BoltzmannMachines
              catch ex
                 Pkg.add(PackageSpec(name = "BoltzmannMachines", version = v"1.2"))
              end'
"Display of default printing is limited to width"
"Attempt to translate Julia Table with incompatible types results in proper error"
'Column type "Any" cannot be translated'
"Julia types are converted to r compatible types in data frames"
'map(i -> SubString(i, 2,3), ["asdf", "wert"])'
"module TestBroadcasting
                 function my_add(x,y) x+y end
                 function my_mul(x,y) x*y end
             end"
"Environemnt variables for Julia can be set"
"Skip Flux example because Julia version is too old"
'error = function(e) { paste("e: ",e$message) },'
'warning = function(w) { paste("w: ", w$message) })'
'import Pkg;
            try
               @eval import BoltzmannMachines
            catch ex
               Pkg.add(PackageSpec(name = "BoltzmannMachines", version = v"1.3"))
            end'

Attempt to translate Julia Table with incompatible types results in proper error