diff options
| author | Shulhan <ms@kilabit.info> | 2023-11-10 15:07:52 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-11-11 18:37:15 +0700 |
| commit | d8b7a4e509a641ea2949646c5a3577bc848fea30 (patch) | |
| tree | 09f9bb2d3f3afe83a17fc2c1e85cba606da276b7 /script_test.go | |
| parent | cf6d0e5bb0baf5acbc70f8084d087e3a41b5452e (diff) | |
| download | awwan-d8b7a4e509a641ea2949646c5a3577bc848fea30.tar.xz | |
script: respect spaces when joining multi lines command
If a multi lines command does not have spaces or have multiple
spaces, join them as is.
For example,
a\
b
should return the value as "ab", while
a \
b
should return "a b".
Diffstat (limited to 'script_test.go')
| -rw-r--r-- | script_test.go | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/script_test.go b/script_test.go index eb6432b..476bdab 100644 --- a/script_test.go +++ b/script_test.go @@ -49,24 +49,30 @@ func TestJoinStatements(t *testing.T) { exp [][]byte } + var ( + tdata *test.Data + err error + ) + + tdata, err = test.LoadData(`testdata/script_joinStatements_test.data`) + if err != nil { + t.Fatal(err) + } + var cases = []testCase{{ - in: bytes.Split([]byte(` -a -b \ -c -d \ -e \ -f -g`), []byte("\n")), + in: bytes.Split(tdata.Input[`case_0`], []byte("\n")), exp: [][]byte{ nil, []byte("a"), []byte("b c"), nil, - []byte("d e f"), + []byte("d e f"), + nil, + nil, + []byte(`gh,i`), nil, + []byte(`j k`), nil, - []byte("g"), }, }} |
