From 0184648014179cac9cb00ceb0baf4c68a0623979 Mon Sep 17 00:00:00 2001 From: albfan Date: Mon, 22 Jan 2018 22:43:58 +0100 Subject: [PATCH] add broken test for comments --- t/t0004-comments.sh | 19 +++++++++++++++++++ t/t0004/comments.ini | 12 ++++++++++++ t/t0004/comments.out.correct | 9 +++++++++ 3 files changed, 40 insertions(+) create mode 100755 t/t0004-comments.sh create mode 100644 t/t0004/comments.ini create mode 100644 t/t0004/comments.out.correct diff --git a/t/t0004-comments.sh b/t/t0004-comments.sh new file mode 100755 index 0000000..2c67009 --- /dev/null +++ b/t/t0004-comments.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +SHARNESS_TEST_EXTENSION="sh" + +test_description="check comments" + +. sharness/sharness.sh + +. ../../bash-ini-parser + +DIR_TEST=$SHARNESS_TEST_DIRECTORY/t0004 + +test_expect_success "Parse sections" " + cfg_parser $DIR_TEST/comments.ini + cfg_writer > comments.out + diff $DIR_TEST/comments.out.correct comments.out +" + +test_done diff --git a/t/t0004/comments.ini b/t/t0004/comments.ini new file mode 100644 index 0000000..90e2bd8 --- /dev/null +++ b/t/t0004/comments.ini @@ -0,0 +1,12 @@ +;initial comment +[sec1] +var1=foo +var2=hoge +var3=hoge#bar +var4="#hello #bye #chao" +[sec2] +;another comment +#a comment +var2=foo +var4="123#456" +var5=234#456 diff --git a/t/t0004/comments.out.correct b/t/t0004/comments.out.correct new file mode 100644 index 0000000..0109ba1 --- /dev/null +++ b/t/t0004/comments.out.correct @@ -0,0 +1,9 @@ +[sec1] +var1="foo" +var2="hoge" +var3="hoge#bar" +var4="#hello #bye #chao" +[sec2] +var2="foo" +var4="123#456" +var5="234#456"