commit
6266d3e5b7
|
@ -1,5 +1,6 @@
|
||||||
[![GoDoc](https://godoc.org/github.com/alexflint/go-arg?status.svg)](https://godoc.org/github.com/alexflint/go-arg)
|
[![GoDoc](https://godoc.org/github.com/alexflint/go-arg?status.svg)](https://godoc.org/github.com/alexflint/go-arg)
|
||||||
[![Build Status](https://travis-ci.org/alexflint/go-arg.svg?branch=master)](https://travis-ci.org/alexflint/go-arg)
|
[![Build Status](https://travis-ci.org/alexflint/go-arg.svg?branch=master)](https://travis-ci.org/alexflint/go-arg)
|
||||||
|
[![GolangCI](https://golangci.com/badges/github.com/alexflint/go-arg.svg)](https://golangci.com/r/github.com/alexflint/go-arg)
|
||||||
[![Coverage Status](https://coveralls.io/repos/alexflint/go-arg/badge.svg?branch=master&service=github)](https://coveralls.io/github/alexflint/go-arg?branch=master)
|
[![Coverage Status](https://coveralls.io/repos/alexflint/go-arg/badge.svg?branch=master&service=github)](https://coveralls.io/github/alexflint/go-arg?branch=master)
|
||||||
[![Report Card](https://goreportcard.com/badge/github.com/alexflint/go-arg)](https://goreportcard.com/badge/github.com/alexflint/go-arg)
|
[![Report Card](https://goreportcard.com/badge/github.com/alexflint/go-arg)](https://goreportcard.com/badge/github.com/alexflint/go-arg)
|
||||||
|
|
||||||
|
|
|
@ -458,14 +458,14 @@ func TestHelpFlag(t *testing.T) {
|
||||||
func TestPanicOnNonPointer(t *testing.T) {
|
func TestPanicOnNonPointer(t *testing.T) {
|
||||||
var args struct{}
|
var args struct{}
|
||||||
assert.Panics(t, func() {
|
assert.Panics(t, func() {
|
||||||
parse("", args)
|
_ = parse("", args)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPanicOnNonStruct(t *testing.T) {
|
func TestPanicOnNonStruct(t *testing.T) {
|
||||||
var args string
|
var args string
|
||||||
assert.Panics(t, func() {
|
assert.Panics(t, func() {
|
||||||
parse("", &args)
|
_ = parse("", &args)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,5 @@ func main() {
|
||||||
Test string
|
Test string
|
||||||
}
|
}
|
||||||
arg.MustParse(&args)
|
arg.MustParse(&args)
|
||||||
|
_ = args.Test
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,14 @@ package arg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"strings"
|
|
||||||
"fmt"
|
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type NameDotName struct {
|
type NameDotName struct {
|
||||||
|
@ -89,15 +89,11 @@ Options:
|
||||||
type MyEnum int
|
type MyEnum int
|
||||||
|
|
||||||
func (n *MyEnum) UnmarshalText(b []byte) error {
|
func (n *MyEnum) UnmarshalText(b []byte) error {
|
||||||
b = []byte("Hello")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *MyEnum) MarshalText() (text []byte, err error) {
|
func (n *MyEnum) MarshalText() ([]byte, error) {
|
||||||
s := "There was a problem"
|
return nil, errors.New("There was a problem")
|
||||||
text = []byte(s)
|
|
||||||
err = errors.New(s)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUsageError(t *testing.T) {
|
func TestUsageError(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue