mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
test(builtin/export): ensure that identifiers are correctly accepted or rejected
This commit is contained in:
parent
c5e15903e0
commit
5fabec58d5
1 changed files with 25 additions and 0 deletions
25
test.sh
25
test.sh
|
|
@ -770,4 +770,29 @@ minishell: export: `0': not a valid identifier
|
||||||
1
|
1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
when_run <<"EOF" "export with identifiers containing numbers"
|
||||||
|
export VAR1=this VAR2=should VAR3=work VAR4=no VAR5="problem!"
|
||||||
|
echo $VAR1 $VAR2 $VAR3 $VAR4 $VAR5
|
||||||
|
EOF
|
||||||
|
expecting <<EOF
|
||||||
|
this should work no problem!
|
||||||
|
EOF
|
||||||
|
|
||||||
|
when_run <<"EOF" "export with identifiers containing and starting with underscore"
|
||||||
|
export __var__=__value__ _snake_case_variable_names_=Pascal_Snake_Case
|
||||||
|
echo $__var__ $_snake_case_variable_names_
|
||||||
|
EOF
|
||||||
|
expecting <<EOF
|
||||||
|
__value__ Pascal_Snake_Case
|
||||||
|
EOF
|
||||||
|
|
||||||
|
when_run <<"EOF" "export with identifiers containing dashes"
|
||||||
|
export -VAR=value lisp-case="(defun botsbuildbots () (botsbuildbots))" --option-case=--no-preserve-root
|
||||||
|
EOF
|
||||||
|
expecting <<"EOF"
|
||||||
|
minishell: export: `-VAR=value': not a valid identifier
|
||||||
|
minishell: export: `lisp-case=(defun botsbuildbots () (botsbuildbots))': not a valid identifier
|
||||||
|
minishell: export: `--option-case=--no-preserve-root': not a valid identifier
|
||||||
|
EOF
|
||||||
|
|
||||||
finalize
|
finalize
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue