.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.1.0 / go / buildutil / tags_test.go
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.
4
5 package buildutil_test
6
7 import (
8         "flag"
9         "go/build"
10         "reflect"
11         "testing"
12
13         "golang.org/x/tools/go/buildutil"
14 )
15
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"})
21
22         // BuildTags
23         want := []string{"one", "two", "three \"four\""}
24         if !reflect.DeepEqual(ctxt.BuildTags, want) {
25                 t.Errorf("BuildTags = %q, want %q", ctxt.BuildTags, want)
26         }
27
28         // Args()
29         if want := []string{"rest"}; !reflect.DeepEqual(f.Args(), want) {
30                 t.Errorf("f.Args() = %q, want %q", f.Args(), want)
31         }
32 }