t.Errorf("unexpected error %q from rand Float64", err)
}
}
+ {
+ var flagSet flag.FlagSet
+ err := do(&b, &flagSet, []string{"bytes", "Foo"})
+ if err == nil {
+ t.Errorf("expected error from bytes Foo")
+ } else if !strings.Contains(err.Error(), "no symbol Foo") {
+ t.Errorf("unexpected error %q from bytes Foo", err)
+ }
+ }
+ {
+ var flagSet flag.FlagSet
+ err := do(&b, &flagSet, []string{"nosuchpackage", "Foo"})
+ if err == nil {
+ // actually present in the user's filesystem
+ } else if !strings.Contains(err.Error(), "no such package") {
+ t.Errorf("unexpected error %q from nosuchpackage Foo", err)
+ }
+ }
}
type trimTest struct {
if i > 0 && !more { // Ignore the "more" bit on the first iteration.
return failMessage(paths, symbol, method)
}
+ if buildPackage == nil {
+ return fmt.Errorf("no such package: %s", userPath)
+ }
symbol, method = parseSymbol(sym)
pkg := parsePackage(writer, buildPackage, userPath)
paths = append(paths, pkg.prettyPath())
// Package must be findable and importable.
packagePath, ok := findPackage(args[0])
if !ok {
- log.Fatalf("no such package: %s", args[0])
+ return nil, args[0], args[1], false
}
return importDir(packagePath), args[0], args[1], true
}