"io";
"os";
"path";
- "sort";
"strings";
)
i += len(open);
// write as many newlines as found in the excluded text
- // to maintain correct line numbers in error messages
+ // to maintain correct line numbers in error messages
for _, ch := range src[0 : i] {
if ch == '\n' {
buf.WriteByte('\n');
importpath=$(make -s importpath)
{
+ # test functions are named TestFoo
+ # the grep -v eliminates methods and other special names
+ # that have multiple dots.
+ pattern='Test([^a-z].*)?'
+ tests=$(6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
+ if [ "x$tests" = x ]; then
+ echo 'gotest: error: no tests matching '$pattern in _test/$importpath.a $xofile 1>&2
+ exit 2
+ fi
+
# package spec
echo 'package main'
echo
# imports
- echo 'import "'$importpath'"'
+ if echo "$tests" | egrep -v '_test\.' >/dev/null; then
+ echo 'import "'$importpath'"'
+ fi
if $havex; then
echo 'import "./_xtest_"'
fi
# test array
echo
echo 'var tests = []testing.Test {'
-
- # test functions are named TestFoo
- # the grep -v eliminates methods and other special names
- # that have multiple dots.
- pattern='Test([^a-z].*)?'
- tests=$(6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
- if [ "x$tests" = x ]; then
- echo 'gotest: warning: no tests matching '$pattern in _test/$importpath.a $xofile 1>&2
- else
- for i in $tests
- do
- echo ' testing.Test{ "'$i'", '$i' },'
- done
- fi
+ for i in $tests
+ do
+ echo ' testing.Test{ "'$i'", '$i' },'
+ done
echo '}'
# body
echo
// the manuals for the appropriate operating system.
package syscall
-import "unsafe"
-
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)