File: interactive.liq

package info (click to toggle)
liquidsoap 2.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 11,912 kB
  • sloc: ml: 67,867; javascript: 24,842; ansic: 273; xml: 114; sh: 96; lisp: 96; makefile: 26
file content (39 lines) | stat: -rw-r--r-- 674 bytes parent folder | download | duplicates (2)
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)