NAME

Game::Terminal::Kit::Test::Handle - a filehandle that refuses to be one

VERSION

Version 0.05

SYNOPSIS

use Test::More;
use Game::Terminal::Kit::Test::Handle;

{
    tie local *STDOUT, 'Game::Terminal::Kit::Test::Handle';
    tie local *STDIN, 'Game::Terminal::Kit::Test::Handle';
    my $moves = eval { $game->legal_moves };
    is $@, '', 'the rules print nothing and read nothing';
}

DESCRIPTION

For a test that the part of a game which is not its terminal does no input or output. Tie STDOUT or STDIN to this class and anything that writes to the one dies with wrote to a handle, anything that reads from the other dies with read from a handle, and reopening either dies with opened a handle. binmode and close are let through.

The test's own results still get out: Test::More writes to a copy of STDOUT it took before the tie.

SEE ALSO

Game::Terminal::Kit::Test::Screen.

AUTHOR

LNATION, <email at lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)