Resolves MediaFire share IDs into direct links.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

41 lines
1.1 KiB

package main
import (
func TestErr(t *testing.T) {
for v, err := range map[string]errMessage{
"Unknown": errUnknownMediaFireError,
"NoSuchShare": errNoSuchShare,
"FileStillUploading": errFileStillUploading,
} {
v, err := v, err
t.Run(v, func(t *testing.T) {
if err.Error() != string(err) {
t.Errorf("unexpected err text %#v", err.Error())
if err.Wrap(nil) != nil {
t.Errorf("expected wrapped nil error to be nil")
if w := err.Wrap(errors.New("test")); w.Error() != string(err)+": test" {
t.Errorf("unexpected wrapped error %#v", w.Error())
} else if !err.Is(w) {
t.Errorf("expected wrapped error to be an instance of original")
if err.Is(errors.New("test")) {
t.Error("expected error not to match")
if err.Is(nil) {
t.Error("expected error not to match nil")
if err.Errorf("%s", "test").Error() != string(err)+": test" {
t.Errorf("expected errorf result to match")
if err.Errorf("").Error() != string(err) {
t.Errorf("expected blank errorf result to be original")