X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_capitests.ml;h=b41e2889494d6c91c69cbd2a50ebff6a4468dfef;hp=044c70d4a787440ca1b6791cca92633b93e4e129;hb=14490c3e1aac61c6ac90f28828896683f64f0dc9;hpb=b42262c3db6013c363e2532cf7a466ccaf4d49f0 diff --git a/generator/generator_capitests.ml b/generator/generator_capitests.ml index 044c70d..b41e288 100644 --- a/generator/generator_capitests.ml +++ b/generator/generator_capitests.ml @@ -685,6 +685,19 @@ and generate_one_test_body name i test_name init test = in List.iter (generate_test_command_call test_name) seq; generate_test_command_call ~test test_name last + | TestOutputDevice (seq, expected) -> + pr " /* TestOutputDevice for %s (%d) */\n" name i; + pr " const char *expected = \"%s\";\n" (c_quote expected); + let seq, last = get_seq_last seq in + let test () = + pr " r[5] = 's';\n"; + pr " if (STRNEQ (r, expected)) {\n"; + pr " fprintf (stderr, \"%s: expected \\\"%%s\\\" but got \\\"%%s\\\"\\n\", expected, r);\n" test_name; + pr " return -1;\n"; + pr " }\n" + in + List.iter (generate_test_command_call test_name) seq; + generate_test_command_call ~test test_name last | TestLastFail seq -> pr " /* TestLastFail for %s (%d) */\n" name i; let seq, last = get_seq_last seq in @@ -707,6 +720,13 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd = with Not_found -> failwithf "%s: in test, command %s was not found" test_name name in + (* If the call has optional args, fold them all together. We cannot + * test partial optional args yet. + *) + let style = + let ret, args, optargs = style in + ret, args@optargs in + if List.length (snd style) <> List.length args then failwithf "%s: in test, wrong number of args given to %s" test_name name;