Small check for semantic check

Staring with a simple pattern for checking for non-variables at left hand
side like [[ LHS == $value ]]. The file is supposed be amended in the future.

This fixes #3074 .

Upon commit it fails first as there are two instances which will be detected
(one is deliberate but will be changed too) .
This commit is contained in:
Dirk
2026-07-10 19:33:08 +02:00
parent 1be2f7472a
commit 0c16ebd6b9
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env perl
# Basics: are there semantic errors which are easy to spot?
use strict;
use Test::More;
my $tests = 0;
my $prg="testssl.sh";
# Patterns used to trigger an error:
#1
printf "\n%s\n", "Testing for missing vars at left hand side in double square brackets ...";
# I know this isn't nice but perl doesn't seem for this so great either
my @matches = `grep -n '\\[\\[ [[:alpha:]]' $prg`;
is(scalar(@matches), 0, "Checking bad '[[ LHS' patterns")
or diag(@matches);
$tests++;
i
# more would go here
printf "\n";
done_testing($tests);
# vim:ts=5:sw=5:expandtab