aboutsummaryrefslogtreecommitdiff
path: root/shell_test.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2022-03-29 00:29:20 -0700
committerDan Willemsen <dwillemsen@google.com>2022-03-29 00:29:30 -0700
commit3f0ffb2e3d6c03069ddc73614aafc4fdc519b3f2 (patch)
treea6c24731f7f548627606ef34cd4a0d9040914f3d /shell_test.go
parente166c15bebef29f9fbcd12a3037cf6a3b0769012 (diff)
parentc181225cdd36312bde6fc5c16d3bca3b3a3e5b0c (diff)
downloadgo-creachadair-shell-master.tar.gz
Merge tag 'v0.0.7'HEADmastermain
Change-Id: I933d67e1e014ded054f25550471ce0feb713842b
Diffstat (limited to 'shell_test.go')
-rw-r--r--shell_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/shell_test.go b/shell_test.go
index c5564a3..c6ef732 100644
--- a/shell_test.go
+++ b/shell_test.go
@@ -3,11 +3,11 @@ package shell
import (
"fmt"
"io"
- "io/ioutil"
"log"
- "reflect"
"strings"
"testing"
+
+ "github.com/google/go-cmp/cmp"
)
func TestQuote(t *testing.T) {
@@ -100,8 +100,8 @@ func TestSplit(t *testing.T) {
if ok != test.ok {
t.Errorf("Split %#q: got valid=%v, want %v", test.in, ok, test.ok)
}
- if !reflect.DeepEqual(got, test.want) {
- t.Errorf("Split %#q: got %+q, want %+q", test.in, got, test.want)
+ if diff := cmp.Diff(test.want, got); diff != "" {
+ t.Errorf("Split %#q: (-want, +got)\n%s", test.in, diff)
}
}
}
@@ -137,11 +137,11 @@ func TestScannerSplit(t *testing.T) {
t.Errorf("Unexpected scan error: %v", s.Err())
}
- if !reflect.DeepEqual(got, test.want) {
- t.Errorf("Scanner split prefix: got %+q, want %+q", got, test.want)
+ if diff := cmp.Diff(test.want, got); diff != "" {
+ t.Errorf("Scanner split prefix: (-want, +got)\n%s", diff)
}
- if !reflect.DeepEqual(rest, test.rest) {
- t.Errorf("Scanner split suffix: got %+q, want %+q", rest, test.rest)
+ if diff := cmp.Diff(test.rest, rest); diff != "" {
+ t.Errorf("Scanner split suffix: (-want, +got)\n%s", diff)
}
}
}
@@ -167,8 +167,8 @@ func TestRoundTrip(t *testing.T) {
if !ok {
t.Errorf("Split %+q: should be valid, but is not", s)
}
- if !reflect.DeepEqual(got, test) {
- t.Errorf("Split %+q: got %q, want %q", s, got, test)
+ if diff := cmp.Diff(test, got); diff != "" {
+ t.Errorf("Split %+q: (-want, +got)\n%s", s, diff)
}
}
}
@@ -194,7 +194,7 @@ func ExampleScanner_Rest() {
break
}
}
- rest, err := ioutil.ReadAll(s.Rest())
+ rest, err := io.ReadAll(s.Rest())
if err != nil {
log.Fatal(err)
}