REPL client for use with automated code generation rather than user I/O.
[thrasher.git] / tests / tests.pl
blob3d5085d4654aa02eba453f063bfdf194f1386b55
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
5 use Test::More tests => 1;
7 is (run_grep('incomplete_init', 'Purple core is uninitialized', '2>&1'),
8 1,
9 'Test login_thrasher for core validation');
13 # Returns the number of times the given regex is found when running the cmd
14 # Allows for bash redirection via bash_redir arg
15 sub run_grep {
16 my $cmd = shift;
17 my $re = shift;
18 my $bash_redir = shift;
20 if (-x $cmd) {
21 $cmd .= " $bash_redir" if $bash_redir;
22 return scalar grep {/$re/} `./$cmd`;
25 # Stop hard on bad commands
26 diag("Command \"$cmd\" is not executable!\n");
27 exit 0;