1package flags
2
3import (
4	"testing"
5)
6
7func TestTagMissingColon(t *testing.T) {
8	var opts = struct {
9		Value bool `short`
10	}{}
11
12	assertParseFail(t, ErrTag, "expected `:' after key name, but got end of tag (in `short`)", &opts, "")
13}
14
15func TestTagMissingValue(t *testing.T) {
16	var opts = struct {
17		Value bool `short:`
18	}{}
19
20	assertParseFail(t, ErrTag, "expected `\"' to start tag value at end of tag (in `short:`)", &opts, "")
21}
22
23func TestTagMissingQuote(t *testing.T) {
24	var opts = struct {
25		Value bool `short:"v`
26	}{}
27
28	assertParseFail(t, ErrTag, "expected end of tag value `\"' at end of tag (in `short:\"v`)", &opts, "")
29}
30
31func TestTagNewline(t *testing.T) {
32	var opts = struct {
33		Value bool `long:"verbose" description:"verbose
34something"`
35	}{}
36
37	assertParseFail(t, ErrTag, "unexpected newline in tag value `description' (in `long:\"verbose\" description:\"verbose\nsomething\"`)", &opts, "")
38}
39