Skip to content

Commit

Permalink
python: add a whole interface server test class (NB necessary boilerp…
Browse files Browse the repository at this point in the history
…late is still missing)
  • Loading branch information
David Scott committed Mar 11, 2012
1 parent a31dfde commit 9709d88
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion types.ml
Expand Up @@ -449,6 +449,18 @@ module To_python = struct
])
]

let test_impl_of_interfaces env i =
let open Printf in
[ Line (sprintf "class %s_server_test:" i.Interfaces.name);
Block [
Line "\"\"\"Create a server which will respond to all calls, returning arbitrary values. This is intended as a marshal/unmarshal test.\"\"\"";
Line "def __init__(self):";
Block [
Line (Printf.sprintf "self.server = %s_server_dispatcher(%s)" i.Interfaces.name (String.concat ", " (List.map (fun i -> i.Interface.name ^ "_test()") i.Interfaces.interfaces)))
]
]
]

let of_interfaces env i =
let open Printf in
(List.fold_left (fun acc i -> acc @
Expand Down Expand Up @@ -478,7 +490,7 @@ module To_python = struct
Line "return value(internal_error(str(e)))"
]
])
]
] @ (test_impl_of_interfaces env i)

end

Expand Down

0 comments on commit 9709d88

Please sign in to comment.