aboutsummaryrefslogtreecommitdiff
path: root/lib/test/data_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-25 01:54:57 +0700
committerShulhan <ms@kilabit.info>2022-07-25 01:54:57 +0700
commit6c72cd80c30f62885809ac874e9869fdb0a1aaaa (patch)
tree7dec5f53e306a565d995cb330b42a2ede1817726 /lib/test/data_test.go
parenteb932c941bd3456f5b0635641274853e062916e7 (diff)
downloadpakakeh.go-6c72cd80c30f62885809ac874e9869fdb0a1aaaa.tar.xz
lib/test: truncate the last new line at the end of input and output
Given the following input and output, >>> input <<< output EOF The input and output content always have new line at the end. This may cause unexpected input or output. If input or output content expecting new line at the end, add two empty lines at the end of it.
Diffstat (limited to 'lib/test/data_test.go')
-rw-r--r--lib/test/data_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/test/data_test.go b/lib/test/data_test.go
index b6a9f3f0..139599a5 100644
--- a/lib/test/data_test.go
+++ b/lib/test/data_test.go
@@ -33,7 +33,7 @@ func TestData_parse(t *testing.T) {
content: []byte(">>>\n\ninput.\n\n"),
expData: Data{
Input: map[string][]byte{
- `default`: []byte("\ninput.\n\n"),
+ `default`: []byte("\ninput.\n"),
},
},
}, {
@@ -41,7 +41,7 @@ func TestData_parse(t *testing.T) {
content: []byte("<<<\n\noutput.\n\n"),
expData: Data{
Output: map[string][]byte{
- `default`: []byte("\noutput.\n\n"),
+ `default`: []byte("\noutput.\n"),
},
},
}, {
@@ -66,8 +66,8 @@ func TestData_parse(t *testing.T) {
},
Desc: []byte("Desc."),
Input: map[string][]byte{
- "input 1": []byte("1\n"),
- "input 2": []byte("2\n"),
+ "input 1": []byte("1"),
+ "input 2": []byte("2"),
},
},
}, {
@@ -80,8 +80,8 @@ func TestData_parse(t *testing.T) {
Flag: map[string]string{},
Desc: []byte("Desc."),
Output: map[string][]byte{
- "output-1": []byte("1\n\n2\n"),
- "output-2": []byte("3\n\n4\n"),
+ "output-1": []byte("1\n\n2"),
+ "output-2": []byte("3\n\n4"),
},
},
}, {
@@ -93,7 +93,7 @@ func TestData_parse(t *testing.T) {
expData: Data{
Flag: map[string]string{},
Input: map[string][]byte{
- "default": []byte("Input 2.\n"),
+ "default": []byte("Input 2."),
},
},
}, {
@@ -105,7 +105,7 @@ func TestData_parse(t *testing.T) {
),
expData: Data{
Input: map[string][]byte{
- "default": []byte("Input 1.\n<<<\nOutput 1.\n"),
+ "default": []byte("Input 1.\n<<<\nOutput 1."),
},
},
}}