Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,15 @@ class TestKtVariable<T, P : Position<P>> :
assertNotNull(loader.getWith<T, P>(emptyMap<String, String>()))
loader.variables["seed"] shouldNot beNull()
}

// This is a regression test, when using Alchemist variables inside a JSR223Variable scope,
// the simulation does not inherit the external variables into the JSR scope.
// Caused by: javax.script.ScriptException: ERROR Unresolved reference: *externalVariableName*
"simulation should load external variables inside function scope" {
val file = ResourceLoader.getResource("regression/testJSRVariable.yml")
assertNotNull(file)
val loader = LoadAlchemist.from(file)
assertNotNull(loader.getWith<T, P>(emptyMap<String, String>()))
loader.variables["simple"] shouldNot beNull()
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
incarnation: sapere

_constants:
name: "test"

variables:
number: 1
other:
type: ArbitraryVariable
parameters: [ 1, [1, 2]]
simple: &simple
language: kotlin
formula: |
val couple: Pair<Int, String> = (number + other) to name
Loading