### ----------------------------------------------------
### -- Terminal::ReadKey
### -- Licenses: Artistic-2.0
### -- Authors: thundergnat
### -- File: t/99-bug-return-type.rakutest
### ----------------------------------------------------

use Test;
use Test::Mock;

plan 3;

use Term::termios;
use Terminal::ReadKey (:_testing);

sub MAIN {
    temp $Terminal::ReadKey::termios;

    $Terminal::ReadKey::termios = mocked(
        Term::termios, overriding => {
            getattr => -> { $Terminal::ReadKey::termios },
        }
    );

    lives-ok( { with-termios( sub {} ) }, "with-termios lives");

    # Verify the mock object was called.
    check-mock($Terminal::ReadKey::termios,
        *.called('getattr'),
        *.called('setattr')
    );

    done-testing;
}


