mirror of
https://github.com/albfan/bash-ini-parser.git
synced 2025-04-19 13:22:14 +03:00
Test case - array.
This commit is contained in:
parent
cd0a4314b1
commit
3579a2ee08
@ -1,4 +1,4 @@
|
||||
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
|
||||
$(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = t0001-whitespace.sh t0002-invalid.sh t0003-sections.sh t0004-comments.sh t0005-new_var.sh t0006-duplication.sh t0007-unwanted_file.sh
|
||||
TESTS = t0001-whitespace.sh t0002-invalid.sh t0003-sections.sh t0004-comments.sh t0005-new_var.sh t0006-duplication.sh t0007-unwanted_file.sh t0008-array.sh
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
36
t/t0008-array.sh
Executable file
36
t/t0008-array.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
test_description="check array"
|
||||
|
||||
. setup.sh
|
||||
|
||||
DIR_TEST=$SHARNESS_TEST_DIRECTORY/t0008
|
||||
|
||||
test_array()
|
||||
{
|
||||
export COVERAGE_NAME=array_parser
|
||||
cp ../.simplecov .
|
||||
|
||||
# Parse sec1 array
|
||||
cfg_parser $DIR_TEST/array.ini
|
||||
cfg_section_sec1
|
||||
[ $var1 = foo ] || return 1
|
||||
[ ${var1[1]} = bar ] || return 1
|
||||
|
||||
# Update sec2 var
|
||||
var2=foo_new
|
||||
cfg_update sec2 var2
|
||||
cfg_writer > array.out
|
||||
|
||||
# Parse sec1 array again
|
||||
cfg_parser array.out
|
||||
cfg_section_sec1
|
||||
[ $var1 = foo ] || return 1
|
||||
[ ${var1[1]} = bar ] || return 1
|
||||
}
|
||||
|
||||
test_expect_success "Parse array" "
|
||||
test_expect_code 0 test_array
|
||||
"
|
||||
|
||||
test_done
|
6
t/t0008/array.ini
Normal file
6
t/t0008/array.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[sec1]
|
||||
var1=foo bar
|
||||
var2=foo2
|
||||
[sec2]
|
||||
var1=foo bar
|
||||
var2=foo2
|
Loading…
x
Reference in New Issue
Block a user