File: start_stop_test.ml

package info (click to toggle)
liquidsoap 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,372 kB
  • sloc: ml: 71,806; javascript: 27,320; ansic: 398; xml: 114; sh: 99; lisp: 96; makefile: 26
file content (30 lines) | stat: -rw-r--r-- 601 bytes parent folder | download
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
class start_stop_test _state start stop =
  object
    inherit Start_stop.base
    method! state = _state
    method start = start ()
    method stop = stop ()
    method fallible = true
  end

exception Success

let () =
  let s =
    new start_stop_test `Idle (fun () -> assert false) (fun () -> assert false)
  in
  s#reset;
  let s =
    new start_stop_test
      `Stopped
      (fun () -> assert false)
      (fun () -> assert false)
  in
  s#reset;
  let s =
    new start_stop_test `Started (fun () -> raise Success) (fun () -> ())
  in
  try
    s#reset;
    assert false
  with Success -> ()