Subject: | Tests need an display check |
If Tk is installed, but no X11 server is running at the moment, then the test suite fails:
...
One window will pop up now...
couldn't connect to display ":0" at /opt/perl-5.25.9/lib/site_perl/5.25.9/x86_64-linux/Tk/MainWindow.pm line 53.
MainWindow->new() at t/02_Tk-EntryCheck.t line 20.
t/02_Tk-EntryCheck.t ..
Dubious, test returned 111 (wstat 28416, 0x6f00)
Failed 1/2 subtests
...
Probably the test should be skipped completely if MainWindow->new fails, e.g. like this (untested):
use Test::More;
use Tk;
my $mw = eval { MainWindow->new };
plan skip_all => "Cannot create MainWindow: $@" if !$mw;
plan tests => ...;