File: both_test.go

package info (click to toggle)
golang-github-kballard-go-shellquote 0.0~git20180428.95032a8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, experimental, sid, trixie
  • size: 88 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package shellquote

import (
	"reflect"
	"testing"
	"testing/quick"
)

// this is called bothtest because it tests Split and Join together

func TestJoinSplit(t *testing.T) {
	f := func(strs []string) bool {
		// Join, then split, the input
		combined := Join(strs...)
		split, err := Split(combined)
		if err != nil {
			t.Logf("Error splitting %#v: %v", combined, err)
			return false
		}
		if !reflect.DeepEqual(strs, split) {
			t.Logf("Input %q did not match output %q", strs, split)
			return false
		}
		return true
	}
	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}