You've already forked bash-ini-parser
mirror of
https://github.com/albfan/bash-ini-parser.git
synced 2025-08-06 07:02:37 +03:00
@@ -53,11 +53,12 @@ function cfg_parser {
|
||||
ini[${#ini[*]} + 1]='}' # add the last brace
|
||||
debug
|
||||
eval "$(echo "${ini[*]}")" # eval the result
|
||||
EVAL_STATUS=$?
|
||||
if [ $CHANGE_EXTGLOB = 1 ]
|
||||
then
|
||||
shopt -u extglob
|
||||
fi
|
||||
|
||||
return $EVAL_STATUS
|
||||
}
|
||||
|
||||
function cfg_writer {
|
||||
|
17
t/t0002-invalid.sh
Executable file
17
t/t0002-invalid.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
SHARNESS_TEST_EXTENSION="sh"
|
||||
|
||||
test_description="check invalid ini files"
|
||||
|
||||
. sharness/sharness.sh
|
||||
|
||||
. ../../bash-ini-parser
|
||||
|
||||
DIR_TEST=$SHARNESS_TEST_DIRECTORY/t0002
|
||||
|
||||
test_expect_success "Invalid line" "
|
||||
test_expect_code 1 cfg_parser $DIR_TEST/invalid.ini
|
||||
"
|
||||
|
||||
test_done
|
8
t/t0002/invalid.ini
Normal file
8
t/t0002/invalid.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
var1=VAR1
|
||||
|
||||
; Invalid line - should throw an error and stop processing
|
||||
INVALID LINE
|
||||
var2=VAR2
|
||||
|
Reference in New Issue
Block a user