Commit dcde5720424961f526e8c070b7d99191d7ef75c1

Edward Thomson 2015-11-09T08:23:27

merge tests: move expected data into own file

diff --git a/tests/merge/conflict_data.h b/tests/merge/conflict_data.h
new file mode 100644
index 0000000..173892d
--- /dev/null
+++ b/tests/merge/conflict_data.h
@@ -0,0 +1,42 @@
+#define AUTOMERGEABLE_MERGED_FILE \
+	"this file is changed in master\n" \
+	"this file is automergeable\n" \
+	"this file is automergeable\n" \
+	"this file is automergeable\n" \
+	"this file is automergeable\n" \
+	"this file is automergeable\n" \
+	"this file is automergeable\n" \
+	"this file is automergeable\n" \
+	"this file is changed in branch\n"
+
+#define AUTOMERGEABLE_MERGED_FILE_CRLF \
+	"this file is changed in master\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is automergeable\r\n" \
+	"this file is changed in branch\r\n"
+
+#define CONFLICTING_MERGE_FILE \
+	"<<<<<<< HEAD\n" \
+	"this file is changed in master and branch\n" \
+	"=======\n" \
+	"this file is changed in branch and master\n" \
+	">>>>>>> 7cb63eed597130ba4abb87b3e544b85021905520\n"
+
+#define CONFLICTING_DIFF3_FILE \
+	"<<<<<<< HEAD\n" \
+	"this file is changed in master and branch\n" \
+	"||||||| initial\n" \
+	"this file is a conflict\n" \
+	"=======\n" \
+	"this file is changed in branch and master\n" \
+	">>>>>>> 7cb63eed597130ba4abb87b3e544b85021905520\n"
+
+#define CONFLICTING_UNION_FILE \
+	"this file is changed in master and branch\n" \
+	"this file is changed in branch and master\n"
+
diff --git a/tests/merge/files.c b/tests/merge/files.c
index 2d55df2..daa73fa 100644
--- a/tests/merge/files.c
+++ b/tests/merge/files.c
@@ -4,6 +4,7 @@
 #include "buffer.h"
 #include "merge.h"
 #include "merge_helpers.h"
+#include "conflict_data.h"
 #include "refs.h"
 #include "fileops.h"
 #include "diff_xdiff.h"
diff --git a/tests/merge/merge_helpers.h b/tests/merge/merge_helpers.h
index 554c24b..e407c7d 100644
--- a/tests/merge/merge_helpers.h
+++ b/tests/merge/merge_helpers.h
@@ -4,49 +4,6 @@
 #include "merge.h"
 #include "git2/merge.h"
 
-#define AUTOMERGEABLE_MERGED_FILE \
-	"this file is changed in master\n" \
-	"this file is automergeable\n" \
-	"this file is automergeable\n" \
-	"this file is automergeable\n" \
-	"this file is automergeable\n" \
-	"this file is automergeable\n" \
-	"this file is automergeable\n" \
-	"this file is automergeable\n" \
-	"this file is changed in branch\n"
-
-#define AUTOMERGEABLE_MERGED_FILE_CRLF \
-	"this file is changed in master\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is automergeable\r\n" \
-	"this file is changed in branch\r\n"
-
-#define CONFLICTING_MERGE_FILE \
-	"<<<<<<< HEAD\n" \
-	"this file is changed in master and branch\n" \
-	"=======\n" \
-	"this file is changed in branch and master\n" \
-	">>>>>>> 7cb63eed597130ba4abb87b3e544b85021905520\n"
-
-#define CONFLICTING_DIFF3_FILE \
-	"<<<<<<< HEAD\n" \
-	"this file is changed in master and branch\n" \
-	"||||||| initial\n" \
-	"this file is a conflict\n" \
-	"=======\n" \
-	"this file is changed in branch and master\n" \
-	">>>>>>> 7cb63eed597130ba4abb87b3e544b85021905520\n"
-
-#define CONFLICTING_UNION_FILE \
-	"this file is changed in master and branch\n" \
-	"this file is changed in branch and master\n"
-
-
 struct merge_index_entry {
 	uint16_t mode;
 	char oid_str[GIT_OID_HEXSZ+1];
diff --git a/tests/merge/trees/automerge.c b/tests/merge/trees/automerge.c
index c18881d..67f2cf7 100644
--- a/tests/merge/trees/automerge.c
+++ b/tests/merge/trees/automerge.c
@@ -3,8 +3,9 @@
 #include "git2/merge.h"
 #include "buffer.h"
 #include "merge.h"
-#include "../merge_helpers.h"
 #include "fileops.h"
+#include "../merge_helpers.h"
+#include "../conflict_data.h"
 
 static git_repository *repo;
 
diff --git a/tests/merge/trees/commits.c b/tests/merge/trees/commits.c
index dd1e383..786a77a 100644
--- a/tests/merge/trees/commits.c
+++ b/tests/merge/trees/commits.c
@@ -3,6 +3,7 @@
 #include "git2/merge.h"
 #include "merge.h"
 #include "../merge_helpers.h"
+#include "../conflict_data.h"
 
 static git_repository *repo;
 
diff --git a/tests/merge/workdir/simple.c b/tests/merge/workdir/simple.c
index abc0777..3cdd15b 100644
--- a/tests/merge/workdir/simple.c
+++ b/tests/merge/workdir/simple.c
@@ -4,6 +4,7 @@
 #include "buffer.h"
 #include "merge.h"
 #include "../merge_helpers.h"
+#include "../conflict_data.h"
 #include "refs.h"
 #include "fileops.h"