1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
success = ref(true)
file = "interactive.json"
def f() =
x = interactive.float("x", 2.)
interactive.save(file)
x.set(15.)
test.equal(x(), 15.)
interactive.load(file)
test.equal(x(), 2.)
try
_ = interactive.float("bla", 0.)
_ = interactive.float("bla", 0.)
log.critical(
"Did not detect double registration."
)
success := false
catch e do
log.important(
"Double registration detected: #{e}"
)
end
try
x = interactive.float("xxx", 3.)
x.remove()
x.set(2.)
success := false
catch e do
log.important(
"Inexistent variable use detected: #{e}"
)
end
test.pass()
end
test.check(f)
|