@@ -530,14 +530,18 @@ void test_config_write__outside_change(void)
530
530
git_config_free (cfg );
531
531
}
532
532
533
+ #define FOO_COMMENT \
534
+ "; another comment!\n"
535
+
533
536
#define SECTION_FOO \
534
537
"\n" \
535
538
" \n" \
536
539
" [section \"foo\"] \n" \
537
540
" # here's a comment\n" \
538
541
"\tname = \"value\"\n" \
539
542
" name2 = \"value2\"\n" \
540
- "; another comment!\n"
543
+
544
+ #define SECTION_FOO_WITH_COMMENT SECTION_FOO FOO_COMMENT
541
545
542
546
#define SECTION_BAR \
543
547
"[section \"bar\"]\t\n" \
@@ -553,7 +557,7 @@ void test_config_write__preserves_whitespace_and_comments(void)
553
557
git_buf newfile = GIT_BUF_INIT ;
554
558
555
559
/* This config can occur after removing and re-adding the origin remote */
556
- const char * file_content = SECTION_FOO SECTION_BAR ;
560
+ const char * file_content = SECTION_FOO_WITH_COMMENT SECTION_BAR ;
557
561
558
562
/* Write the test config and make sure the expected entry exists */
559
563
cl_git_mkfile (file_name , file_content );
@@ -567,9 +571,10 @@ void test_config_write__preserves_whitespace_and_comments(void)
567
571
568
572
cl_assert_equal_strn (SECTION_FOO , n , strlen (SECTION_FOO ));
569
573
n += strlen (SECTION_FOO );
570
-
571
574
cl_assert_equal_strn ("\tother = otherval\n" , n , strlen ("\tother = otherval\n" ));
572
575
n += strlen ("\tother = otherval\n" );
576
+ cl_assert_equal_strn (FOO_COMMENT , n , strlen (FOO_COMMENT ));
577
+ n += strlen (FOO_COMMENT );
573
578
574
579
cl_assert_equal_strn (SECTION_BAR , n , strlen (SECTION_BAR ));
575
580
n += strlen (SECTION_BAR );
0 commit comments