1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 "golang.org/x/tools/go/buildutil"
16 func TestTags(t *testing.T) {
17 f := flag.NewFlagSet("TestTags", flag.PanicOnError)
18 var ctxt build.Context
19 f.Var((*buildutil.TagsFlag)(&ctxt.BuildTags), "tags", buildutil.TagsFlagDoc)
20 f.Parse([]string{"-tags", ` 'one'"two" 'three "four"'`, "rest"})
23 want := []string{"one", "two", "three \"four\""}
24 if !reflect.DeepEqual(ctxt.BuildTags, want) {
25 t.Errorf("BuildTags = %q, want %q", ctxt.BuildTags, want)
29 if want := []string{"rest"}; !reflect.DeepEqual(f.Args(), want) {
30 t.Errorf("f.Args() = %q, want %q", f.Args(), want)