Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion t/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 changes: 36 additions & 0 deletions t/t0008-array.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions t/t0008/array.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[sec1]
var1=foo bar
var2=foo2
[sec2]
var1=foo bar
var2=foo2