summaryrefslogtreecommitdiff
path: root/tests/commit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/commit')
-rw-r--r--tests/commit/commit.c8
-rw-r--r--tests/commit/write.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/commit/commit.c b/tests/commit/commit.c
index f5461cfd3..81aaf80d3 100644
--- a/tests/commit/commit.c
+++ b/tests/commit/commit.c
@@ -70,12 +70,16 @@ void test_commit_commit__summary(void)
assert_commit_summary("Trimmed leading&trailing newlines", "\n\nTrimmed leading&trailing newlines\n\n");
assert_commit_summary("First paragraph only", "\nFirst paragraph only\n\n(There are more!)");
assert_commit_summary("First paragraph with unwrapped trailing\tlines", "\nFirst paragraph\nwith unwrapped\ntrailing\tlines\n\n(Yes, unwrapped!)");
- assert_commit_summary("\tLeading \ttabs", "\tLeading\n\ttabs\n\nis preserved");
- assert_commit_summary(" Leading Spaces", " Leading\n Spaces\n\nare preserved");
+ assert_commit_summary("\tLeading tabs", "\tLeading\n\ttabs\n\nare preserved"); /* tabs around newlines are collapsed down to a single space */
+ assert_commit_summary(" Leading Spaces", " Leading\n Spaces\n\nare preserved"); /* spaces around newlines are collapsed down to a single space */
assert_commit_summary("Trailing tabs\tare removed", "Trailing tabs\tare removed\t\t");
assert_commit_summary("Trailing spaces are removed", "Trailing spaces are removed ");
assert_commit_summary("Trailing tabs", "Trailing tabs\t\n\nare removed");
assert_commit_summary("Trailing spaces", "Trailing spaces \n\nare removed");
+ assert_commit_summary("Newlines are replaced by spaces", "Newlines\nare\nreplaced by spaces\n");
+ assert_commit_summary(" Spaces after newlines are collapsed", "\n Spaces after newlines\n are\n collapsed\n "); /* newlines at the very beginning are ignored and not collapsed */
+ assert_commit_summary(" Spaces before newlines are collapsed", " \nSpaces before newlines \nare \ncollapsed \n");
+ assert_commit_summary(" Spaces around newlines are collapsed", " \n Spaces around newlines \n are \n collapsed \n ");
assert_commit_summary("", "");
assert_commit_summary("", " ");
assert_commit_summary("", "\n");
diff --git a/tests/commit/write.c b/tests/commit/write.c
index ee9eb8237..176965cbd 100644
--- a/tests/commit/write.c
+++ b/tests/commit/write.c
@@ -8,7 +8,7 @@ static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
static const char *root_commit_message = "This is a root commit\n\
This is a root commit and should be the only one in this branch\n";
static const char *root_reflog_message = "commit (initial): This is a root commit \
- This is a root commit and should be the only one in this branch";
+This is a root commit and should be the only one in this branch";
static char *head_old;
static git_reference *head, *branch;
static git_commit *commit;