From 426196c23fa4be59ad024f5d6891b1de047581f9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 3 Nov 2021 09:22:49 +0200 Subject: Add integration test for long line splitting - Also fixed a bug regarding this along the way --- integrationtests/dcat3.txt | 3 +++ integrationtests/dcat3.txt.expected | 5 +++++ integrationtests/dcat_test.go | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 integrationtests/dcat3.txt create mode 100644 integrationtests/dcat3.txt.expected (limited to 'integrationtests') 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 -- cgit v1.2.3