[ library(test_util) | Reference Manual | Alphabetic Index ]

+Goal should_output +ExpectedText

Run the goal Goal, capturing any output to the 'output' stream, and complain if it doesn't match ExpectedText. ExpectedText can be given as a string, an atom, or a codes or chars list. If a list is used, it can be partial, in which case the Goal output (converted to a list) must be an instance of the expected list.

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Examples

        write(hello) should_output hello.
        write(hello) should_output "hello".
        write(hello) should_output `hello`.
        writeln(hello) should_output "hello\n".
        write(hello) should_output [h,e,l,l,o].
        write(hello) should_output [0'h,0'e,0'l,0'l,0'o].
        write(hello) should_output [h,e|_].
    

See Also

should_give / 2, should_fail / 1, should_throw / 2, should_raise / 2, should_output / 3