summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-11-03 09:22:49 +0200
committerPaul Buetow <paul@buetow.org>2021-11-03 09:22:49 +0200
commit426196c23fa4be59ad024f5d6891b1de047581f9 (patch)
tree9024ac46e2fcd9ad1dd6c9ba14286e1b1c514726 /integrationtests
parent69b4659b2e644506476a7285970121b3fc98c15b (diff)
Add integration test for long line splitting - Also fixed a bug regarding this along the way
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/dcat3.txt3
-rw-r--r--integrationtests/dcat3.txt.expected5
-rw-r--r--integrationtests/dcat_test.go27
3 files changed, 35 insertions, 0 deletions
diff --git a/integrationtests/dcat3.txt b/integrationtests/dcat3.txt
new file mode 100644
index 0000000..f57b70b
--- /dev/null
+++ b/integrationtests/dcat3.txt
@@ -0,0 +1,3 @@
+A short line
+A long line (dcat will split it up into multiple smaller lines): Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here!
+Another short line
diff --git a/integrationtests/dcat3.txt.expected b/integrationtests/dcat3.txt.expected
new file mode 100644
index 0000000..730f31a
--- /dev/null
+++ b/integrationtests/dcat3.txt.expected
@@ -0,0 +1,5 @@
+A short line
+A long line (dcat will split it up into multiple smaller lines): Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some rand
+om content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some ran
+dom content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here Some random content here!
+Another short line
diff --git a/integrationtests/dcat_test.go b/integrationtests/dcat_test.go
index bef5db2..d07279a 100644
--- a/integrationtests/dcat_test.go
+++ b/integrationtests/dcat_test.go
@@ -68,6 +68,33 @@ func TestDCat2(t *testing.T) {
os.Remove(outFile)
}
+func TestDCat3(t *testing.T) {
+ if !config.Env("DTAIL_INTEGRATION_TEST_RUN_MODE") {
+ return
+ }
+ inFile := "dcat3.txt"
+ expectedFile := "dcat3.txt.expected"
+ outFile := "dcat3.out"
+
+ args := []string{"--plain", "--logLevel", "error", "--cfg", "none", inFile}
+
+ // Split up long lines to smaller ones.
+ os.Setenv("DTAIL_MAX_LINE_LENGTH", "1000")
+
+ _, err := runCommand(context.TODO(), t, outFile, "../dcat", args...)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ if err := compareFilesContents(t, outFile, expectedFile); err != nil {
+ t.Error(err)
+ return
+ }
+
+ os.Remove(outFile)
+}
+
func TestDCatColors(t *testing.T) {
if !config.Env("DTAIL_INTEGRATION_TEST_RUN_MODE") {
return