From fa567730776174b4662eaddebef1341a358ff9a4 Mon Sep 17 00:00:00 2001 From: xonix Date: Wed, 22 Dec 2021 14:34:49 +0200 Subject: [PATCH] Insufficient validation in `@define` #85 --- tests/16_define_validation.tush | 6 ++++-- tests/16_define_validation_error.sh | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/16_define_validation.tush b/tests/16_define_validation.tush index d36dcfd..8ff3318 100644 --- a/tests/16_define_validation.tush +++ b/tests/16_define_validation.tush @@ -58,7 +58,7 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/16_define_validation_error.sh @ Invalid define declaration: @ tests/16_define_validation_error.sh:18: @define C='aaa aaa' echo 'Hello' # comment @ Invalid define declaration: -@ tests/16_define_validation_error.sh:19: @define C='aaa aaa' echo 'Hello' ; # comment +@ tests/16_define_validation_error.sh:19: @define C1='aaa aaa' echo 'Hello' ; # comment @ Invalid define declaration: @ tests/16_define_validation_error.sh:22: @define B3='bbb ; bbb'; @ Invalid define declaration: @@ -78,6 +78,8 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/16_define_validation_error.sh @ Invalid define declaration: @ tests/16_define_validation_error.sh:32: @define IL5=a-b @ Invalid define declaration: -@ tests/16_define_validation_error.sh:33: @define IL5=a+b +@ tests/16_define_validation_error.sh:33: @define IL6=a+b +@ Invalid define declaration: +@ tests/16_define_validation_error.sh:34: @define IL7=a;;;b ? 1 diff --git a/tests/16_define_validation_error.sh b/tests/16_define_validation_error.sh index a766a01..c135a86 100644 --- a/tests/16_define_validation_error.sh +++ b/tests/16_define_validation_error.sh @@ -16,7 +16,7 @@ @define A=aaa echo 'Hello' # comment @define B=aaa\ aaa echo 'Hello'# comment @define C='aaa aaa' echo 'Hello' # comment -@define C='aaa aaa' echo 'Hello' ; # comment +@define C1='aaa aaa' echo 'Hello' ; # comment # Let's disallow ';' for simplicity and unification @define B3='bbb ; bbb'; @@ -30,7 +30,8 @@ @define IL3=a&&b @define IL4=a!b @define IL5=a-b -@define IL5=a+b +@define IL6=a+b +@define IL7=a;;;b @goal default echo 'Should not show'