Commit b0bd5ee4 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

mandoc test: Check for mandoc in PATH, only fail in case of errors

parent 21b9e37e
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -6,15 +6,22 @@ use 5.010;
use Test::More tests => 3;

SKIP: {
	qx{mandoc -V};
	my $mandoc_present = 0;

	if ( $? != 0 ) {
	for my $path (split(qr{:}, $ENV{PATH})) {
		if (-x "${path}/mandoc") {
			$mandoc_present = 1;
			last;
		}
	}

	if ( not $mandoc_present ) {
		diag('mandoc not installed, test skipped. This is NOT fatal.');
		skip( 'mandoc not installed', 3 );
	}

	for my $file ( 'feh', 'feh-cam', 'gen-cam-menu' ) {
		qx{mandoc -Tlint man/${file}.1};
		qx{mandoc -Tlint -Werror man/${file}.1};
		is( $?, 0, "${file}.1: Valid mdoc syntax" );
	}
}