commit 0d67d2f218e35cd49c2d9f48ec21b2b1963a421a
parent 1733eb175a686f8c361793c92177237b32011eb1
Author: Kyle Milz <milz@imac.0x30.net>
Date: Thu, 4 Mar 2021 01:48:34 -0800
t: update
Diffstat:
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/t/lib_badver.t b/t/lib_badver.t
@@ -4,12 +4,12 @@
#
use Modern::Perl;
use t::utils; # os_compiler()
-plan tests => 4;
+plan tests => 5;
-my $compiler = Test::Cmd->new( prog => 'bin/citrun_wrap', workdir => '' );
-$compiler->write( 'main.c', <<EOF );
+my $wrap = Test::Cmd->new( prog => 'bin/citrun_wrap', workdir => '' );
+$wrap->write( 'main.c', <<EOF );
#include <stddef.h>
struct citrun_node;
@@ -18,21 +18,23 @@ void citrun_node_add(unsigned int, unsigned int, struct citrun_node *);
int
main(int argc, char *argv[])
{
- citrun_node_add(0, 255, NULL);
+ citrun_node_add(/* major */ 0, /* minor */ 255, NULL);
}
EOF
-$compiler->run( args => os_compiler() . 'main main.c', chdir => $compiler->curdir );
-# is( $compiler->stdout, '', 'is compiler stdout silent' );
-is( $compiler->stderr, '', 'is compiler stderr silent' );
-is( $? >> 8, 0, 'is compiler exit code 0' );
+$wrap->run( args => os_compiler() . 'main main.c', chdir => $wrap->curdir );
+# is( $wrap->stdout, '', 'is compiler stdout silent' );
+is( $wrap->stderr, '', 'is citrun_wrap stderr silent' );
+is( $? >> 8, 0, 'is citrun_wrap exit code 0' );
my $err_good = 'libcitrun 0.0: incompatible version 0.255.
-Try cleaning and rebuilding your project.
-';
-
-$ENV{CITRUN_PROCDIR} = $compiler->workdir;
-my $abs_prog_path = File::Spec->catfile( $compiler->workdir, "main" );
-$compiler->run( prog => $abs_prog_path, chdir => $compiler->curdir );
-is( $compiler->stdout, '', 'is incompatible node program stdout silent' );
-is( $compiler->stderr, $err_good, 'is incompatible node program stdout silent' );
+Try cleaning and rebuilding your project.';
+
+set_procdir( $wrap->workdir );
+#$wrap->write( 'citrun_gl.lock', '' );
+
+my $abs_prog_path = File::Spec->catfile( $wrap->workdir, "main" );
+$wrap->run( prog => $abs_prog_path, chdir => $wrap->curdir );
+is( $wrap->stdout, '', 'is node program stdout silent' );
+like( $wrap->stderr, qr/$err_good/, 'is node program stderr identical' );
+isnt( $? >> 8, 0, 'is node program exit code nonzero' );