citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit de517a8a5e5c9ce6f84198520aa332b01d295426
parent 48cababf44944677620e4e951e1946d5abf06994
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu, 29 Dec 2016 17:24:05 -0700

t: convert check_baddir.sh to perl

Diffstat:
Dt/check_baddir.sh | 12------------
At/check_baddir.t | 20++++++++++++++++++++
2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/t/check_baddir.sh b/t/check_baddir.sh @@ -1,12 +0,0 @@ -#!/bin/sh -u -# -# Verify that passing a bad directory to citrun_check errors out. -# -. t/utils.subr -plan 1 - - -output_good="find: _nonexistent_dir_: No such file or directory -Summary: - 0 Source files used as input" -ok_program "error on bad dir" 123 "$output_good" citrun_check _nonexistent_dir_ diff --git a/t/check_baddir.t b/t/check_baddir.t @@ -0,0 +1,20 @@ +# +# Verify that passing a bad directory to citrun_check errors out. +# +use strict; +use warnings; +use Test::Cmd; +use Test::More tests => 3; + +my $output_good = "Summary: + 0 Source files used as input +"; +my $error_good = "find: _nonexistent_: No such file or directory +"; + +my $check = Test::Cmd->new( prog => 'src/citrun_check', workdir => '' ); +$check->run( args => '_nonexistent_', chdir => $check->curdir ); + +is( $check->stdout, $output_good, 'is citrun_check stdout identical' ); +is( $check->stderr, $error_good, 'is citrun_check stderr identical' ); +is( $? >> 8, 123, 'is citrun_check exit code 123' );