Commit 27f7e3b2 authored by Bill Thiede's avatar Bill Thiede Committed by David Symonds

misc/vim: test.sh seems to only work on Mac OS X.

cmp(1) on FreeBSD requires two file arguments.  grep -P on Linux (at least
Ubuntu 12.04) is described in the man page as "This is highly
experimental" and doesn't seem to work. On FreeBSD the man page states
"This option  is not supported in FreeBSD."  Needed this to work while
debugging some funky behavior of 'Import' in my local vim setup.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7675043
parent 21842823
...@@ -29,13 +29,13 @@ test_one() { ...@@ -29,13 +29,13 @@ test_one() {
vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \ vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \
-c "$1" -c 'wq! test.go' base.go -c "$1" -c 'wq! test.go' base.go
# ensure blank lines are treated correctly # ensure blank lines are treated correctly
if ! gofmt test.go | cmp test.go; then if ! gofmt test.go | cmp test.go -; then
echo 2>&1 "gofmt conflict" echo 2>&1 "gofmt conflict"
gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1 gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1
fail=1 fail=1
return return
fi fi
if ! grep -P -q "(?s)$2" test.go; then if ! [[ $(cat test.go) =~ $2 ]]; then
echo 2>&1 "$2 did not match" echo 2>&1 "$2 did not match"
cat test.go | sed "s/^/ /" 2>&1 cat test.go | sed "s/^/ /" 2>&1
fail=1 fail=1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment